svn commit: r328126 - head/sys/kern

Andriy Gapon avg at FreeBSD.org
Thu Jan 18 12:59:05 UTC 2018


Author: avg
Date: Thu Jan 18 12:59:04 2018
New Revision: 328126
URL: https://svnweb.freebsd.org/changeset/base/328126

Log:
  correct read-ahead calculations in vfs_bio_getpages
  
  Previously the calculations were done as if the requested region
  ended at the start of the last requested page, not its end.
  The problem as actually quite minor as it affected only stats and
  page prefaulting, not the actual page data, and only with specific
  parameters.
  
  Reviewed by:	kib (previous version)
  MFC after:	2 weeks

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c	Thu Jan 18 12:14:24 2018	(r328125)
+++ head/sys/kern/vfs_bio.c	Thu Jan 18 12:59:04 2018	(r328126)
@@ -4802,7 +4802,14 @@ vfs_bio_getpages(struct vnode *vp, vm_page_t *ma, int 
 	la = IDX_TO_OFF(ma[count - 1]->pindex);
 	if (la >= object->un_pager.vnp.vnp_size)
 		return (VM_PAGER_BAD);
-	lpart = la + PAGE_SIZE > object->un_pager.vnp.vnp_size;
+
+	/*
+	 * Change the meaning of la from where the last requested page starts
+	 * to where it ends, because that's the end of the requested region
+	 * and the start of the potential read-ahead region.
+	 */
+	la += PAGE_SIZE;
+	lpart = la > object->un_pager.vnp.vnp_size;
 	bo_bs = get_blksize(vp, get_lblkno(vp, IDX_TO_OFF(ma[0]->pindex)));
 
 	/*


More information about the svn-src-all mailing list