MFC (by le)

| 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.
|
| Revision  Changes    Path
| 1.8       +1 -34     src/sys/geom/vinum/geom_vinum_rm.c

Approved by:	re (scottl)
This commit is contained in:
delphij 2005-10-09 04:37:34 +00:00
parent e27db9d6b8
commit 6dbb98c55a

View File

@ -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)
{