FreeBSD/sys/geom/virstor/g_virstor.c
/*
 * Remove a component (consumer) from geom instance; If it's the first
 * component being removed, orphan the provider to announce geom's being
 * dismantled
 */
Remove a component (consumer) from geom instance; If it's the first
component being removed, orphan the provider to announce geom's being
dismantled
Remove a component ( consumer ) from geom instance ; If it ' s the first component being removed orphan the provider to announce geom ' s being dismantled
static void
remove_component(struct g_virstor_softc *sc, struct g_virstor_component *comp,
    boolean_t delay)
{
	struct g_consumer *c;
	KASSERT(comp->gcons != NULL, ("Component with no consumer in %s",
	    sc->geom->name));
	c = comp->gcons;
	comp->gcons = NULL;
	KASSERT(c->provider != NULL, ("%s: no provider", __func__));
	LOG_MSG(LVL_DEBUG, "Component %s removed from %s", c->provider->name,
	    sc->geom->name);
	if (sc->provider != NULL) {
		sc->provider->flags |= G_PF_WITHER;
		g_orphan_provider(sc->provider, ENXIO);
		sc->provider = NULL;
		LOG_MSG(LVL_INFO, "Removing provider %s", sc->geom->name);
	}
	if (c->acr > 0 || c->acw > 0 || c->ace > 0)
		g_access(c, -c->acr, -c->acw, -c->ace);
	if (delay) {
		g_post_event(delay_destroy_consumer, c, M_WAITOK, NULL);
	} else {
		g_detach(c);
		g_destroy_consumer(c);
	}
}
static void remove_component ( struct g_virstor_softc * sc , struct g_virstor_component * comp , boolean_t delay ) { struct g_consumer * c ; KASSERT ( comp -> gcons != NULL , ( " " , sc -> geom -> name ) ) ; c = comp -> gcons ; comp -> gcons = NULL ; KASSERT ( c -> provider != NULL , ( " " , __func__ ) ) ; LOG_MSG ( LVL_DEBUG , " " , c -> provider -> name , sc -> geom -> name ) ; if ( sc -> provider != NULL ) { sc -> provider -> flags |= G_PF_WITHER ; g_orphan_provider ( sc -> provider , ENXIO ) ; sc -> provider = NULL ; LOG_MSG ( LVL_INFO , " " , sc -> geom -> name ) ; } if ( c -> acr > 0 || c -> acw > 0 || c -> ace > 0 ) g_access ( c , - c -> acr , - c -> acw , - c -> ace ) ; if ( delay ) { g_post_event ( delay_destroy_consumer , c , M_WAITOK , NULL ) ; } else { g_detach ( c ) ; g_destroy_consumer ( c ) ; } }
Remove a component (consumer) from geom instance; If it's the first
 component being removed, orphan the provider to announce geom's being
 dismantled
Remove a component ( consumer ) from geom instance ; If it ' s the first component being removed orphan the provider to announce geom ' s being dismantled
/* Whither, GEOM? */ /* Destroy consumer after it's tasted */