diff options
author | avg <avg@FreeBSD.org> | 2018-02-04 14:00:38 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2018-02-04 14:00:38 +0000 |
commit | 6ae261d01a5f3356b0d863f3784b48c8f81be7fd (patch) | |
tree | 83fbae5b828d5fc80f24f03566e4ae995486ba7d | |
parent | eeee39edcc0d51e76cbf53aa59fc23b16ebffa5b (diff) | |
download | FreeBSD-src-6ae261d01a5f3356b0d863f3784b48c8f81be7fd.zip FreeBSD-src-6ae261d01a5f3356b0d863f3784b48c8f81be7fd.tar.gz |
MFC r328126: correct read-ahead calculations in vfs_bio_getpages
-rw-r--r-- | sys/kern/vfs_bio.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 9371c36..d101644 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -4764,7 +4764,14 @@ vfs_bio_getpages(struct vnode *vp, vm_page_t *ma, int count, 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))); /* |