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,
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to