From owner-p4-projects@FreeBSD.ORG Mon Jul 23 12:49:55 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8F90E16A537; Mon, 23 Jul 2007 12:49:55 +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 2BC7816A534 for ; Mon, 23 Jul 2007 12:49:55 +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 1A06E13C4B4 for ; Mon, 23 Jul 2007 12:49:55 +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 l6NCnsb0059884 for ; Mon, 23 Jul 2007 12:49:54 GMT (envelope-from lulf@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l6NCnsce059881 for perforce@freebsd.org; Mon, 23 Jul 2007 12:49:54 GMT (envelope-from lulf@FreeBSD.org) Date: Mon, 23 Jul 2007 12:49:54 GMT Message-Id: <200707231249.l6NCnsce059881@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 123953 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: Mon, 23 Jul 2007 12:49:56 -0000 http://perforce.freebsd.org/chv.cgi?CH=123953 Change 123953 by lulf@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--;