summaryrefslogtreecommitdiffstats
path: root/sys/nfs/nfs_subs.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1998-05-19 07:11:27 +0000
committerpeter <peter@FreeBSD.org>1998-05-19 07:11:27 +0000
commit1777a04b110cd58eb32d0ad81d7cce33566c30ed (patch)
tree7d6f8932bbfd01ff67fabaef4fb555fd79ab7cc9 /sys/nfs/nfs_subs.c
parent56469e323e07fbfcd1eb45391d45c0a509b8bbe0 (diff)
downloadFreeBSD-src-1777a04b110cd58eb32d0ad81d7cce33566c30ed.zip
FreeBSD-src-1777a04b110cd58eb32d0ad81d7cce33566c30ed.tar.gz
Allow control of the attribute cache timeouts at mount time.
We had run out of bits in the nfs mount flags, I have moved the internal state flags into a seperate variable. These are no longer visible via statfs(), but I don't know of anything that looks at them.
Diffstat (limited to 'sys/nfs/nfs_subs.c')
-rw-r--r--sys/nfs/nfs_subs.c49
1 files changed, 45 insertions, 4 deletions
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c
index f9eabdd..b81eedf 100644
--- a/sys/nfs/nfs_subs.c
+++ b/sys/nfs/nfs_subs.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
- * $Id: nfs_subs.c,v 1.52 1998/03/30 09:54:12 phk Exp $
+ * $Id: nfs_subs.c,v 1.53 1998/04/06 11:41:07 phk Exp $
*/
/*
@@ -1363,6 +1363,12 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
return (0);
}
+#ifdef NFS_ACDEBUG
+#include <sys/sysctl.h>
+static int nfs_acdebug;
+SYSCTL_INT(_vfs_nfs, OID_AUTO, acdebug, CTLFLAG_RW, &nfs_acdebug, 0, "");
+#endif
+
/*
* Check the time stamp
* If the cache is valid, copy contents to *vap and return 0
@@ -1373,15 +1379,50 @@ nfs_getattrcache(vp, vaper)
register struct vnode *vp;
struct vattr *vaper;
{
- register struct nfsnode *np = VTONFS(vp);
+ register struct nfsnode *np;
register struct vattr *vap;
+ struct nfsmount *nmp;
+ int timeo;
- if ((time_second - np->n_attrstamp) >= NFS_ATTRTIMEO(np)) {
+ np = VTONFS(vp);
+ vap = &np->n_vattr;
+ nmp = VFSTONFS(vp->v_mount);
+ /* XXX n_mtime doesn't seem to be updated on a miss-and-reload */
+ timeo = (time_second - np->n_mtime) / 10;
+
+#ifdef NFS_ACDEBUG
+ if (nfs_acdebug>1)
+ printf("nfs_getattrcache: initial timeo = %d\n", timeo);
+#endif
+
+ if (vap->va_type == VDIR) {
+ if ((np->n_flag & NMODIFIED) || timeo < nmp->nm_acdirmin)
+ timeo = nmp->nm_acdirmin;
+ else if (timeo > nmp->nm_acdirmax)
+ timeo = nmp->nm_acdirmax;
+ } else {
+ if ((np->n_flag & NMODIFIED) || timeo < nmp->nm_acregmin)
+ timeo = nmp->nm_acregmin;
+ else if (timeo > nmp->nm_acregmax)
+ timeo = nmp->nm_acregmax;
+ }
+
+#ifdef NFS_ACDEBUG
+ if (nfs_acdebug > 2)
+ printf("acregmin %d; acregmax %d; acdirmin %d; acdirmax %d\n",
+ nmp->nm_acregmin, nmp->nm_acregmax,
+ nmp->nm_acdirmin, nmp->nm_acdirmax);
+
+ if (nfs_acdebug)
+ printf("nfs_getattrcache: age = %d; final timeo = %d\n",r
+ (time_second - np->n_attrstamp), timeo);
+#endif
+
+ if ((time_second - np->n_attrstamp) >= timeo) {
nfsstats.attrcache_misses++;
return (ENOENT);
}
nfsstats.attrcache_hits++;
- vap = &np->n_vattr;
if (vap->va_size != np->n_size) {
if (vap->va_type == VREG) {
if (np->n_flag & NMODIFIED) {
OpenPOWER on IntegriCloud