Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Dec 1998 11:08:43 +1100
From:      Peter Jeremy <peter.jeremy@auss2.alcatel.com.au>
To:        freebsd-current@FreeBSD.ORG
Subject:   Name cache questions.
Message-ID:  <98Dec2.110806est.40355@border.alcanet.com.au>

next in thread | raw e-mail | index | archive | help
I've been studying the name cache code (in 3.0-RELEASE), trying to see
if I can improve the hit rate.  Looking at the code (in kern/vfs_cache.c)
it's not clear to me how the cache is managed.  In several cases, the
comments appear at variance to the code.

1) According to the comments, the name cache is LRU.  This implies that
   cache_lookup() should re-order matched entries to bring the match
   to the `most recently used' position.  This is done only for negative
   matches.

2) There doesn't appear to be any limit on the size of the number of
   cache entries - only negative entries are pruned limit the number
   of negative entries to 1/ncnegfactor of the total entries.

3) cache_lookup() includes the comment `We don't do this if the
   segment name is long'.  Neither cache_lookup(), nor any of its
   callers appear to include code to check the segment name length
   (other than to NAME_MAX).

4) cache_purge() includes the comment `If the v_id wraps around, we
   need to ditch the entire cache'.  The code doesn't check for
   wrap-around, it simply avoids v_id == 0 and re-using the existing
   v_id.  (Although this appears to be adequate).

Overall, it appears that the name cache size is controlled solely by
the vnode list - when a vnode list entry is reused, any associated
name cache entries are invalidated.  Is this correct?

Peter
--
Peter Jeremy (VK2PJ)                    peter.jeremy@alcatel.com.au
Alcatel Australia Limited
41 Mandible St                          Phone: +61 2 9690 5019
ALEXANDRIA  NSW  2015                   Fax:   +61 2 9690 5247

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?98Dec2.110806est.40355>