Make it possible to remove stale, left-over subdisks.

This commit is contained in:
le 2005-08-16 15:12:44 +00:00
parent 49cd513ac9
commit cd8ed397a3
2 changed files with 11 additions and 10 deletions

View File

@ -727,7 +727,10 @@ gv_plex_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
/* Now find the correct plex where this subdisk belongs to. */
p = gv_find_plex(sc, s->plex);
KASSERT(p != NULL, ("gv_plex_taste: NULL p"));
if (p == NULL) {
printf("gv_plex_taste: NULL p for '%s'\n", s->name);
return (NULL);
}
/*
* Add this subdisk to this plex. Since we trust the on-disk

View File

@ -244,21 +244,17 @@ gv_rm_plex(struct gv_softc *sc, struct gctl_req *req, struct gv_plex *p, int fla
static int
gv_rm_sd(struct gv_softc *sc, struct gctl_req *req, struct gv_sd *s, int flags)
{
struct gv_drive *d;
struct g_geom *gp;
struct g_provider *pp;
KASSERT(s != NULL, ("gv_rm_sd: NULL s"));
d = s->drive_sc;
KASSERT(d != NULL, ("gv_rm_sd: NULL d"));
gp = d->geom;
KASSERT(gp != NULL, ("gv_rm_sd: NULL gp"));
pp = s->provider;
/* Clean up. */
LIST_REMOVE(s, in_plex);
LIST_REMOVE(s, from_drive);
if (s->plex_sc)
LIST_REMOVE(s, in_plex);
if (s->drive_sc)
LIST_REMOVE(s, from_drive);
LIST_REMOVE(s, sd);
gv_free_sd(s);
g_free(s);
@ -389,8 +385,10 @@ gv_free_sd(struct gv_sd *s)
struct gv_freelist *fl, *fl2;
KASSERT(s != NULL, ("gv_free_sd: NULL s"));
d = s->drive_sc;
KASSERT(d != NULL, ("gv_free_sd: NULL d"));
if (d == NULL)
return;
/*
* First, find the free slot that's immediately before or after this