summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-02-24 16:01:56 +0000
committerjhb <jhb@FreeBSD.org>2009-02-24 16:01:56 +0000
commitccc9172c8dbae73ad3dccf553a96923fb5a3fbbe (patch)
tree08a784bb2e184604deb0c145278b2745421ce5bb /sys
parentf621884a68cff97d444d3c7c707e05bad76171f5 (diff)
downloadFreeBSD-src-ccc9172c8dbae73ad3dccf553a96923fb5a3fbbe.zip
FreeBSD-src-ccc9172c8dbae73ad3dccf553a96923fb5a3fbbe.tar.gz
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
Diffstat (limited to 'sys')
-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 dbdf5cb..0bd103c 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;
OpenPOWER on IntegriCloud