svn commit: r308442 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Tue Nov 8 10:10:56 UTC 2016


Author: kib
Date: Tue Nov  8 10:10:55 2016
New Revision: 308442
URL: https://svnweb.freebsd.org/changeset/base/308442

Log:
  Tweaks for the buffer pager.
  
  Pass current thread credentials instead of NOCRED.
  Only allow unmapped buffers for filesystem which proclaimed the support.
  
  For all filesystems which currently use buffer pager (UFS, msdosfs and
  cd9660), the changes are effectively nop.
  
  Tested by:	pho
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c	Tue Nov  8 10:06:43 2016	(r308441)
+++ head/sys/kern/vfs_bio.c	Tue Nov  8 10:10:55 2016	(r308442)
@@ -4686,13 +4686,15 @@ vfs_bio_getpages(struct vnode *vp, vm_pa
 	vm_page_t m;
 	vm_object_t object;
 	struct buf *bp;
+	struct mount *mp;
 	daddr_t lbn, lbnp;
 	vm_ooffset_t la, lb, poff, poffe;
 	long bsize;
-	int bo_bs, error, i;
+	int bo_bs, br_flags, error, i;
 	bool redo, lpart;
 
 	object = vp->v_object;
+	mp = vp->v_mount;
 	la = IDX_TO_OFF(ma[count - 1]->pindex);
 	if (la >= object->un_pager.vnp.vnp_size)
 		return (VM_PAGER_BAD);
@@ -4709,6 +4711,8 @@ vfs_bio_getpages(struct vnode *vp, vm_pa
 			    vnp.vnp_size, PAGE_SIZE) - la);
 		}
 	}
+	br_flags = (mp != NULL && (mp->mnt_kern_flag & MNTK_UNMAPPED_BUFS)
+	    != 0) ? GB_UNMAPPED : 0;
 	VM_OBJECT_WLOCK(object);
 again:
 	for (i = 0; i < count; i++)
@@ -4741,8 +4745,8 @@ again:
 			lbnp = lbn;
 
 			bsize = get_blksize(vp, lbn);
-			error = bread_gb(vp, lbn, bsize, NOCRED, GB_UNMAPPED,
-			    &bp);
+			error = bread_gb(vp, lbn, bsize, curthread->td_ucred,
+			    br_flags, &bp);
 			if (error != 0)
 				goto end_pages;
 			if (LIST_EMPTY(&bp->b_dep)) {


More information about the svn-src-head mailing list