Q: force/trigger a retaste

Marcel Moolenaar xcllnt at mac.com
Fri Mar 21 17:16:15 UTC 2008


All,

I'm working on module support for GPART and I have a need trigger a
retaste.

When we load a GEOM module (read: load a class), the GEOM infrastructure
will present all existing providers to the new class's taste buds. This
will do the right thing out of the box.

With GPART, we can dynamically load and unload partitioning schemes. A
partitioning scheme is not a GEOM class, so the loading of a new scheme
does not cause a new class to be loaded and as such will not cause any
re-tasting. As such, when I have a disk with, say, a GPT but don't yet
have support for the GPT scheme, then loading the GPT scheme will not
automatically result in the creation of new providers. What needs to
happen is that an existing class (i.e. the GPART class) gets to taste
all existing providers again, so that it can attach to providers it
previously did not attach to (due to a change in the supported schemes).

I can definitely put the necessary code in GPART itself, but that may
lead to duplication. But maybe it's more beneficial to make it generic.

I'm thinking about something like:

void
geom_retaste(struct g_class *mp)
{
     struct g_class *clp;
     struct g_geom *gp;
     struct g_provider *pp;

     g_topology_assert();

     LIST_FOREACH(clp, &g_classes, class) {
	LIST_FOREACH(gp, &clp->geom, geom) {
	    LIST_FOREACH(pp, &gp->provider, provider) {
		if (pp->acr + pp->acw + pp->ace == 0) {
		    mp->taste(mp, pp, 0);
		    g_topology_assert();
		}
	    }
	}
     }
}

Is this correct?

Shall I make this a generic GEOM function or keep it private to
GPART?

Thanks,

-- 
Marcel Moolenaar
xcllnt at mac.com




More information about the freebsd-geom mailing list