Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Jul 2007 21:40:48 GMT
From:      Ulf Lilleengen <lulf@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 122745 for review
Message-ID:  <200707022140.l62Lem8X019183@repoman.freebsd.org>

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

Change 122745 by lulf@lulf_carrot on 2007/07/02 21:40:03

	- Remove complicated bio_completed divding technique, and just set
	  bio_completed = bio_length as g_mirror does.
	- Remember that syncing at the end of plex might not be a true multiple
	  of the syncsize, so use the minimal of default size and the size we
	  have left to sync.

Affected files ...

.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_volume.c#11 edit

Differences ...

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

@@ -124,7 +124,6 @@
 	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"));
@@ -139,40 +138,15 @@
 		pbp = bp->bio_parent;
 		if (pbp->bio_error == 0)
 			pbp->bio_error = bp->bio_error;
-		pbp->bio_completed += bp->bio_completed;
 		g_destroy_bio(bp);
 		pbp->bio_inbed++;
 		if (pbp->bio_children == pbp->bio_inbed) {
+			/* Just set it to length since multiple plexes will
+			 * screw things up. */
+			pbp->bio_completed = pbp->bio_length;
 			if (pbp->bio_cflags & GV_BIO_SYNCREQ)
 				gv_sync_complete(p, pbp);
 			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);
 			}
 		}
@@ -193,6 +167,7 @@
 	struct gv_sd *s;
 	struct gv_volume *v;
 	struct gv_softc *sc;
+	off_t offset;
 	int err;
 
 	g_topology_assert_not();
@@ -219,8 +194,10 @@
 			LIST_FOREACH(s, &to->subdisks, in_plex)
 				gv_update_sd_state(s);
 		} else {
-			err = gv_sync_request(from, to, bp->bio_offset +
-			    bp->bio_length, bp->bio_length, BIO_READ, NULL);
+			offset = bp->bio_offset + bp->bio_length;
+			err = gv_sync_request(from, to, offset,
+			    MIN(bp->bio_length, from->size - offset),
+			    BIO_READ, NULL);
 		}
 	}
 	g_destroy_bio(bp);



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