Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Feb 2009 16:01:56 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r188994 - head/sys/nfsclient
Message-ID:  <200902241601.n1OG1uN1069514@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902241601.n1OG1uN1069514>