Date: Wed, 27 Jun 2007 16:25:10 GMT From: Ulf Lilleengen <lulf@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 122412 for review Message-ID: <200706271625.l5RGPAYI059556@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706271625.l5RGPAYI059556>