FreeBSD/sys/geom/geom_subr.c
/*
 * Spoiling happens when a provider is opened for writing, but consumers
 * which are configured by in-band data are attached (slicers for instance).
 * Since the write might potentially change the in-band data, such consumers
 * need to re-evaluate their existence after the writing session closes.
 * We do this by (offering to) tear them down when the open for write happens
 * in return for a re-taste when it closes again.
 * Together with the fact that such consumers grab an 'e' bit whenever they
 * are open, regardless of mode, this ends up DTRT.
 */
Spoiling happens when a provider is opened for writing, but consumers
which are configured by in-band data are attached (slicers for instance).
Since the write might potentially change the in-band data, such consumers
need to re-evaluate their existence after the writing session closes.
We do this by (offering to) tear them down when the open for write happens
in return for a re-taste when it closes again.
Together with the fact that such consumers grab an 'e' bit whenever they
are open, regardless of mode, this ends up DTRT.
Spoiling happens when a provider is opened for writing but consumers which are configured by in - band data are attached ( slicers for instance ) . Since the write might potentially change the in - band data such consumers need to re - evaluate their existence after the writing session closes . We do this by ( offering to ) tear them down when the open for write happens in return for a re - taste when it closes again . Together with the fact that such consumers grab an ' e ' bit whenever they are open regardless of mode this ends up DTRT .
static void
g_spoil_event(void *arg, int flag)
{
	struct g_provider *pp;
	struct g_consumer *cp, *cp2;
	g_topology_assert();
	if (flag == EV_CANCEL)
		return;
	pp = arg;
	G_VALID_PROVIDER(pp);
	g_trace(G_T_TOPOLOGY, "%s %p(%s:%s:%s)", __func__, pp,
	    pp->geom->class->name, pp->geom->name, pp->name);
	for (cp = LIST_FIRST(&pp->consumers); cp != NULL; cp = cp2) {
		cp2 = LIST_NEXT(cp, consumers);
		if ((cp->flags & G_CF_SPOILED) == 0)
			continue;
		cp->flags &= ~G_CF_SPOILED;
		if (cp->geom->spoiled == NULL)
			continue;
		cp->geom->spoiled(cp);
		g_topology_assert();
	}
}
static void g_spoil_event ( void * arg , int flag ) { struct g_provider * pp ; struct g_consumer * cp , * cp2 ; g_topology_assert ( ) ; if ( flag == EV_CANCEL ) return ; pp = arg ; G_VALID_PROVIDER ( pp ) ; g_trace ( G_T_TOPOLOGY , " " , __func__ , pp , pp -> geom -> class -> name , pp -> geom -> name , pp -> name ) ; for ( cp = LIST_FIRST ( & pp -> consumers ) ; cp != NULL ; cp = cp2 ) { cp2 = LIST_NEXT ( cp , consumers ) ; if ( ( cp -> flags & G_CF_SPOILED ) == 0 ) continue ; cp -> flags &= ~ G_CF_SPOILED ; if ( cp -> geom -> spoiled == NULL ) continue ; cp -> geom -> spoiled ( cp ) ; g_topology_assert ( ) ; } }
Spoiling happens when a provider is opened for writing, but consumers
 which are configured by in-band data are attached (slicers for instance).
Spoiling happens when a provider is opened for writing but consumers which are configured by in - band data are attached ( slicers for instance ) .