diff options
author | dillon <dillon@FreeBSD.org> | 2001-10-01 04:33:35 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 2001-10-01 04:33:35 +0000 |
commit | 5a5b9f79f48be499ceca11f3d54c0525935b9ac1 (patch) | |
tree | 24142bf3c28ad5430fe7af0d88da2999098b7f21 /sys/kern/vfs_cache.c | |
parent | 86409d0972b660f68712b2324920bd859a72cf72 (diff) | |
download | FreeBSD-src-5a5b9f79f48be499ceca11f3d54c0525935b9ac1.zip FreeBSD-src-5a5b9f79f48be499ceca11f3d54c0525935b9ac1.tar.gz |
After extensive testing it has been determined that adding complexity
to avoid removing higher level directory vnodes from the namecache has
no perceivable effect and will be removed. This is especially true
when vmiodirenable is turned on, which it is by default now. ( vmiodirenable
makes a huge difference in directory caching ). The vfs.vmiodirenable and
vfs.nameileafonly sysctls have been left in to allow further testing, but
I expect to rip out vfs.nameileafonly soon too.
I have also determined through testing that the real problem with numvnodes
getting too large is due to the VM Page cache preventing the vnode from
being reclaimed. The directory stuff made only a tiny dent relative
to Poul's original code, enough so that some tests succeeded. But tests
with several million small files show that the bigger problem is the VM Page
cache. This will have to be addressed by a future commit.
MFC after: 3 days
Diffstat (limited to 'sys/kern/vfs_cache.c')
-rw-r--r-- | sys/kern/vfs_cache.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 9483b9b..8301821 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -101,8 +101,10 @@ static u_long numcache; /* number of cache entries allocated */ SYSCTL_ULONG(_debug, OID_AUTO, numcache, CTLFLAG_RD, &numcache, 0, ""); static u_long numcachehv; /* number of cache entries with vnodes held */ SYSCTL_ULONG(_debug, OID_AUTO, numcachehv, CTLFLAG_RD, &numcachehv, 0, ""); +#if 0 static u_long numcachepl; /* number of cache purge for leaf entries */ SYSCTL_ULONG(_debug, OID_AUTO, numcachepl, CTLFLAG_RD, &numcachepl, 0, ""); +#endif struct nchstats nchstats; /* cache effectiveness statistics */ static int doingcache = 1; /* 1 => enable the cache */ @@ -247,6 +249,31 @@ cache_zap(ncp) } /* + * cache_leaf_test() + * + * Test whether this (directory) vnode's namei cache entry contains + * subdirectories or not. Used to determine whether the directory is + * a leaf in the namei cache or not. Note: the directory may still + * contain files in the namei cache. + * + * Returns 0 if the directory is a leaf, -1 if it isn't. + */ +int +cache_leaf_test(struct vnode *vp) +{ + struct namecache *ncpc; + + for (ncpc = LIST_FIRST(&vp->v_cache_src); + ncpc != NULL; + ncpc = LIST_NEXT(ncpc, nc_src) + ) { + if (ncpc->nc_vp != NULL && ncpc->nc_vp->v_type == VDIR) + return(-1); + } + return(0); +} + +/* * Lookup an entry in the cache * * We don't do this if the segment name is long, simply so the cache @@ -499,6 +526,8 @@ cache_purgevfs(mp) } } +#if 0 + /* * Flush all dirctory entries with no child directories held in * the cache. @@ -555,6 +584,8 @@ cache_purgeleafdirs(ndir) numcachepl++; } +#endif + /* * Perform canonical checks and cache lookup and pass on to filesystem * through the vop_cachedlookup only if needed. |