enable O->A loaning read for a few filesystems. yamt-pagecache
authoryamt <yamt@NetBSD.org>
Wed, 04 Jan 2012 16:43:37 +0000
branchyamt-pagecache
changeset 280342 a1a28321e5ef
parent 280341 74022273ec6d
child 280343 35434e977e1f
enable O->A loaning read for a few filesystems.
sys/fs/tmpfs/tmpfs_vnops.c
sys/nfs/nfs_bio.c
sys/ufs/ufs/ufs_readwrite.c
--- a/sys/fs/tmpfs/tmpfs_vnops.c	Wed Jan 04 16:31:17 2012 +0000
+++ b/sys/fs/tmpfs/tmpfs_vnops.c	Wed Jan 04 16:43:37 2012 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_vnops.c,v 1.92 2011/09/27 01:32:21 christos Exp $	*/
+/*	$NetBSD: tmpfs_vnops.c,v 1.92.2.1 2012/01/04 16:43:37 yamt Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.92 2011/09/27 01:32:21 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.92.2.1 2012/01/04 16:43:37 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/dirent.h>
@@ -561,6 +561,9 @@
 	uobj = node->tn_spec.tn_reg.tn_aobj;
 	error = 0;
 
+	if (uio->uio_offset + uio->uio_resid <= node->tn_size) {
+		uvm_loanobj(&vp->v_uobj, uio);
+	}
 	while (error == 0 && uio->uio_resid > 0) {
 		vsize_t len;
 
--- a/sys/nfs/nfs_bio.c	Wed Jan 04 16:31:17 2012 +0000
+++ b/sys/nfs/nfs_bio.c	Wed Jan 04 16:43:37 2012 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_bio.c,v 1.188.2.1 2011/11/02 21:53:59 yamt Exp $	*/
+/*	$NetBSD: nfs_bio.c,v 1.188.2.2 2012/01/04 16:43:37 yamt Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.188.2.1 2011/11/02 21:53:59 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.188.2.2 2012/01/04 16:43:37 yamt Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_nfs.h"
@@ -147,7 +147,9 @@
 		nfsstats.biocache_reads++;
 
 		advice = IO_ADV_DECODE(ioflag);
-		error = 0;
+		if (uio->uio_offset + uio->uio_resid <= np->n_size) {
+			uvm_loanobj(&vp->v_uobj, uio);
+		}
 		while (uio->uio_resid > 0) {
 			vsize_t bytelen;
 
--- a/sys/ufs/ufs/ufs_readwrite.c	Wed Jan 04 16:31:17 2012 +0000
+++ b/sys/ufs/ufs/ufs_readwrite.c	Wed Jan 04 16:43:37 2012 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_readwrite.c,v 1.99 2011/07/11 08:27:41 hannken Exp $	*/
+/*	$NetBSD: ufs_readwrite.c,v 1.99.2.1 2012/01/04 16:43:37 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.99 2011/07/11 08:27:41 hannken Exp $");
+__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.99.2.1 2012/01/04 16:43:37 yamt Exp $");
 
 #ifdef LFS_READWRITE
 #define	FS			struct lfs
@@ -123,6 +123,9 @@
 	if (usepc) {
 		const int advice = IO_ADV_DECODE(ap->a_ioflag);
 
+		if (uio->uio_offset + uio->uio_resid <= vp->v_size) {
+			uvm_loanobj(&vp->v_uobj, uio);
+		}
 		while (uio->uio_resid > 0) {
 			if (ioflag & IO_DIRECT) {
 				genfs_directio(vp, uio, ioflag);