summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2004-11-09 23:20:50 +0000
committerpjd <pjd@FreeBSD.org>2004-11-09 23:20:50 +0000
commit412bff1f39c19dbc588d70ac080106215db7eec4 (patch)
treeb0460c504df68f0cf84d7a6b76d1359486a83ec0 /sys/geom
parent37a1084115a6c5cba4c2677edd57618c2fe37ea4 (diff)
downloadFreeBSD-src-412bff1f39c19dbc588d70ac080106215db7eec4.zip
FreeBSD-src-412bff1f39c19dbc588d70ac080106215db7eec4.tar.gz
Introduce g_waitidlelock() function which is simlar to g_waitidle(),
but should be called with the topology lock held and returns with the topology lock held and empty event queue. Approved by: phk (sometime ago)
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/geom.h1
-rw-r--r--sys/geom/geom_event.c12
2 files changed, 13 insertions, 0 deletions
diff --git a/sys/geom/geom.h b/sys/geom/geom.h
index ffdc3cb..3ae296b 100644
--- a/sys/geom/geom.h
+++ b/sys/geom/geom.h
@@ -213,6 +213,7 @@ int g_post_event(g_event_t *func, void *arg, int flag, ...);
int g_waitfor_event(g_event_t *func, void *arg, int flag, ...);
void g_cancel_event(void *ref);
void g_orphan_provider(struct g_provider *pp, int error);
+void g_waitidlelock(void);
/* geom_subr.c */
int g_access(struct g_consumer *cp, int nread, int nwrite, int nexcl);
diff --git a/sys/geom/geom_event.c b/sys/geom/geom_event.c
index 9166c30..f550efc 100644
--- a/sys/geom/geom_event.c
+++ b/sys/geom/geom_event.c
@@ -90,6 +90,18 @@ g_waitidle(void)
}
void
+g_waitidlelock(void)
+{
+
+ g_topology_assert();
+ while (g_pending_events) {
+ g_topology_unlock();
+ tsleep(&g_pending_events, PPAUSE, "g_waitidle", hz/5);
+ g_topology_lock();
+ }
+}
+
+void
g_orphan_provider(struct g_provider *pp, int error)
{
OpenPOWER on IntegriCloud