From owner-p4-projects@FreeBSD.ORG Wed Jun 27 16:25:11 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2D38D16A468; Wed, 27 Jun 2007 16:25:11 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DC37D16A400 for ; Wed, 27 Jun 2007 16:25:10 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id CE61213C4B9 for ; Wed, 27 Jun 2007 16:25:10 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l5RGPA7I059559 for ; Wed, 27 Jun 2007 16:25:10 GMT (envelope-from lulf@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l5RGPAYI059556 for perforce@freebsd.org; Wed, 27 Jun 2007 16:25:10 GMT (envelope-from lulf@FreeBSD.org) Date: Wed, 27 Jun 2007 16:25:10 GMT Message-Id: <200706271625.l5RGPAYI059556@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 122412 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: Wed, 27 Jun 2007 16:25:11 -0000 http://perforce.freebsd.org/chv.cgi?CH=122412 Change 122412 by lulf@lulf_carrot on 2007/06/27 16:24:10 - Remove unused debug info. - Add support for mounted RAID5 rebuild. Requests are delayed if they interfere with the rebuild, and are executed right after rebuild is finished. If they don't interfere, just pass them through. - Add handling of REBUILD flag in setstate - Add padding so userland sets the correct size of gv_plex struct. Affected files ... .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_events.c#4 edit .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_plex.c#15 edit .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_raid5.c#8 edit .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_state.c#13 edit .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_var.h#16 edit Differences ... ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_events.c#4 (text+ko) ==== @@ -384,6 +384,8 @@ bioq_init(p->bqueue); p->wqueue = g_malloc(sizeof(struct bio_queue_head), M_WAITOK | M_ZERO); bioq_init(p->wqueue); + p->rqueue = g_malloc(sizeof(struct bio_queue_head), M_WAITOK | M_ZERO); + bioq_init(p->rqueue); } void ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_plex.c#15 (text+ko) ==== @@ -50,6 +50,7 @@ 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 *); +static void gv_plex_flush(struct gv_plex *); void gv_plex_start(struct gv_plex *p, struct bio *bp) @@ -65,9 +66,6 @@ addr = bp->bio_data; boff = bp->bio_offset; - if (!(bp->bio_cflags & GV_BIO_REBUILD)) - printf("New BIO!, not rebuild\n"); - /* Walk over the whole length of the request, we might split it up. */ while (bcount > 0) { wp = NULL; @@ -716,6 +714,9 @@ if (error) { printf("VINUM: rebuild of %s failed at offset %jd errno: %d\n", p->name, (intmax_t)offset, error); + p->flags &= ~GV_PLEX_REBUILDING; + p->synced = 0; + gv_plex_flush(p); /* Flush out remaining rebuild BIOs. */ return; } @@ -730,6 +731,7 @@ /* Try to up all subdisks. */ LIST_FOREACH(s, &p->subdisks, in_plex) gv_update_sd_state(s); + gv_plex_flush(p); /* Flush out remaining rebuild BIOs. */ return; } @@ -737,6 +739,20 @@ gv_parity_request(p, flags, offset); } +static void +gv_plex_flush(struct gv_plex *p) +{ + struct gv_softc *sc; + struct bio *bp; + + sc = p->vinumconf; + bp = bioq_takefirst(p->rqueue); + while (bp != NULL) { + gv_plex_start(p, bp); + bp = bioq_takefirst(p->rqueue); + } +} + void gv_parityop(struct gv_softc *sc, struct gctl_req *req) { ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_raid5.c#8 (text+ko) ==== @@ -379,6 +379,11 @@ if ((p->flags & GV_PLEX_REBUILDING) && (boff + real_len < p->synced)) type = REQ_TYPE_NORMAL; + if ((p->flags & GV_PLEX_REBUILDING) && (boff + real_len >= p->synced)) { + bioq_disksort(p->rqueue, bp); + return (0); + } + switch (bp->bio_cmd) { case BIO_READ: /* ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_state.c#13 (text+ko) ==== @@ -453,7 +453,8 @@ /* Some of our subdisks are initializing. */ } else if (sdstates & GV_SD_INITSTATE) { - if (p->flags & GV_PLEX_SYNCING) + if (p->flags & GV_PLEX_SYNCING || + p->flags & GV_PLEX_REBUILDING) p->state = GV_PLEX_DEGRADED; else p->state = GV_PLEX_DOWN; ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_var.h#16 (text+ko) ==== @@ -336,8 +336,9 @@ #ifdef _KERNEL struct bio_queue_head *bqueue; /* BIO queue. */ struct bio_queue_head *wqueue; /* Waiting BIO queue. */ + struct bio_queue_head *rqueue; /* Rebuild waiting BIO queue. */ #else - char *bpad, *wpad; /* Padding for userland. */ + char *bpad, *wpad, *rpad; /* Padding for userland. */ #endif struct gv_softc *vinumconf; /* Pointer to the vinum config. */