From owner-p4-projects@FreeBSD.ORG Fri Jul 27 22:15:03 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C3D4F16A421; Fri, 27 Jul 2007 22:15:02 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E5A016A41A for ; Fri, 27 Jul 2007 22:15:02 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 7242813C45D for ; Fri, 27 Jul 2007 22:15:02 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l6RMF2wx080957 for ; Fri, 27 Jul 2007 22:15:02 GMT (envelope-from lulf@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l6RMF1lu080950 for perforce@freebsd.org; Fri, 27 Jul 2007 22:15:01 GMT (envelope-from lulf@FreeBSD.org) Date: Fri, 27 Jul 2007 22:15:01 GMT Message-Id: <200707272215.l6RMF1lu080950@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to lulf@FreeBSD.org using -f From: Ulf Lilleengen To: Perforce Change Reviews Cc: Subject: PERFORCE change 124222 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jul 2007 22:15:03 -0000 http://perforce.freebsd.org/chv.cgi?CH=124222 Change 124222 by lulf@lulf_carrot on 2007/07/27 22:14:03 - Implement support for growing striped plexes! This is done the exact same way as RAID-5 plexes, so I was able to reuse a great deal of the code. There are some uglyness to the code though that I will clean up. (Like certain if-sentence), but i need to restructure larger portions of the code, and will do it then. Affected files ... .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum.h#23 edit .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_init.c#17 edit .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_plex.c#20 edit .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_volume.c#13 edit Differences ... ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum.h#23 (text+ko) ==== @@ -133,6 +133,7 @@ void gv_init_request(struct gv_sd *, off_t, caddr_t, off_t); void gv_parity_request(struct gv_plex *, int, off_t); int gv_grow_request(struct gv_plex *, off_t, off_t, int, caddr_t); +void gv_grow_complete(struct gv_plex *, struct bio *); void gv_parityop(struct gv_softc *, struct gctl_req *); #endif /* !_GEOM_VINUM_H_ */ ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_init.c#17 (text+ko) ==== @@ -103,7 +103,7 @@ { struct gv_volume *v; struct gv_sd *s; - int error, rebuild; + int error, grow, rebuild; KASSERT(p != NULL, ("gv_start_plex: NULL p")); @@ -114,7 +114,17 @@ v = p->vol_sc; if ((v != NULL) && (v->plexcount > 1)) error = gv_sync(v); - else if (p->org == GV_PLEX_RAID5) { + else if (p->org == GV_PLEX_STRIPED) { + grow = 0; + LIST_FOREACH(s, &p->subdisks, in_plex) { + if (s->flags & GV_SD_GROW) { + grow = 1; + break; + } + } + if (grow) + error = gv_grow_plex(p); + } else if (p->org == GV_PLEX_RAID5) { if (p->state == GV_PLEX_DEGRADED) { rebuild = 0; LIST_FOREACH(s, &p->subdisks, in_plex) { ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_plex.c#20 (text+ko) ==== @@ -47,7 +47,6 @@ struct gv_raid5_packet *); static void gv_parity_complete(struct gv_plex *, struct bio *); static void gv_rebuild_complete(struct gv_plex *, struct bio *); -static void gv_grow_complete(struct gv_plex *, struct bio *); static void gv_init_complete(struct gv_plex *, struct bio *); static struct bio * gv_plexbuffer(struct gv_plex *, struct bio *, caddr_t, off_t, off_t, int *); @@ -95,7 +94,7 @@ cbp = gv_plexbuffer(p, bp, addr, boff, bcount, &err); /* Building the sub-request failed. */ - if (cbp == NULL) { + if (cbp == NULL && err != 0) { printf("VINUM: plex request failed for "); g_print_bio(bp); printf("\n"); @@ -146,7 +145,7 @@ { struct gv_sd *s; struct bio *cbp; - int i, sdno; + int i, sdcount, sdno; off_t len_left, real_len, real_off; off_t stripeend, stripeno, stripestart; @@ -185,9 +184,21 @@ case GV_PLEX_STRIPED: /* The number of the stripe where the request starts. */ stripeno = boff / p->stripesize; - + sdcount = p->sdcount; + if (boff >= p->synced) { + LIST_FOREACH(s, &p->subdisks, in_plex) { + if (s->flags & GV_SD_GROW) + sdcount--; + } + /*XXX: Fix. */ + } else if (boff + bcount <= p->synced); + else { + bioq_disksort(p->rqueue, bp); + *err = 0; + return (NULL); /* XXX: Not failed... */ + } /* The number of the subdisk where the stripe resides. */ - sdno = stripeno % p->sdcount; + sdno = stripeno % sdcount; /* Find the right subdisk. */ i = 0; @@ -202,7 +213,7 @@ return (NULL); /* The offset of the stripe from the start of the subdisk. */ - stripestart = (stripeno / p->sdcount) * + stripestart = (stripeno / sdcount) * p->stripesize; /* The offset at the end of the stripe. */ ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_volume.c#13 (text+ko) ==== @@ -146,9 +146,10 @@ pbp->bio_completed = pbp->bio_length; if (pbp->bio_cflags & GV_BIO_SYNCREQ) gv_sync_complete(p, pbp); - else { + else if (pbp->bio_pflags & GV_BIO_SYNCREQ) + gv_grow_complete(p, pbp); + else g_io_deliver(pbp, pbp->bio_error); - } } break; case GV_PLEX_RAID5: