From owner-p4-projects@FreeBSD.ORG Mon Jul 2 21:40:49 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 3A9DD16A46D; Mon, 2 Jul 2007 21:40:49 +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 09CD116A46B for ; Mon, 2 Jul 2007 21:40:49 +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 EDBE313C46C for ; Mon, 2 Jul 2007 21:40:48 +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 l62LemBu019187 for ; Mon, 2 Jul 2007 21:40:48 GMT (envelope-from lulf@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l62Lem8X019183 for perforce@freebsd.org; Mon, 2 Jul 2007 21:40:48 GMT (envelope-from lulf@FreeBSD.org) Date: Mon, 2 Jul 2007 21:40:48 GMT Message-Id: <200707022140.l62Lem8X019183@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 122745 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, 02 Jul 2007 21:40:49 -0000 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);