aboutsummaryrefslogtreecommitdiff
path: root/sys/nfsclient
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2009-02-24 16:01:56 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2009-02-24 16:01:56 +0000
commitfdd1a964d106117c002f0a683d4f9422d5e637e3 (patch)
tree08a784bb2e184604deb0c145278b2745421ce5bb /sys/nfsclient
parent92a0357875d6c895fdfa1406b8425a99011d9f74 (diff)
downloadsrc-fdd1a964d106117c002f0a683d4f9422d5e637e3.tar.gz
src-fdd1a964d106117c002f0a683d4f9422d5e637e3.zip
Bring back the code to prime the ACCESS cache when fetching attributes for
an NFS file. Now the priming is conditional on a new vfs.nfs.prime_access_cache sysctl. For now I've left the default setting to disabling the priming. Requested by: scottl
Notes
Notes: svn path=/head/; revision=188994
Diffstat (limited to 'sys/nfsclient')
-rw-r--r--sys/nfsclient/nfs_vnops.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c
index dbdf5cbe929d..0bd103ccb839 100644
--- a/sys/nfsclient/nfs_vnops.c
+++ b/sys/nfsclient/nfs_vnops.c
@@ -208,6 +208,11 @@ static int nfsaccess_cache_timeout = NFS_MAXATTRTIMO;
SYSCTL_INT(_vfs_nfs, OID_AUTO, access_cache_timeout, CTLFLAG_RW,
&nfsaccess_cache_timeout, 0, "NFS ACCESS cache timeout");
+static int nfs_prime_access_cache = 0;
+SYSCTL_INT(_vfs_nfs, OID_AUTO, prime_access_cache, CTLFLAG_RW,
+ &nfs_prime_access_cache, 0,
+ "Prime NFS ACCESS cache when fetching attributes");
+
static int nfsv3_commit_on_close = 0;
SYSCTL_INT(_vfs_nfs, OID_AUTO, nfsv3_commit_on_close, CTLFLAG_RW,
&nfsv3_commit_on_close, 0, "write+commit on close, else only write");
@@ -644,6 +649,12 @@ nfs_getattr(struct vop_getattr_args *ap)
*/
if (nfs_getattrcache(vp, &vattr) == 0)
goto nfsmout;
+ if (v3 && nfs_prime_access_cache && nfsaccess_cache_timeout > 0) {
+ nfsstats.accesscache_misses++;
+ nfs3_access_otw(vp, NFSV3ACCESS_ALL, td, ap->a_cred);
+ if (nfs_getattrcache(vp, &vattr) == 0)
+ goto nfsmout;
+ }
nfsstats.rpccnt[NFSPROC_GETATTR]++;
mreq = nfsm_reqhead(vp, NFSPROC_GETATTR, NFSX_FH(v3));
mb = mreq;