Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Mar 2008 10:16:12 -0700
From:      Marcel Moolenaar <xcllnt@mac.com>
To:        geom@FreeBSD.org
Subject:   Q: force/trigger a retaste
Message-ID:  <500B8D5E-A46F-48AF-A835-97C46ED36F91@mac.com>

next in thread | raw e-mail | index | archive | help
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@mac.com





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?500B8D5E-A46F-48AF-A835-97C46ED36F91>