svn commit: r188994 - head/sys/nfsclient
John Baldwin
jhb at FreeBSD.org
Tue Feb 24 08:01:57 PST 2009
Author: jhb
Date: Tue Feb 24 16:01:56 2009
New Revision: 188994
URL: http://svn.freebsd.org/changeset/base/188994
Log:
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
Modified:
head/sys/nfsclient/nfs_vnops.c
Modified: head/sys/nfsclient/nfs_vnops.c
==============================================================================
--- head/sys/nfsclient/nfs_vnops.c Tue Feb 24 15:43:42 2009 (r188993)
+++ head/sys/nfsclient/nfs_vnops.c Tue Feb 24 16:01:56 2009 (r188994)
@@ -208,6 +208,11 @@ static int nfsaccess_cache_timeout = NFS
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;
More information about the svn-src-all
mailing list