From a0e8a1e29ba3f765b5032d1206b0678a8b756a9a Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Wed, 8 Mar 1995 01:40:44 +0000 Subject: [PATCH] Another little optimization to the nameicache. If an entry is stale, ditch it. --- sys/kern/vfs_cache.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index c6d816754807..2faf8293b608 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)vfs_cache.c 8.3 (Berkeley) 8/22/94 - * $Id: vfs_cache.c,v 1.5 1995/03/06 06:45:52 phk Exp $ + * $Id: vfs_cache.c,v 1.6 1995/03/08 01:08:03 phk Exp $ */ #include @@ -112,20 +112,14 @@ cache_lookup(dvp, vpp, cnp) !bcmp(ncp->nc_name, cnp->cn_nameptr, (u_int)ncp->nc_nlen)) break; nnp = ncp->nc_hash.le_next; -#ifdef not_yet_phk - /* - * if not already last and one of the vp's are invalid, - * move to head of LRU - */ - if ((ncp->nc_lru.tqe_next != 0) && - ( (ncp->nc_dvpid != ncp->nc_dvp->v_id) || - (ncp->nc_vp && (ncp->nc_vpid != ncp->nc_vp->v_id)))) { + /* If one of the vp's went stale, don't bother anymore. */ + if ((ncp->nc_dvpid != ncp->nc_dvp->v_id) || + (ncp->nc_vp && (ncp->nc_vpid != ncp->nc_vp->v_id))) { LIST_REMOVE(ncp, nc_hash); ncp->nc_hash.le_prev = 0; TAILQ_REMOVE(&nclruhead, ncp, nc_lru); TAILQ_INSERT_HEAD(&nclruhead, ncp, nc_lru); } -#endif /* not_yet_phk */ } if (ncp == 0) { nchstats.ncs_miss++; @@ -157,10 +151,6 @@ cache_lookup(dvp, vpp, cnp) TAILQ_REMOVE(&nclruhead, ncp, nc_lru); TAILQ_INSERT_TAIL(&nclruhead, ncp, nc_lru); } -#ifdef not_yet_phk - /* Touch the parent vnode */ - vtouch(ncp->nc_dvp); -#endif /* not_yet_phk */ *vpp = ncp->nc_vp; return (-1); }