vfs_cache.c (231088) | vfs_cache.c (232156) |
---|---|
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> | 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 231088 2012-02-06 17:00:28Z jhb $"); | 36__FBSDID("$FreeBSD: head/sys/kern/vfs_cache.c 232156 2012-02-25 12:06:40Z maxim $"); |
37 38#include "opt_kdtrace.h" 39#include "opt_ktrace.h" 40 41#include <sys/param.h> 42#include <sys/systm.h> 43#include <sys/filedesc.h> 44#include <sys/fnv_hash.h> --- 319 unchanged lines hidden (view full) --- 364 } 365 CACHE_RUNLOCK(); 366 if (count) 367 used++; 368 if (maxlength < count) 369 maxlength = count; 370 } 371 n_nchash = nchash + 1; | 37 38#include "opt_kdtrace.h" 39#include "opt_ktrace.h" 40 41#include <sys/param.h> 42#include <sys/systm.h> 43#include <sys/filedesc.h> 44#include <sys/fnv_hash.h> --- 319 unchanged lines hidden (view full) --- 364 } 365 CACHE_RUNLOCK(); 366 if (count) 367 used++; 368 if (maxlength < count) 369 maxlength = count; 370 } 371 n_nchash = nchash + 1; |
372 pct = (used * 100 * 100) / n_nchash; | 372 pct = (used * 100) / (n_nchash / 100); |
373 error = SYSCTL_OUT(req, &n_nchash, sizeof(n_nchash)); 374 if (error) 375 return (error); 376 error = SYSCTL_OUT(req, &used, sizeof(used)); 377 if (error) 378 return (error); 379 error = SYSCTL_OUT(req, &maxlength, sizeof(maxlength)); 380 if (error) 381 return (error); 382 error = SYSCTL_OUT(req, &pct, sizeof(pct)); 383 if (error) 384 return (error); 385 return (0); 386} 387SYSCTL_PROC(_debug_hashstat, OID_AUTO, nchash, CTLTYPE_INT|CTLFLAG_RD| 388 CTLFLAG_MPSAFE, 0, 0, sysctl_debug_hashstat_nchash, "I", | 373 error = SYSCTL_OUT(req, &n_nchash, sizeof(n_nchash)); 374 if (error) 375 return (error); 376 error = SYSCTL_OUT(req, &used, sizeof(used)); 377 if (error) 378 return (error); 379 error = SYSCTL_OUT(req, &maxlength, sizeof(maxlength)); 380 if (error) 381 return (error); 382 error = SYSCTL_OUT(req, &pct, sizeof(pct)); 383 if (error) 384 return (error); 385 return (0); 386} 387SYSCTL_PROC(_debug_hashstat, OID_AUTO, nchash, CTLTYPE_INT|CTLFLAG_RD| 388 CTLFLAG_MPSAFE, 0, 0, sysctl_debug_hashstat_nchash, "I", |
389 "nchash chain lengths"); | 389 "nchash statistics (number of total/used buckets, maximum chain length, usage percentage)"); |
390#endif 391 392/* 393 * cache_zap(): 394 * 395 * Removes a namecache entry from cache, whether it contains an actual 396 * pointer to a vnode or if it is just a negative cache entry. 397 */ --- 1062 unchanged lines hidden --- | 390#endif 391 392/* 393 * cache_zap(): 394 * 395 * Removes a namecache entry from cache, whether it contains an actual 396 * pointer to a vnode or if it is just a negative cache entry. 397 */ --- 1062 unchanged lines hidden --- |