diff options
author | John Baldwin <jhb@FreeBSD.org> | 2009-02-19 22:28:48 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2009-02-19 22:28:48 +0000 |
commit | 03964c8e09da7a6bf48a37dae84394274f383e65 (patch) | |
tree | 789787a3459d38eece091c20561b1d47a4875bec /sys/kern/vfs_cache.c | |
parent | 5428c66130fa0769dd2dbf9accf2579a84d99475 (diff) | |
download | src-03964c8e09da7a6bf48a37dae84394274f383e65.tar.gz src-03964c8e09da7a6bf48a37dae84394274f383e65.zip |
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
Notes
Notes:
svn path=/head/; revision=188833
Diffstat (limited to 'sys/kern/vfs_cache.c')
-rw-r--r-- | sys/kern/vfs_cache.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 96544334164b..3c32808b4b70 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 |