PERFORCE change 123953 for review

Ulf Lilleengen lulf at FreeBSD.org
Mon Jul 23 12:49:56 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=123953

Change 123953 by lulf at lulf_carrot on 2007/07/23 12:49:01

	- Improve RAID-5 growing a bit, by using p->synced to see how far we're
	  in the growing. This means we can run normal requests while growing!
	  (except those that span across the old and new plex, which must be
	  delayed).

Affected files ...

.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_init.c#15 edit
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_plex.c#18 edit
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_raid5.c#11 edit

Differences ...

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_init.c#15 (text+ko) ====

@@ -282,6 +282,7 @@
 	origsize = (sdcount - 1) * s->size;
 	origlength = (sdcount - 1) * p->stripesize;
 	printf("Starting growing at 0 reading %jd bytes\n", origlength);
+	p->synced = 0;
 	gv_grow_request(p, 0, MIN(origlength, origsize), BIO_READ, NULL);
 
 	return (0);

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_plex.c#18 (text+ko) ====

@@ -554,6 +554,7 @@
 	/* If it was a read, write it. */
 	if (bp->bio_cmd == BIO_READ) {
 		printf("Finished read, do a write\n");
+		p->synced += bp->bio_length;
 		err = gv_grow_request(p, bp->bio_offset, bp->bio_length,
 		    BIO_WRITE, bp->bio_data);
 	/* If it was a write, read next. */
@@ -586,6 +587,9 @@
 			g_topology_lock();
 			gv_access(v->provider, -1, -1, 0);
 			g_topology_unlock();
+			p->synced = 0;
+			/* Issue delayed requests. */
+			gv_plex_flush(p);
 		} else {
 			offset = bp->bio_offset + bp->bio_length;
 			printf("Issuing next bio read at 0x%jx\n", offset);

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_raid5.c#11 (text+ko) ====

@@ -341,15 +341,24 @@
 	type = REQ_TYPE_NORMAL;
 	original = parity = broken = NULL;
 
-	/* Reads must take into account the growing plexes. */
-	if (bp->bio_cmd == BIO_READ)
-		gv_raid5_offset(p, boff, bcount, &real_off, &real_len, &sdno,
-		    &psdno, 1);
-	else
-		gv_raid5_offset(p, boff, bcount, &real_off, &real_len, &sdno,
-		    &psdno, 0);
+	/* XXX: The resize won't crash with rebuild or sync, but we should still
+	 * be aware of it. Also this should perhaps be done on rebuild/check as
+	 * well?
+	 */
+	/* If we're over, we must use the old. */ 
+	if (boff >= p->synced) {
+		gv_raid5_offset(p, boff, bcount, &real_off, &real_len,
+		    &sdno, &psdno, 1);
+	/* Or if over the resized offset, we use all drives. */
+	} else if (boff + bcount <= p->synced) {
+		gv_raid5_offset(p, boff, bcount, &real_off, &real_len,
+		    &sdno, &psdno, 0);
+	/* Else, we're in the middle, and must wait a bit. */
+	} else {
+		bioq_disksort(p->rqueue, bp);
+		return (0);
+	}
 
-	printf("Got sdno %d and psdno %d\n", sdno, psdno);
 	/* Find the right subdisks. */
 	i = 0;
 	LIST_FOREACH(s, &p->subdisks, in_plex) {
@@ -548,9 +557,8 @@
 	int sd, psd, sdcount;
 	off_t len_left, stripeend, stripeoff, stripestart;
 
-	printf("In read we take into account new subdisks.\n");
 	sdcount = p->sdcount;
-	if (growing) {
+		if (growing) {
 		LIST_FOREACH(s, &p->subdisks, in_plex) {
 			if (s->flags & GV_SD_GROW)
 				sdcount--;


More information about the p4-projects mailing list