diff options
author | marcel <marcel@FreeBSD.org> | 2006-04-10 03:55:13 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2006-04-10 03:55:13 +0000 |
commit | c168f9530e1b94a463b6747ea1f1bcb5b4ab8cbf (patch) | |
tree | 81cff68e80c2afb7c70386d60e4b5557ec440179 | |
parent | 271e02009f1ba97cb64faec0aef6565c45658e3e (diff) | |
download | FreeBSD-src-c168f9530e1b94a463b6747ea1f1bcb5b4ab8cbf.zip FreeBSD-src-c168f9530e1b94a463b6747ea1f1bcb5b4ab8cbf.tar.gz |
Add g_wither_provider() to abstract the details of destroying a
particular provider. Use this function where g_orphan_provider()
is being called so that the flags are updated correctly and
g_orphan_provider() is called only when allowed.
-rw-r--r-- | sys/geom/geom.h | 1 | ||||
-rw-r--r-- | sys/geom/geom_disk.c | 2 | ||||
-rw-r--r-- | sys/geom/geom_slice.c | 3 | ||||
-rw-r--r-- | sys/geom/geom_subr.c | 12 |
4 files changed, 15 insertions, 3 deletions
diff --git a/sys/geom/geom.h b/sys/geom/geom.h index 7f6bf5a..79a2e3b 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -239,6 +239,7 @@ void g_std_done(struct bio *bp); void g_std_spoiled(struct g_consumer *cp); void g_wither_geom(struct g_geom *gp, int error); void g_wither_geom_close(struct g_geom *gp, int error); +void g_wither_provider(struct g_provider *pp, int error); #ifdef DIAGNOSTIC int g_valid_obj(void const *ptr); diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index 75d8fc4..6115106 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -428,7 +428,7 @@ disk_gone(struct disk *dp) gp = dp->d_geom; if (gp != NULL) LIST_FOREACH(pp, &gp->provider, provider) - g_orphan_provider(pp, ENXIO); + g_wither_provider(pp, ENXIO); } static void diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c index 97b58f5..2cf3385 100644 --- a/sys/geom/geom_slice.c +++ b/sys/geom/geom_slice.c @@ -338,8 +338,7 @@ g_slice_config(struct g_geom *gp, u_int idx, int how, off_t offset, off_t length return (0); if (bootverbose) printf("GEOM: Deconfigure %s\n", pp->name); - pp->flags |= G_PF_WITHER; - g_orphan_provider(pp, ENXIO); + g_wither_provider(pp, ENXIO); gsl->provider = NULL; gsp->nprovider--; return (0); diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index 8bedee9..623650a 100644 --- a/sys/geom/geom_subr.c +++ b/sys/geom/geom_subr.c @@ -318,6 +318,18 @@ g_wither_geom(struct g_geom *gp, int error) } /* + * Convenience function to destroy a particular provider. + */ +void +g_wither_provider(struct g_provider *pp, int error) +{ + + pp->flags |= G_PF_WITHER; + if (!(pp->flags & G_PF_ORPHAN)) + g_orphan_provider(pp, error); +} + +/* * This function is called (repeatedly) until the has withered away. */ void |