From a500538d00eed09c74c769c7c94a26119960864f Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 4 Nov 2002 09:31:02 +0000 Subject: Polish a bit here and there. Reenable the geom.ctl device so people can play with gbde. Sponsored by: DARPA & NAI Labs --- sys/geom/geom_event.c | 20 +++++++++++++------- sys/geom/geom_subr.c | 8 +++++--- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/sys/geom/geom_event.c b/sys/geom/geom_event.c index 34a836e..7a235f4 100644 --- a/sys/geom/geom_event.c +++ b/sys/geom/geom_event.c @@ -182,6 +182,9 @@ g_do_event(struct g_event *ep) LIST_FOREACH(mp, &g_classes, class) { if (mp->taste == NULL) continue; + if (!strcmp(ep->provider->name, "geom.ctl") && + strcmp(mp->name, "DEV")) + continue; i = 1; LIST_FOREACH(cp, &ep->provider->consumers, consumers) if(cp->geom->class == mp) @@ -250,12 +253,11 @@ one_event(void) if (ep->consumer != NULL) ep->consumer->event = NULL; g_do_event(ep); + g_destroy_event(ep); g_pending_events--; - if (g_pending_events == 0) { + if (g_pending_events == 0) wakeup(&g_pending_events); - } g_topology_unlock(); - g_destroy_event(ep); return (1); } @@ -279,22 +281,26 @@ g_post_event(enum g_events ev, struct g_class *mp, struct g_geom *gp, struct g_p ep->event = ev; if (mp != NULL) { ep->class = mp; - KASSERT(mp->event == NULL, ("Double event on class")); + KASSERT(mp->event == NULL, ("Double event on class %d %d", + ep->event, mp->event->event)); mp->event = ep; } if (gp != NULL) { ep->geom = gp; - KASSERT(gp->event == NULL, ("Double event on geom")); + KASSERT(gp->event == NULL, ("Double event on geom %d %d", + ep->event, gp->event->event)); gp->event = ep; } if (pp != NULL) { ep->provider = pp; - KASSERT(pp->event == NULL, ("Double event on provider")); + KASSERT(pp->event == NULL, ("Double event on provider %s %d %d", + pp->name, ep->event, pp->event->event)); pp->event = ep; } if (cp != NULL) { ep->consumer = cp; - KASSERT(cp->event == NULL, ("Double event on consumer")); + KASSERT(cp->event == NULL, ("Double event on consumer %d %d", + ep->event, cp->event->event)); cp->event = ep; } mtx_lock(&g_eventlock); diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index f0b213a..e134fd9 100644 --- a/sys/geom/geom_subr.c +++ b/sys/geom/geom_subr.c @@ -190,8 +190,7 @@ g_new_providerf(struct g_geom *gp, char *fmt, ...) pp->geom = gp; LIST_INSERT_HEAD(&gp->provider, pp, provider); g_nproviders++; - if (strcmp(pp->name, "geom.ctl")) - g_post_event(EV_NEW_PROVIDER, NULL, NULL, pp, NULL); + g_post_event(EV_NEW_PROVIDER, NULL, NULL, pp, NULL); return (pp); } @@ -435,7 +434,8 @@ g_access_rel(struct g_consumer *cp, int dcr, int dcw, int dce) */ if (pp->acw == 0 && dcw != 0) g_spoil(pp, cp); - else if (pp->acw != 0 && pp->acw == -dcw && !(pp->geom->flags & G_GEOM_WITHER)) + else if (pp->acw != 0 && pp->acw == -dcw && + !(pp->geom->flags & G_GEOM_WITHER)) g_post_event(EV_NEW_PROVIDER, NULL, NULL, pp, NULL); error = pp->geom->access(pp, dcr, dcw, dce); @@ -547,6 +547,8 @@ g_spoil(struct g_provider *pp, struct g_consumer *cp) g_topology_assert(); + if (!strcmp(pp->name, "geom.ctl")) + return; LIST_FOREACH(cp2, &pp->consumers, consumers) { if (cp2 == cp) continue; -- cgit v1.1