[Midnightbsd-cvs] src [9130] trunk/sys/geom: make g_wither_washer to not loop by itself.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Oct 1 20:39:50 EDT 2016
Revision: 9130
http://svnweb.midnightbsd.org/src/?rev=9130
Author: laffer1
Date: 2016-10-01 20:39:50 -0400 (Sat, 01 Oct 2016)
Log Message:
-----------
make g_wither_washer to not loop by itself.
Modified Paths:
--------------
trunk/sys/geom/geom_event.c
trunk/sys/geom/geom_int.h
trunk/sys/geom/geom_subr.c
Modified: trunk/sys/geom/geom_event.c
===================================================================
--- trunk/sys/geom/geom_event.c 2016-10-02 00:39:34 UTC (rev 9129)
+++ trunk/sys/geom/geom_event.c 2016-10-02 00:39:50 UTC (rev 9130)
@@ -274,7 +274,6 @@
void
g_run_events()
{
- int i;
for (;;) {
g_topology_lock();
@@ -281,14 +280,10 @@
while (one_event())
;
mtx_assert(&g_eventlock, MA_OWNED);
- i = g_wither_work;
- if (i) {
+ if (g_wither_work) {
+ g_wither_work = 0;
mtx_unlock(&g_eventlock);
- while (i) {
- i = g_wither_washer();
- g_wither_work = i & 1;
- i &= 2;
- }
+ g_wither_washer();
g_topology_unlock();
} else {
g_topology_unlock();
Modified: trunk/sys/geom/geom_int.h
===================================================================
--- trunk/sys/geom/geom_int.h 2016-10-02 00:39:34 UTC (rev 9129)
+++ trunk/sys/geom/geom_int.h 2016-10-02 00:39:50 UTC (rev 9130)
@@ -66,7 +66,7 @@
/* geom_subr.c */
extern struct class_list_head g_classes;
extern char *g_wait_event, *g_wait_sim, *g_wait_up, *g_wait_down;
-int g_wither_washer(void);
+void g_wither_washer(void);
/* geom_io.c */
void g_io_init(void);
Modified: trunk/sys/geom/geom_subr.c
===================================================================
--- trunk/sys/geom/geom_subr.c 2016-10-02 00:39:34 UTC (rev 9129)
+++ trunk/sys/geom/geom_subr.c 2016-10-02 00:39:50 UTC (rev 9130)
@@ -434,11 +434,9 @@
/*
* This function is called (repeatedly) until we cant wash away more
- * withered bits at present. Return value contains two bits. Bit 0
- * set means "withering stuff we can't wash now", bit 1 means "call
- * me again, there may be stuff I didn't get the first time around.
+ * withered bits at present.
*/
-int
+void
g_wither_washer()
{
struct g_class *mp;
@@ -445,9 +443,7 @@
struct g_geom *gp, *gp2;
struct g_provider *pp, *pp2;
struct g_consumer *cp, *cp2;
- int result;
- result = 0;
g_topology_assert();
LIST_FOREACH(mp, &g_classes, class) {
LIST_FOREACH_SAFE(gp, &mp->geom, geom, gp2) {
@@ -456,8 +452,6 @@
continue;
if (LIST_EMPTY(&pp->consumers))
g_destroy_provider(pp);
- else
- result |= 1;
}
if (!(gp->flags & G_GEOM_WITHER))
continue;
@@ -464,27 +458,19 @@
LIST_FOREACH_SAFE(pp, &gp->provider, provider, pp2) {
if (LIST_EMPTY(&pp->consumers))
g_destroy_provider(pp);
- else
- result |= 1;
}
LIST_FOREACH_SAFE(cp, &gp->consumer, consumer, cp2) {
- if (cp->acr || cp->acw || cp->ace) {
- result |= 1;
+ if (cp->acr || cp->acw || cp->ace)
continue;
- }
if (cp->provider != NULL)
g_detach(cp);
g_destroy_consumer(cp);
- result |= 2;
}
if (LIST_EMPTY(&gp->provider) &&
LIST_EMPTY(&gp->consumer))
g_destroy_geom(gp);
- else
- result |= 1;
}
}
- return (result);
}
struct g_consumer *
@@ -772,10 +758,10 @@
pp = cp->provider;
LIST_REMOVE(cp, consumers);
cp->provider = NULL;
- if (pp->geom->flags & G_GEOM_WITHER)
+ if ((cp->geom->flags & G_GEOM_WITHER) ||
+ (pp->geom->flags & G_GEOM_WITHER) ||
+ (pp->flags & G_PF_WITHER))
g_do_wither();
- else if (pp->flags & G_PF_WITHER)
- g_do_wither();
redo_rank(cp->geom);
}
@@ -873,6 +859,9 @@
if (pp->acr != 0 || pp->acw != 0 || pp->ace != 0)
KASSERT(pp->sectorsize > 0,
("Provider %s lacks sectorsize", pp->name));
+ if ((cp->geom->flags & G_GEOM_WITHER) &&
+ cp->acr == 0 && cp->acw == 0 && cp->ace == 0)
+ g_do_wither();
}
return (error);
}
More information about the Midnightbsd-cvs
mailing list