svn commit: r188832 - head/sys/nfsclient

John Baldwin jhb at freebsd.org
Mon Feb 23 07:34:29 PST 2009


On Thursday 19 February 2009 7:25:04 pm Scott Long wrote:
> John Baldwin wrote:
> > Author: jhb
> > Date: Thu Feb 19 22:18:00 2009
> > New Revision: 188832
> > URL: http://svn.freebsd.org/changeset/base/188832
> > 
> > Log:
> >   When fetching attributes for a file for NFSv3 mounts, do not perform an
> >   opportunistic ACCESS RPC to populate both the access and attribute 
caches
> >   of the file and instead always use a GETATTR RPC.  On many modern NFS
> >   servers, an ACCESS RPC is much more expensive to service than a GETATTR
> >   RPC.
> >   
> 
> Not too long ago, this was a very useful and important optimization. 
> Can you say which servers this applies to?  Could it have been made an
> option instead of outright deleted?

I know this applies to at least some Net-Apps.  I could certainly restore the 
access priming under a sysctl however.  Something like this:

--- //depot/projects/smpng/sys/nfsclient/nfs_vnops.c	2009/02/20 15:11:39
+++ //depot/user/jhb/lock/nfsclient/nfs_vnops.c	2009/02/23 15:09:16
@@ -208,6 +208,11 @@
 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 @@
 	 */
 	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;


-- 
John Baldwin


More information about the svn-src-head mailing list