Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jun 2007 14:26:38 GMT
From:      Ulf Lilleengen <lulf@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 121631 for review
Message-ID:  <200706141426.l5EEQc6W051989@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=121631

Change 121631 by lulf@lulf_carrot on 2007/06/14 14:26:33

	- Submit a temporarily hack to fix a problem where two or more plexes
	  uses the same BIO.

Affected files ...

.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_plex.c#12 edit
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_volume.c#3 edit

Differences ...

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


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

@@ -112,6 +112,7 @@
 	struct gv_volume *v;
 	struct gv_plex *p;
 	struct gv_sd *s;
+	int numplex;
 
 	s = bp->bio_caller1;
 	KASSERT(s != NULL, ("gv_bio_done: NULL s"));
@@ -132,8 +133,36 @@
 		if (pbp->bio_children == pbp->bio_inbed) {
 			if (pbp->bio_cflags & GV_BIO_SYNCREQ)
 				gv_sync_completed(p, pbp);
-			else
+			else {
+				/* 
+				 * If completed is a multiple of a number less
+				 * than or equal to the plexcount, we can be
+				 * sure that a write got through, and adjust
+				 * bio_completed accordingly. 
+				 *
+				 * A) We can be sure all plexes will have
+				 * written the BIO, becaouse bio_children ==
+				 * bio_inbed which is "global" for all plexes
+				 * since the same BIO was sent to all.
+				 * B) If a plex fails to write totally, we get
+				 * a wrong length/completed number which is
+				 * lower than it should, and the error shouldn't
+				 * really occur.
+				 *
+				 * XXX: This is sort of a hack, but I can't find
+				 * any better way without cloning the initial
+				 * BIO being sent down to all plexes in a mirror
+				 *
+				 * Actually, cloning the BIO would be
+				 * preferable.
+				 */
+				numplex = pbp->bio_completed / pbp->bio_length;
+				if (numplex <= v->plexcount &&
+				    (pbp->bio_completed % pbp->bio_length) == 0)
+					pbp->bio_completed = 
+					    pbp->bio_completed / numplex;
 				g_io_deliver(pbp, pbp->bio_error);
+			}
 		}
 		break;
 	case GV_PLEX_RAID5:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706141426.l5EEQc6W051989>