summaryrefslogtreecommitdiffstats
path: root/sys/geom/vinum/geom_vinum_plex.c
diff options
context:
space:
mode:
authorle <le@FreeBSD.org>2004-07-30 23:40:38 +0000
committerle <le@FreeBSD.org>2004-07-30 23:40:38 +0000
commitd9c517d66a7bc0c839f9e188253feb63d4ed9147 (patch)
tree8d3c36014654b5634ea8f262bb760ab54bdde705 /sys/geom/vinum/geom_vinum_plex.c
parent70045d465a6d6418988fa68e0e78109b031ffb40 (diff)
downloadFreeBSD-src-d9c517d66a7bc0c839f9e188253feb63d4ed9147.zip
FreeBSD-src-d9c517d66a7bc0c839f9e188253feb63d4ed9147.tar.gz
Set the access counts of a subdisk correctly when attaching it
to a plex that already has subdisks.
Diffstat (limited to 'sys/geom/vinum/geom_vinum_plex.c')
-rw-r--r--sys/geom/vinum/geom_vinum_plex.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/sys/geom/vinum/geom_vinum_plex.c b/sys/geom/vinum/geom_vinum_plex.c
index c993917..bcb1327 100644
--- a/sys/geom/vinum/geom_vinum_plex.c
+++ b/sys/geom/vinum/geom_vinum_plex.c
@@ -342,11 +342,12 @@ static struct g_geom *
gv_plex_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
{
struct g_geom *gp;
- struct g_consumer *cp;
+ struct g_consumer *cp, *cp2;
struct g_provider *pp2;
struct gv_plex *p;
struct gv_sd *s;
struct gv_softc *sc;
+ int error;
g_trace(G_T_TOPOLOGY, "gv_plex_taste(%s, %s)", mp->name, pp->name);
g_topology_assert();
@@ -382,9 +383,27 @@ gv_plex_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
/* Yes, there is already a geom, so we just add the consumer. */
if (gp != NULL) {
+ cp2 = LIST_FIRST(&gp->consumer);
/* Need to attach a new consumer to this subdisk. */
cp = g_new_consumer(gp);
- g_attach(cp, pp);
+ error = g_attach(cp, pp);
+ if (error) {
+ printf("geom_vinum: couldn't attach consumer to %s\n",
+ pp->name);
+ g_destroy_consumer(cp);
+ return (NULL);
+ }
+ /* Adjust the access counts of the new consumer. */
+ if ((cp2 != NULL) && (cp2->acr || cp2->acw || cp2->ace)) {
+ error = g_access(cp, cp2->acr, cp2->acw, cp2->ace);
+ if (error) {
+ printf("geom_vinum: couldn't set access counts"
+ " for consumer on %s\n", pp->name);
+ g_detach(cp);
+ g_destroy_consumer(cp);
+ return (NULL);
+ }
+ }
s->consumer = cp;
/* Adjust the size of the providers this plex has. */
OpenPOWER on IntegriCloud