summaryrefslogtreecommitdiff
path: root/sys/nfs/nfs_subs.c
diff options
context:
space:
mode:
authordm <dm@cvs.openbsd.org>1996-12-17 03:46:40 +0000
committerdm <dm@cvs.openbsd.org>1996-12-17 03:46:40 +0000
commit7e77de81db5ad5ee0d7455dfa9a016a680c5387b (patch)
tree8ce852bde705fcb343dc1752810bb2a41db23c9a /sys/nfs/nfs_subs.c
parent5ab777dc75b17b54c14b6c1bdda9e4b3e9201bf9 (diff)
NFS attribute cache timeout mount param
Diffstat (limited to 'sys/nfs/nfs_subs.c')
-rw-r--r--sys/nfs/nfs_subs.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c
index 231f8e509ba..27e475c0ebc 100644
--- a/sys/nfs/nfs_subs.c
+++ b/sys/nfs/nfs_subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_subs.c,v 1.13 1996/10/15 11:34:15 deraadt Exp $ */
+/* $OpenBSD: nfs_subs.c,v 1.14 1996/12/17 03:46:38 dm Exp $ */
/* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */
/*
@@ -1321,6 +1321,31 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
return (0);
}
+inline int
+nfs_attrtimeo (struct nfsnode *np)
+{
+ struct vnode *vp = np->n_vnode;
+ struct nfsmount *nmp = VFSTONFS(vp->v_mount);
+ int tenthage = (time.tv_sec - np->n_mtime) / 10;
+ int minto, maxto;
+
+ if (vp->v_type == VDIR) {
+ maxto = nmp->nm_acdirmax;
+ minto = nmp->nm_acdirmin;
+ }
+ else {
+ maxto = nmp->nm_acregmax;
+ minto = nmp->nm_acregmin;
+ }
+
+ if (np->n_flag & NMODIFIED || tenthage < minto)
+ return minto;
+ else if (tenthage < maxto)
+ return tenthage;
+ else
+ return maxto;
+}
+
/*
* Check the time stamp
* If the cache is valid, copy contents to *vap and return 0
@@ -1334,7 +1359,7 @@ nfs_getattrcache(vp, vaper)
register struct nfsnode *np = VTONFS(vp);
register struct vattr *vap;
- if ((time.tv_sec - np->n_attrstamp) >= NFS_ATTRTIMEO(np)) {
+ if ((time.tv_sec - np->n_attrstamp) >= nfs_attrtimeo(np)) {
nfsstats.attrcache_misses++;
return (ENOENT);
}