Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Jun 2013 09:29:30 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r251920 - stable/9/sys/geom
Message-ID:  <201306180929.r5I9TUkJ084415@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue Jun 18 09:29:30 2013
New Revision: 251920
URL: http://svnweb.freebsd.org/changeset/base/251920

Log:
  MFC r248596 (by kib):
  Correct the page count when excess length is trimmed from the bio.

Modified:
  stable/9/sys/geom/geom_io.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/geom_io.c
==============================================================================
--- stable/9/sys/geom/geom_io.c	Tue Jun 18 09:28:49 2013	(r251919)
+++ stable/9/sys/geom/geom_io.c	Tue Jun 18 09:29:30 2013	(r251920)
@@ -718,8 +718,17 @@ g_io_schedule_down(struct thread *tp __u
 			 */
 			excess = bp->bio_offset + bp->bio_length;
 			if (excess > bp->bio_to->mediasize) {
+				KASSERT((bp->bio_flags & BIO_UNMAPPED) == 0 ||
+				    round_page(bp->bio_ma_offset +
+				    bp->bio_length) / PAGE_SIZE == bp->bio_ma_n,
+				    ("excess bio %p too short", bp));
 				excess -= bp->bio_to->mediasize;
 				bp->bio_length -= excess;
+				if ((bp->bio_flags & BIO_UNMAPPED) != 0) {
+					bp->bio_ma_n = round_page(
+					    bp->bio_ma_offset +
+					    bp->bio_length) / PAGE_SIZE;
+				}
 				if (excess > 0)
 					CTR3(KTR_GEOM, "g_down truncated bio "
 					    "%p provider %s by %d", bp,



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