PERFORCE change 124222 for review
Ulf Lilleengen
lulf at FreeBSD.org
Fri Jul 27 22:15:03 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=124222
Change 124222 by lulf at 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:
More information about the p4-projects
mailing list