1/*- 2 * Copyright (c) 1989, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Poul-Henning Kamp of the FreeBSD Project. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 19 unchanged lines hidden (view full) --- 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * @(#)vfs_cache.c 8.5 (Berkeley) 3/22/95 33 */ 34 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sys/kern/vfs_cache.c 215283 2010-11-14 08:06:29Z brucec $"); |
37 38#include "opt_kdtrace.h" 39#include "opt_ktrace.h" 40 41#include <sys/param.h> 42#include <sys/filedesc.h> 43#include <sys/fnv_hash.h> 44#include <sys/kernel.h> --- 139 unchanged lines hidden (view full) --- 184 185/* Export size information to userland */ 186SYSCTL_INT(_debug_sizeof, OID_AUTO, namecache, CTLFLAG_RD, 0, 187 sizeof(struct namecache), "sizeof(struct namecache)"); 188 189/* 190 * The new name cache statistics 191 */ |
192static SYSCTL_NODE(_vfs, OID_AUTO, cache, CTLFLAG_RW, 0, 193 "Name cache statistics"); |
194#define STATNODE(mode, name, var, descr) \ 195 SYSCTL_ULONG(_vfs_cache, OID_AUTO, name, mode, var, 0, descr); 196STATNODE(CTLFLAG_RD, numneg, &numneg, "Number of negative cache entries"); 197STATNODE(CTLFLAG_RD, numcache, &numcache, "Number of cache entries"); |
198static u_long numcalls; STATNODE(CTLFLAG_RD, numcalls, &numcalls, 199 "Number of cache lookups"); 200static u_long dothits; STATNODE(CTLFLAG_RD, dothits, &dothits, 201 "Number of '.' hits"); 202static u_long dotdothits; STATNODE(CTLFLAG_RD, dotdothits, &dotdothits, 203 "Number of '..' hits"); 204static u_long numchecks; STATNODE(CTLFLAG_RD, numchecks, &numchecks, 205 "Number of checks in lookup"); 206static u_long nummiss; STATNODE(CTLFLAG_RD, nummiss, &nummiss, 207 "Number of cache misses"); 208static u_long nummisszap; STATNODE(CTLFLAG_RD, nummisszap, &nummisszap, 209 "Number of cache misses we do not want to cache"); 210static u_long numposzaps; STATNODE(CTLFLAG_RD, numposzaps, &numposzaps, 211 "Number of cache hits (positive) we do not want to cache"); 212static u_long numposhits; STATNODE(CTLFLAG_RD, numposhits, &numposhits, 213 "Number of cache hits (positive)"); 214static u_long numnegzaps; STATNODE(CTLFLAG_RD, numnegzaps, &numnegzaps, 215 "Number of cache hits (negative) we do not want to cache"); 216static u_long numneghits; STATNODE(CTLFLAG_RD, numneghits, &numneghits, 217 "Number of cache hits (negative)"); 218static u_long numupgrades; STATNODE(CTLFLAG_RD, numupgrades, &numupgrades, 219 "Number of updates of the cache after lookup (write lock + retry)"); |
220 221SYSCTL_OPAQUE(_vfs_cache, OID_AUTO, nchstats, CTLFLAG_RD | CTLFLAG_MPSAFE, |
222 &nchstats, sizeof(nchstats), "LU", 223 "VFS cache effectiveness statistics"); |
224 225 226 227static void cache_zap(struct namecache *ncp); 228static int vn_vptocnp_locked(struct vnode **vp, struct ucred *cred, char *buf, 229 u_int *buflen); 230static int vn_fullpath1(struct thread *td, struct vnode *vp, struct vnode *rdir, 231 char *buf, char **retbuf, u_int buflen); --- 757 unchanged lines hidden (view full) --- 989 990static int disablefullpath; 991SYSCTL_INT(_debug, OID_AUTO, disablefullpath, CTLFLAG_RW, &disablefullpath, 0, 992 "Disable the vn_fullpath function"); 993 994/* These count for kern___getcwd(), too. */ 995STATNODE(numfullpathcalls, "Number of fullpath search calls"); 996STATNODE(numfullpathfail1, "Number of fullpath search errors (ENOTDIR)"); |
997STATNODE(numfullpathfail2, 998 "Number of fullpath search errors (VOP_VPTOCNP failures)"); |
999STATNODE(numfullpathfail4, "Number of fullpath search errors (ENOMEM)"); 1000STATNODE(numfullpathfound, "Number of successful fullpath calls"); 1001 1002/* 1003 * Retrieve the full filesystem path that correspond to a vnode from the name 1004 * cache (if available) 1005 */ 1006int --- 242 unchanged lines hidden --- |