diff options
author | le <le@FreeBSD.org> | 2005-09-08 20:08:46 +0000 |
---|---|---|
committer | le <le@FreeBSD.org> | 2005-09-08 20:08:46 +0000 |
commit | a5dfb4378d5e5b9ef7278335cbfb341349b9b633 (patch) | |
tree | 395011e3b0a7980636eedee54716ccaf9ad16fe3 | |
parent | df3bd6cde39d52bff241cca550a807c75c866f84 (diff) | |
download | FreeBSD-src-a5dfb4378d5e5b9ef7278335cbfb341349b9b633.zip FreeBSD-src-a5dfb4378d5e5b9ef7278335cbfb341349b9b633.tar.gz |
Set the G_PF_WITHER flag on the subdisk provider that is about to
be destroyed. That way the GEOM system handles all deallocations
and we don't have to do it ourselves.
-rw-r--r-- | sys/geom/vinum/geom_vinum_rm.c | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/sys/geom/vinum/geom_vinum_rm.c b/sys/geom/vinum/geom_vinum_rm.c index bb2b765..44b6110 100644 --- a/sys/geom/vinum/geom_vinum_rm.c +++ b/sys/geom/vinum/geom_vinum_rm.c @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include <geom/vinum/geom_vinum.h> #include <geom/vinum/geom_vinum_share.h> -static void gv_cleanup_pp(void *, int); static void gv_free_sd(struct gv_sd *); static int gv_rm_drive(struct gv_softc *, struct gctl_req *, struct gv_drive *, int); @@ -261,12 +260,8 @@ gv_rm_sd(struct gv_softc *sc, struct gctl_req *req, struct gv_sd *s, int flags) /* If the subdisk has a provider we need to clean up this one too. */ if (pp != NULL) { + pp->flags |= G_PF_WITHER; g_orphan_provider(pp, ENXIO); - if (LIST_EMPTY(&pp->consumers)) - g_destroy_provider(pp); - else - /* Schedule this left-over provider for destruction. */ - g_post_event(gv_cleanup_pp, pp, M_WAITOK, pp, NULL); } return (0); @@ -350,34 +345,6 @@ gv_rm_drive(struct gv_softc *sc, struct gctl_req *req, struct gv_drive *d, int f return (err); } -/* - * This function is called from the event queue to clean up left-over subdisk - * providers. - */ -static void -gv_cleanup_pp(void *arg, int flag) -{ - struct g_provider *pp; - - g_topology_assert(); - - if (flag == EV_CANCEL) - return; - - pp = arg; - if (pp == NULL) { - printf("gv_cleanup_pp: provider has gone\n"); - return; - } - - if (!LIST_EMPTY(&pp->consumers)) { - printf("gv_cleanup_pp: provider still not empty\n"); - return; - } - - g_destroy_provider(pp); -} - static void gv_free_sd(struct gv_sd *s) { |