Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Oct 2013 10:26:40 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r256371 - projects/camlock/sys/geom
Message-ID:  <201310121026.r9CAQehP029727@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sat Oct 12 10:26:40 2013
New Revision: 256371
URL: http://svnweb.freebsd.org/changeset/base/256371

Log:
  Fix passing uninitialized bio_resid argument to g_trace().
  
  Curious that I've found it during profiling by unexpected cache miss. :)

Modified:
  projects/camlock/sys/geom/geom_dev.c

Modified: projects/camlock/sys/geom/geom_dev.c
==============================================================================
--- projects/camlock/sys/geom/geom_dev.c	Sat Oct 12 09:56:09 2013	(r256370)
+++ projects/camlock/sys/geom/geom_dev.c	Sat Oct 12 10:26:40 2013	(r256371)
@@ -486,16 +486,16 @@ g_dev_done(struct bio *bp2)
 	sc = cp->private;
 	bp = bp2->bio_parent;
 	bp->bio_error = bp2->bio_error;
-	if (bp->bio_error != 0) {
+	bp->bio_completed = bp2->bio_completed;
+	bp->bio_resid = bp2->bio_resid;
+	if (bp2->bio_error != 0) {
 		g_trace(G_T_BIO, "g_dev_done(%p) had error %d",
-		    bp2, bp->bio_error);
+		    bp2, bp2->bio_error);
 		bp->bio_flags |= BIO_ERROR;
 	} else {
 		g_trace(G_T_BIO, "g_dev_done(%p/%p) resid %ld completed %jd",
-		    bp2, bp, bp->bio_resid, (intmax_t)bp2->bio_completed);
+		    bp2, bp, bp2->bio_resid, (intmax_t)bp2->bio_completed);
 	}
-	bp->bio_resid = bp->bio_length - bp2->bio_completed;
-	bp->bio_completed = bp2->bio_completed;
 	g_destroy_bio(bp2);
 	destroy = 0;
 	mtx_lock(&sc->sc_mtx);



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