diff options
author | phk <phk@FreeBSD.org> | 2004-03-10 08:49:08 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-03-10 08:49:08 +0000 |
commit | 9a7074f4cb924ae82908691b9014ec3046fa7a8a (patch) | |
tree | 3d29009688ec2443c80b12f054dff9ab4238ba22 /sys/geom/geom_event.c | |
parent | 7432091236a4f7e854963b7353bb9e33c7f126ad (diff) | |
download | FreeBSD-src-9a7074f4cb924ae82908691b9014ec3046fa7a8a.zip FreeBSD-src-9a7074f4cb924ae82908691b9014ec3046fa7a8a.tar.gz |
Rearrange some of the GEOM debugging tools to be more structured.
Retire g_sanity() and corresponding debugflag (0x8)
Retire g_{stall,release}_events().
Under #ifdef DIAGNOSTIC:
Make g_valid_obj() an official function and have it return an an
non-zero integer which indicates the kind of object when found.
Implement G_VALID_{CLASS,GEOM,CONSUMER,PROVIDER}() macros based
on g_valid_obj().
Sprinkle calls to these macros liberally over the infrastructure.
Always check that we do not free a live object.
Diffstat (limited to 'sys/geom/geom_event.c')
-rw-r--r-- | sys/geom/geom_event.c | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/sys/geom/geom_event.c b/sys/geom/geom_event.c index cf86b50..afb214f 100644 --- a/sys/geom/geom_event.c +++ b/sys/geom/geom_event.c @@ -59,7 +59,6 @@ static struct event_tailq_head g_events = TAILQ_HEAD_INITIALIZER(g_events); static u_int g_pending_events; static TAILQ_HEAD(,g_provider) g_doorstep = TAILQ_HEAD_INITIALIZER(g_doorstep); static struct mtx g_eventlock; -static struct sx g_eventstall; #define G_N_EVENTREFS 20 @@ -84,23 +83,10 @@ g_waitidle(void) } void -g_stall_events(void) -{ - - sx_xlock(&g_eventstall); -} - -void -g_release_events(void) -{ - - sx_xunlock(&g_eventstall); -} - -void g_orphan_provider(struct g_provider *pp, int error) { + /* G_VALID_PROVIDER(pp) We likely lack topology lock */ g_trace(G_T_TOPOLOGY, "g_orphan_provider(%p(%s), %d)", pp, pp->name, error); KASSERT(error != 0, @@ -128,8 +114,9 @@ g_orphan_register(struct g_provider *pp) struct g_consumer *cp, *cp2; int wf; - g_trace(G_T_TOPOLOGY, "g_orphan_register(%s)", pp->name); g_topology_assert(); + G_VALID_PROVIDER(pp); + g_trace(G_T_TOPOLOGY, "g_orphan_register(%s)", pp->name); wf = pp->flags & G_PF_WITHER; pp->flags &= ~G_PF_WITHER; @@ -166,13 +153,14 @@ one_event(void) struct g_event *ep; struct g_provider *pp; - sx_xlock(&g_eventstall); g_topology_lock(); for (;;) { mtx_lock(&g_eventlock); pp = TAILQ_FIRST(&g_doorstep); - if (pp != NULL) + if (pp != NULL) { + G_VALID_PROVIDER(pp); TAILQ_REMOVE(&g_doorstep, pp, orphan); + } mtx_unlock(&g_eventlock); if (pp == NULL) break; @@ -183,7 +171,6 @@ one_event(void) if (ep == NULL) { mtx_unlock(&g_eventlock); g_topology_unlock(); - sx_xunlock(&g_eventstall); return (0); } TAILQ_REMOVE(&g_events, ep, events); @@ -201,7 +188,6 @@ one_event(void) if (g_pending_events == 0) wakeup(&g_pending_events); g_topology_unlock(); - sx_xunlock(&g_eventstall); return (1); } @@ -337,5 +323,4 @@ g_event_init() { mtx_init(&g_eventlock, "GEOM orphanage", NULL, MTX_DEF); - sx_init(&g_eventstall, "GEOM event stalling"); } |