summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-02-19 22:28:48 +0000
committerjhb <jhb@FreeBSD.org>2009-02-19 22:28:48 +0000
commit5dc7ef7e69e7552a62f396a484740c12642918df (patch)
tree789787a3459d38eece091c20561b1d47a4875bec /sys/kern
parent508874f4299bd6840631dde45b0eb6bc8b29a3d9 (diff)
downloadFreeBSD-src-5dc7ef7e69e7552a62f396a484740c12642918df.zip
FreeBSD-src-5dc7ef7e69e7552a62f396a484740c12642918df.tar.gz
Enable caching of negative pathname lookups in the NFS client. To avoid
stale entries, we save a copy of the directory's modification time when the first negative cache entry was added in the directory's NFS node. When a negative cache entry is hit during a pathname lookup, the parent directory's modification time is checked. If it has changed, all of the negative cache entries for that parent are purged and the lookup falls back to using the RPC. This required adding a new cache_purge_negative() method to the name cache to purge only negative cache entries for a given directory. Submitted by: mohans, Rick Macklem, Ricardo Labiaga @ NetApp Reviewed by: mohans
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_cache.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index 9654433..3c32808 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -663,6 +663,24 @@ cache_purge(vp)
}
/*
+ * Invalidate all negative entries for a particular directory vnode.
+ */
+void
+cache_purge_negative(vp)
+ struct vnode *vp;
+{
+ struct namecache *cp, *ncp;
+
+ CTR1(KTR_VFS, "cache_purge_negative(%p)", vp);
+ CACHE_WLOCK();
+ LIST_FOREACH_SAFE(cp, &vp->v_cache_src, nc_src, ncp) {
+ if (cp->nc_vp == NULL)
+ cache_zap(cp);
+ }
+ CACHE_WUNLOCK();
+}
+
+/*
* Flush all entries referencing a particular filesystem.
*/
void
OpenPOWER on IntegriCloud