Deleted Added
sdiff udiff text old ( 215281 ) new ( 215283 )
full compact
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 215281 2010-11-14 06:09:50Z 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, "Name cache statistics");
193#define STATNODE(mode, name, var, descr) \
194 SYSCTL_ULONG(_vfs_cache, OID_AUTO, name, mode, var, 0, descr);
195STATNODE(CTLFLAG_RD, numneg, &numneg, "Number of negative cache entries");
196STATNODE(CTLFLAG_RD, numcache, &numcache, "Number of cache entries");
197static u_long numcalls; STATNODE(CTLFLAG_RD, numcalls, &numcalls, "Number of cache lookups");
198static u_long dothits; STATNODE(CTLFLAG_RD, dothits, &dothits, "Number of '.' hits");
199static u_long dotdothits; STATNODE(CTLFLAG_RD, dotdothits, &dotdothits, "Number of '..' hits");
200static u_long numchecks; STATNODE(CTLFLAG_RD, numchecks, &numchecks, "Number of checks in lookup");
201static u_long nummiss; STATNODE(CTLFLAG_RD, nummiss, &nummiss, "Number of cache misses");
202static u_long nummisszap; STATNODE(CTLFLAG_RD, nummisszap, &nummisszap, "Number of cache misses we do not want to cache");
203static u_long numposzaps; STATNODE(CTLFLAG_RD, numposzaps, &numposzaps, "Number of cache hits (positive) we do not want to cache");
204static u_long numposhits; STATNODE(CTLFLAG_RD, numposhits, &numposhits, "Number of cache hits (positive)");
205static u_long numnegzaps; STATNODE(CTLFLAG_RD, numnegzaps, &numnegzaps, "Number of cache hits (negative) we do not want to cache");
206static u_long numneghits; STATNODE(CTLFLAG_RD, numneghits, &numneghits, "Number of cache hits (negative)");
207static u_long numupgrades; STATNODE(CTLFLAG_RD, numupgrades, &numupgrades, "Number of updates of the cache after lookup (write lock + retry)");
208
209SYSCTL_OPAQUE(_vfs_cache, OID_AUTO, nchstats, CTLFLAG_RD | CTLFLAG_MPSAFE,
210 &nchstats, sizeof(nchstats), "LU", "VFS cache effectiveness statistics");
211
212
213
214static void cache_zap(struct namecache *ncp);
215static int vn_vptocnp_locked(struct vnode **vp, struct ucred *cred, char *buf,
216 u_int *buflen);
217static int vn_fullpath1(struct thread *td, struct vnode *vp, struct vnode *rdir,
218 char *buf, char **retbuf, u_int buflen);

--- 757 unchanged lines hidden (view full) ---

976
977static int disablefullpath;
978SYSCTL_INT(_debug, OID_AUTO, disablefullpath, CTLFLAG_RW, &disablefullpath, 0,
979 "Disable the vn_fullpath function");
980
981/* These count for kern___getcwd(), too. */
982STATNODE(numfullpathcalls, "Number of fullpath search calls");
983STATNODE(numfullpathfail1, "Number of fullpath search errors (ENOTDIR)");
984STATNODE(numfullpathfail2, "Number of fullpath search errors (VOP_VPTOCNP failures)");
985STATNODE(numfullpathfail4, "Number of fullpath search errors (ENOMEM)");
986STATNODE(numfullpathfound, "Number of successful fullpath calls");
987
988/*
989 * Retrieve the full filesystem path that correspond to a vnode from the name
990 * cache (if available)
991 */
992int

--- 242 unchanged lines hidden ---