FreeBSD kernel kern code
vfs_cache.c File Reference
#include <sys/cdefs.h>
#include "opt_ddb.h"
#include "opt_ktrace.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/capsicum.h>
#include <sys/counter.h>
#include <sys/filedesc.h>
#include <sys/fnv_hash.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/fcntl.h>
#include <sys/jail.h>
#include <sys/mount.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/seqc.h>
#include <sys/sdt.h>
#include <sys/smr.h>
#include <sys/smp.h>
#include <sys/syscallsubr.h>
#include <sys/sysctl.h>
#include <sys/sysproto.h>
#include <sys/vnode.h>
#include <ck_queue.h>
#include <security/audit/audit.h>
#include <security/mac/mac_framework.h>
#include <vm/uma.h>
Include dependency graph for vfs_cache.c:

Go to the source code of this file.

Data Structures

struct  negstate
 
struct  namecache
 
struct  namecache_ts
 
struct  celockstate
 
struct  nameidata_outer
 
struct  nameidata_saved
 
struct  cache_fpl
 

Macros

#define CACHE_ZONE_ALIGNMENT   UMA_ALIGNOF(time_t)
 
#define CACHE_PATH_CUTOFF   41
 
#define CACHE_LARGE_PAD   2
 
#define CACHE_ZONE_SMALL_SIZE   (offsetof(struct namecache, nc_name) + CACHE_PATH_CUTOFF + 1)
 
#define CACHE_ZONE_SMALL_TS_SIZE   (offsetof(struct namecache_ts, nc_nc) + CACHE_ZONE_SMALL_SIZE)
 
#define CACHE_ZONE_LARGE_SIZE   (offsetof(struct namecache, nc_name) + NAME_MAX + 1 + CACHE_LARGE_PAD)
 
#define CACHE_ZONE_LARGE_TS_SIZE   (offsetof(struct namecache_ts, nc_nc) + CACHE_ZONE_LARGE_SIZE)
 
#define nc_vp   n_un.nu_vp
 
#define nc_neg   n_un.nu_neg
 
#define NCF_WHITE   0x01
 
#define NCF_ISDOTDOT   0x02
 
#define NCF_TS   0x04
 
#define NCF_DTS   0x08
 
#define NCF_DVDROP   0x10
 
#define NCF_NEGATIVE   0x20
 
#define NCF_INVALID   0x40
 
#define NCF_WIP   0x80
 
#define NEG_HOT   0x01
 
#define cache_ncp_canuse(ncp)
 
#define cache_fpl_neg_ncp_canuse(ncp)
 
#define NCHHASH(hash)    (&nchashtbl[(hash) & nchash])
 
#define ncneghash   3
 
#define numneglists   (ncneghash + 1)
 
#define numbucketlocks   (ncbuckethash + 1)
 
#define HASH2BUCKETLOCK(hash)    ((struct mtx *)(&bucketlocks[((hash) & ncbuckethash)]))
 
#define numvnodelocks   (ncvnodehash + 1)
 
#define STATNODE_ULONG(name, varname, descr)    SYSCTL_ULONG(_vfs_cache_stats, OID_AUTO, name, CTLFLAG_RD, &varname, 0, descr);
 
#define STATNODE_COUNTER(name, varname, descr)
 
#define DEBUGNODE_ULONG(name, varname, descr)    SYSCTL_ULONG(_vfs_cache_debug, OID_AUTO, name, CTLFLAG_RD, &varname, 0, descr);
 
#define DEBUGNODE_COUNTER(name, varname, descr)
 
#define cache_assert_bucket_locked(x)   do { } while (0)
 
#define cache_assert_bucket_unlocked(x)   do { } while (0)
 
#define cache_sort_vnodes(x, y)   _cache_sort_vnodes((void **)(x), (void **)(y))
 
#define CACHE_NEG_PROMOTION_THRESH   2
 
#define cache_neg_hit_abort(ncp)   do { } while (0)
 
#define cache_rev_failed(var)   cache_rev_failed_impl((var), __LINE__)
 
#define CACHE_FPL_FAILED   -2020
 
#define cache_fpl_smr_assert_entered(fpl)   do { } while (0)
 
#define cache_fpl_smr_assert_not_entered(fpl)   do { } while (0)
 
#define cache_fpl_assert_status(fpl)   do { } while (0)
 
#define cache_fpl_smr_enter_initial(fpl)
 
#define cache_fpl_smr_enter(fpl)
 
#define cache_fpl_smr_exit(fpl)
 
#define cache_fpl_aborted_early(x)   cache_fpl_aborted_early_impl((x), __LINE__)
 
#define cache_fpl_aborted(x)   cache_fpl_aborted_impl((x), __LINE__)
 
#define cache_fpl_partial(x)   cache_fpl_partial_impl((x), __LINE__)
 
#define cache_fpl_handled(x)   cache_fpl_handled_impl((x), __LINE__)
 
#define cache_fpl_handled_error(x, e)   cache_fpl_handled_error_impl((x), (e), __LINE__)
 
#define CACHE_FPL_SUPPORTED_CN_FLAGS
 
#define CACHE_FPL_INTERNAL_CN_FLAGS    (ISDOTDOT | MAKEENTRY | ISLASTCN)
 

Functions

 __FBSDID ("$FreeBSD$")
 
static SYSCTL_NODE (_vfs, OID_AUTO, cache, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "Name cache")
 
 SDT_PROVIDER_DECLARE (vfs)
 
 SDT_PROBE_DEFINE3 (vfs, namecache, enter, done, "struct vnode *", "char *", "struct vnode *")
 
 SDT_PROBE_DEFINE3 (vfs, namecache, enter, duplicate, "struct vnode *", "char *", "struct vnode *")
 
 SDT_PROBE_DEFINE2 (vfs, namecache, enter_negative, done, "struct vnode *", "char *")
 
 SDT_PROBE_DEFINE2 (vfs, namecache, fullpath_smr, hit, "struct vnode *", "const char *")
 
 SDT_PROBE_DEFINE4 (vfs, namecache, fullpath_smr, miss, "struct vnode *", "struct namecache *", "int", "int")
 
 SDT_PROBE_DEFINE1 (vfs, namecache, fullpath, entry, "struct vnode *")
 
 SDT_PROBE_DEFINE3 (vfs, namecache, fullpath, hit, "struct vnode *", "char *", "struct vnode *")
 
 SDT_PROBE_DEFINE1 (vfs, namecache, fullpath, miss, "struct vnode *")
 
 SDT_PROBE_DEFINE3 (vfs, namecache, fullpath, return, "int", "struct vnode *", "char *")
 
 SDT_PROBE_DEFINE3 (vfs, namecache, lookup, hit, "struct vnode *", "char *", "struct vnode *")
 
 SDT_PROBE_DEFINE2 (vfs, namecache, lookup, hit__negative, "struct vnode *", "char *")
 
 SDT_PROBE_DEFINE2 (vfs, namecache, lookup, miss, "struct vnode *", "char *")
 
 SDT_PROBE_DEFINE2 (vfs, namecache, removecnp, hit, "struct vnode *", "struct componentname *")
 
 SDT_PROBE_DEFINE2 (vfs, namecache, removecnp, miss, "struct vnode *", "struct componentname *")
 
 SDT_PROBE_DEFINE3 (vfs, namecache, purge, done, "struct vnode *", "size_t", "size_t")
 
 SDT_PROBE_DEFINE1 (vfs, namecache, purge, batch, "int")
 
 SDT_PROBE_DEFINE1 (vfs, namecache, purge_negative, done, "struct vnode *")
 
 SDT_PROBE_DEFINE1 (vfs, namecache, purgevfs, done, "struct mount *")
 
 SDT_PROBE_DEFINE3 (vfs, namecache, zap, done, "struct vnode *", "char *", "struct vnode *")
 
 SDT_PROBE_DEFINE2 (vfs, namecache, zap_negative, done, "struct vnode *", "char *")
 
 SDT_PROBE_DEFINE2 (vfs, namecache, evict_negative, done, "struct vnode *", "char *")
 
 SDT_PROBE_DEFINE1 (vfs, namecache, symlink, alloc__fail, "size_t")
 
 SDT_PROBE_DEFINE3 (vfs, fplookup, lookup, done, "struct nameidata", "int", "bool")
 
 SDT_PROBE_DECLARE (vfs, namei, lookup, entry)
 
 SDT_PROBE_DECLARE (vfs, namei, lookup, return)
 
 _Static_assert (sizeof(struct negstate)<=sizeof(struct vnode *), "the state must fit in a union with a pointer without growing it")
 
 TAILQ_HEAD (cache_freebatch, namecache)
 
 _Static_assert ((CACHE_ZONE_SMALL_SIZE %(CACHE_ZONE_ALIGNMENT+1))==0, "bad zone size")
 
 _Static_assert ((CACHE_ZONE_SMALL_TS_SIZE %(CACHE_ZONE_ALIGNMENT+1))==0, "bad zone size")
 
 _Static_assert ((CACHE_ZONE_LARGE_SIZE %(CACHE_ZONE_ALIGNMENT+1))==0, "bad zone size")
 
 _Static_assert ((CACHE_ZONE_LARGE_TS_SIZE %(CACHE_ZONE_ALIGNMENT+1))==0, "bad zone size")
 
static bool cache_neg_evict_cond (u_long lnumcache)
 
static void cache_ncp_invalidate (struct namecache *ncp)
 
static SYSCTL_NODE (_vfs_cache, OID_AUTO, param, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "Name cache parameters")
 
 SYSCTL_UINT (_vfs_cache_param, OID_AUTO, size, CTLFLAG_RW, &ncsize, 0, "Total namecache capacity")
 
 SYSCTL_UINT (_vfs_cache_param, OID_AUTO, sizefactor, CTLFLAG_RW, &ncsizefactor, 0, "Size factor for namecache")
 
 SYSCTL_ULONG (_vfs_cache_param, OID_AUTO, negfactor, CTLFLAG_RW, &ncnegfactor, 0, "Ratio of negative namecache entries")
 
 SYSCTL_UINT (_vfs_cache_param, OID_AUTO, negmin, CTLFLAG_RD, &neg_min, 0, "Negative entry count above which automatic eviction is allowed")
 
static __read_mostly CK_SLIST_HEAD (nchashhead, namecache)
 
 __aligned (CACHE_LINE_SIZE)
 
static struct neglist * NCP2NEGLIST (struct namecache *ncp)
 
static struct negstateNCP2NEGSTATE (struct namecache *ncp)
 
static struct mtxVP2VNODELOCK (struct vnode *vp)
 
static void cache_out_ts (struct namecache *ncp, struct timespec *tsp, int *ticksp)
 
 SYSCTL_INT (_debug_sizeof, OID_AUTO, namecache, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, sizeof(struct namecache), "sizeof(struct namecache)")
 
static SYSCTL_NODE (_vfs_cache, OID_AUTO, stats, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "Name cache statistics")
 
 STATNODE_ULONG (neg, numneg, "Number of negative cache entries")
 
 STATNODE_ULONG (count, numcache, "Number of cache entries")
 
 STATNODE_COUNTER (heldvnodes, numcachehv, "Number of namecache entries with vnodes held")
 
 STATNODE_COUNTER (drops, numdrops, "Number of dropped entries due to reaching the limit")
 
 STATNODE_COUNTER (dothits, dothits, "Number of '.' hits")
 
 STATNODE_COUNTER (dotdothis, dotdothits, "Number of '..' hits")
 
 STATNODE_COUNTER (miss, nummiss, "Number of cache misses")
 
 STATNODE_COUNTER (misszap, nummisszap, "Number of cache misses we do not want to cache")
 
 STATNODE_COUNTER (posszaps, numposzaps, "Number of cache hits (positive) we do not want to cache")
 
 STATNODE_COUNTER (poshits, numposhits, "Number of cache hits (positive)")
 
 STATNODE_COUNTER (negzaps, numnegzaps, "Number of cache hits (negative) we do not want to cache")
 
 STATNODE_COUNTER (neghits, numneghits, "Number of cache hits (negative)")
 
 STATNODE_COUNTER (fullpathcalls, numfullpathcalls, "Number of fullpath search calls")
 
 STATNODE_COUNTER (fullpathfail1, numfullpathfail1, "Number of fullpath search errors (ENOTDIR)")
 
 STATNODE_COUNTER (fullpathfail2, numfullpathfail2, "Number of fullpath search errors (VOP_VPTOCNP failures)")
 
 STATNODE_COUNTER (fullpathfail4, numfullpathfail4, "Number of fullpath search errors (ENOMEM)")
 
 STATNODE_COUNTER (fullpathfound, numfullpathfound, "Number of successful fullpath calls")
 
 STATNODE_COUNTER (symlinktoobig, symlinktoobig, "Number of times symlink did not fit the cache")
 
static SYSCTL_NODE (_vfs_cache, OID_AUTO, debug, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "Name cache debugging")
 
 DEBUGNODE_COUNTER (zap_bucket_relock_success, zap_bucket_relock_success, "Number of successful removals after relocking")
 
 DEBUGNODE_ULONG (zap_bucket_fail, zap_bucket_fail, "")
 
 DEBUGNODE_ULONG (zap_bucket_fail2, zap_bucket_fail2, "")
 
 DEBUGNODE_ULONG (vnodes_cel_3_failures, cache_lock_vnodes_cel_3_failures, "Number of times 3-way vnode locking failed")
 
static void cache_zap_locked (struct namecache *ncp)
 
static int vn_fullpath_any_smr (struct vnode *vp, struct vnode *rdir, char *buf, char **retbuf, size_t *buflen, size_t addend)
 
static int vn_fullpath_any (struct vnode *vp, struct vnode *rdir, char *buf, char **retbuf, size_t *buflen)
 
static int vn_fullpath_dir (struct vnode *vp, struct vnode *rdir, char *buf, char **retbuf, size_t *len, size_t addend)
 
static MALLOC_DEFINE (M_VFSCACHE, "vfscache", "VFS name cache entries")
 
static void cache_assert_vlp_locked (struct mtx *vlp)
 
static void cache_assert_vnode_locked (struct vnode *vp)
 
static void cache_hold_vnode (struct vnode *vp)
 
static void cache_drop_vnode (struct vnode *vp)
 
char * cache_symlink_alloc (size_t size, int flags)
 
void cache_symlink_free (char *string, size_t size)
 
static struct namecachecache_alloc_uma (int len, bool ts)
 
static void cache_free_uma (struct namecache *ncp)
 
static struct namecachecache_alloc (int len, bool ts)
 
static void cache_free (struct namecache *ncp)
 
static void cache_free_batch (struct cache_freebatch *batch)
 
static void cache_prehash (struct vnode *vp)
 
static uint32_t cache_get_hash (char *name, u_char len, struct vnode *dvp)
 
static uint32_t cache_get_hash_iter_start (struct vnode *dvp)
 
static uint32_t cache_get_hash_iter (char c, uint32_t hash)
 
static uint32_t cache_get_hash_iter_finish (uint32_t hash)
 
static struct nchashhead * NCP2BUCKET (struct namecache *ncp)
 
static struct mtxNCP2BUCKETLOCK (struct namecache *ncp)
 
static void _cache_sort_vnodes (void **p1, void **p2)
 
static void cache_lock_all_buckets (void)
 
static void cache_unlock_all_buckets (void)
 
static void cache_lock_all_vnodes (void)
 
static void cache_unlock_all_vnodes (void)
 
static int cache_trylock_vnodes (struct mtx *vlp1, struct mtx *vlp2)
 
static void cache_lock_vnodes (struct mtx *vlp1, struct mtx *vlp2)
 
static void cache_unlock_vnodes (struct mtx *vlp1, struct mtx *vlp2)
 
static int sysctl_nchstats (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_vfs_cache, OID_AUTO, nchstats, CTLTYPE_OPAQUE|CTLFLAG_RD|CTLFLAG_MPSAFE, 0, 0, sysctl_nchstats, "LU", "VFS cache effectiveness statistics")
 
static void cache_recalc_neg_min (u_int val)
 
static int sysctl_negminpct (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_vfs_cache_param, OID_AUTO, negminpct, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, NULL, 0, sysctl_negminpct, "I", "Negative entry \% of namecache capacity above which automatic eviction is allowed")
 
static SYSCTL_NODE (_vfs_cache, OID_AUTO, neg, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "Name cache negative entry statistics")
 
 SYSCTL_ULONG (_vfs_cache_neg, OID_AUTO, count, CTLFLAG_RD, &numneg, 0, "Number of negative cache entries")
 
static COUNTER_U64_DEFINE_EARLY (neg_created)
 
 SYSCTL_COUNTER_U64 (_vfs_cache_neg, OID_AUTO, created, CTLFLAG_RD, &neg_created, "Number of created negative entries")
 
static COUNTER_U64_DEFINE_EARLY (neg_evicted)
 
 SYSCTL_COUNTER_U64 (_vfs_cache_neg, OID_AUTO, evicted, CTLFLAG_RD, &neg_evicted, "Number of evicted negative entries")
 
static COUNTER_U64_DEFINE_EARLY (neg_evict_skipped_empty)
 
 SYSCTL_COUNTER_U64 (_vfs_cache_neg, OID_AUTO, evict_skipped_empty, CTLFLAG_RD, &neg_evict_skipped_empty, "Number of times evicting failed due to lack of entries")
 
static COUNTER_U64_DEFINE_EARLY (neg_evict_skipped_missed)
 
 SYSCTL_COUNTER_U64 (_vfs_cache_neg, OID_AUTO, evict_skipped_missed, CTLFLAG_RD, &neg_evict_skipped_missed, "Number of times evicting failed due to target entry disappearing")
 
static COUNTER_U64_DEFINE_EARLY (neg_evict_skipped_contended)
 
 SYSCTL_COUNTER_U64 (_vfs_cache_neg, OID_AUTO, evict_skipped_contended, CTLFLAG_RD, &neg_evict_skipped_contended, "Number of times evicting failed due to contention")
 
 SYSCTL_COUNTER_U64 (_vfs_cache_neg, OID_AUTO, hits, CTLFLAG_RD, &numneghits, "Number of cache hits (negative)")
 
static int sysctl_neg_hot (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_vfs_cache_neg, OID_AUTO, hot, CTLTYPE_INT|CTLFLAG_RD|CTLFLAG_MPSAFE, 0, 0, sysctl_neg_hot, "I", "Number of hot negative entries")
 
static void cache_neg_init (struct namecache *ncp)
 
static bool cache_neg_hit_prep (struct namecache *ncp)
 
static void cache_neg_hit_finish (struct namecache *ncp)
 
static void cache_neg_promote_locked (struct namecache *ncp)
 
static void cache_neg_demote_locked (struct namecache *ncp)
 
static bool cache_neg_promote_cond (struct vnode *dvp, struct componentname *cnp, struct namecache *oncp, uint32_t hash)
 
static void cache_neg_promote (struct namecache *ncp)
 
static void cache_neg_insert (struct namecache *ncp)
 
static void cache_neg_remove (struct namecache *ncp)
 
static struct neglist * cache_neg_evict_select_list (void)
 
static struct namecachecache_neg_evict_select_entry (struct neglist *nl)
 
static bool cache_neg_evict (void)
 
static void cache_zap_negative_locked_vnode_kl (struct namecache *ncp, struct vnode *vp)
 
static bool cache_zap_locked_vnode_kl2 (struct namecache *ncp, struct vnode *vp, struct mtx **vlpp)
 
static int cache_zap_unlocked_bucket (struct namecache *ncp, struct componentname *cnp, struct vnode *dvp, struct mtx *dvlp, struct mtx *vlp, uint32_t hash, struct mtx *blp)
 
static int __noinline cache_zap_locked_bucket (struct namecache *ncp, struct componentname *cnp, uint32_t hash, struct mtx *blp)
 
static __noinline int cache_remove_cnp (struct vnode *dvp, struct componentname *cnp)
 
static int __noinline cache_lookup_dot (struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct timespec *tsp, int *ticksp)
 
static int __noinline cache_lookup_dotdot (struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct timespec *tsp, int *ticksp)
 
static int __noinline cache_lookup_fallback (struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct timespec *tsp, int *ticksp)
 
int cache_lookup (struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct timespec *tsp, int *ticksp)
 
 CTASSERT ((nitems(((struct celockstate *) 0) ->vlp)==3))
 
 CTASSERT ((nitems(((struct celockstate *) 0) ->blp)==2))
 
static void cache_celockstate_init (struct celockstate *cel)
 
static void cache_lock_vnodes_cel (struct celockstate *cel, struct vnode *vp, struct vnode *dvp)
 
static void cache_unlock_vnodes_cel (struct celockstate *cel)
 
static bool cache_lock_vnodes_cel_3 (struct celockstate *cel, struct vnode *vp)
 
static void cache_lock_buckets_cel (struct celockstate *cel, struct mtx *blp1, struct mtx *blp2)
 
static void cache_unlock_buckets_cel (struct celockstate *cel)
 
static void cache_enter_lock (struct celockstate *cel, struct vnode *dvp, struct vnode *vp, uint32_t hash)
 
static void cache_enter_lock_dd (struct celockstate *cel, struct vnode *dvp, struct vnode *vp, uint32_t hash)
 
static void cache_enter_unlock (struct celockstate *cel)
 
static void __noinline cache_enter_dotdot_prep (struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
 
void cache_enter_time (struct vnode *dvp, struct vnode *vp, struct componentname *cnp, struct timespec *tsp, struct timespec *dtsp)
 
void cache_enter_time_flags (struct vnode *dvp, struct vnode *vp, struct componentname *cnp, struct timespec *tsp, struct timespec *dtsp, int flags)
 
static u_int cache_roundup_2 (u_int val)
 
static struct nchashhead * nchinittbl (u_long elements, u_long *hashmask)
 
static void ncfreetbl (struct nchashhead *hashtbl)
 
static void nchinit (void *dummy __unused)
 
 SYSINIT (vfs, SI_SUB_VFS, SI_ORDER_SECOND, nchinit, NULL)
 
void cache_vnode_init (struct vnode *vp)
 
static void cache_changesize_set_temp (struct nchashhead *temptbl, u_long temphash)
 
static void cache_changesize_set_new (struct nchashhead *new_tbl, u_long new_hash)
 
void cache_changesize (u_long newmaxvnodes)
 
static void cache_purge_impl (struct vnode *vp)
 
static bool cache_has_entries (struct vnode *vp)
 
void cache_purge (struct vnode *vp)
 
void cache_purge_vgone (struct vnode *vp)
 
void cache_purge_negative (struct vnode *vp)
 
void cache_vop_rename (struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp, struct vnode *tvp, struct componentname *fcnp, struct componentname *tcnp)
 
void cache_vop_rmdir (struct vnode *dvp, struct vnode *vp)
 
void cache_purgevfs (struct mount *mp)
 
int vfs_cache_lookup (struct vop_lookup_args *ap)
 
int sys___getcwd (struct thread *td, struct __getcwd_args *uap)
 
int vn_getcwd (char *buf, char **retbuf, size_t *buflen)
 
static int kern___realpathat (struct thread *td, int fd, const char *path, char *buf, size_t size, int flags, enum uio_seg pathseg)
 
int sys___realpathat (struct thread *td, struct __realpathat_args *uap)
 
int vn_fullpath (struct vnode *vp, char **retbuf, char **freebuf)
 
int vn_fullpath_global (struct vnode *vp, char **retbuf, char **freebuf)
 
static struct namecachevn_dd_from_dst (struct vnode *vp)
 
int vn_vptocnp (struct vnode **vp, char *buf, size_t *buflen)
 
static void __inline cache_rev_failed_impl (int *reason, int line)
 
int vn_fullpath_hardlink (struct vnode *vp, struct vnode *dvp, const char *hrdl_name, size_t hrdl_name_length, char **retbuf, char **freebuf, size_t *buflen)
 
struct vnode * vn_dir_dd_ino (struct vnode *vp)
 
int vn_commname (struct vnode *vp, char *buf, u_int buflen)
 
int vn_path_to_global_path (struct thread *td, struct vnode *vp, char *path, u_int pathlen)
 
void cache_fast_lookup_enabled_recalc (void)
 
static int syscal_vfs_cache_fast_lookup (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_vfs, OID_AUTO, cache_fast_lookup, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MPSAFE, &cache_fast_lookup, 0, syscal_vfs_cache_fast_lookup, "IU", "")
 
static bool cache_fplookup_mp_supported (struct mount *mp)
 
static bool cache_fplookup_is_mp (struct cache_fpl *fpl)
 
static int cache_fplookup_cross_mount (struct cache_fpl *fpl)
 
static int cache_fplookup_partial_setup (struct cache_fpl *fpl)
 
static int cache_fplookup_skip_slashes (struct cache_fpl *fpl)
 
static int cache_fplookup_trailingslash (struct cache_fpl *fpl)
 
static void cache_fpl_pathlen_dec (struct cache_fpl *fpl)
 
static void cache_fpl_pathlen_inc (struct cache_fpl *fpl)
 
static void cache_fpl_pathlen_add (struct cache_fpl *fpl, size_t n)
 
static void cache_fpl_pathlen_sub (struct cache_fpl *fpl, size_t n)
 
static void cache_fpl_cleanup_cnp (struct componentname *cnp)
 
static struct vnode * cache_fpl_handle_root (struct cache_fpl *fpl)
 
static void cache_fpl_checkpoint_outer (struct cache_fpl *fpl)
 
static void cache_fpl_checkpoint (struct cache_fpl *fpl)
 
static void cache_fpl_restore_partial (struct cache_fpl *fpl)
 
static void cache_fpl_restore_abort (struct cache_fpl *fpl)
 
static int cache_fpl_aborted_early_impl (struct cache_fpl *fpl, int line)
 
static int __noinline cache_fpl_aborted_impl (struct cache_fpl *fpl, int line)
 
static int __noinline cache_fpl_partial_impl (struct cache_fpl *fpl, int line)
 
static int cache_fpl_handled_impl (struct cache_fpl *fpl, int line)
 
static int cache_fpl_handled_error_impl (struct cache_fpl *fpl, int error, int line)
 
static bool cache_fpl_terminated (struct cache_fpl *fpl)
 
 _Static_assert ((CACHE_FPL_SUPPORTED_CN_FLAGS &CACHE_FPL_INTERNAL_CN_FLAGS)==0, "supported and internal flags overlap")
 
static bool cache_fpl_islastcn (struct nameidata *ndp)
 
static bool cache_fpl_istrailingslash (struct cache_fpl *fpl)
 
static bool cache_fpl_isdotdot (struct componentname *cnp)
 
static bool cache_can_fplookup (struct cache_fpl *fpl)
 
static int __noinline cache_fplookup_dirfd (struct cache_fpl *fpl, struct vnode **vpp)
 
static int __noinline cache_fplookup_negative_promote (struct cache_fpl *fpl, struct namecache *oncp, uint32_t hash)
 
static int cache_fplookup_final_child (struct cache_fpl *fpl, enum vgetstate tvs)
 
static int __noinline cache_fplookup_final_modifying (struct cache_fpl *fpl)
 
static int __noinline cache_fplookup_modifying (struct cache_fpl *fpl)
 
static int __noinline cache_fplookup_final_withparent (struct cache_fpl *fpl)
 
static int cache_fplookup_final (struct cache_fpl *fpl)
 
static int __noinline cache_fplookup_degenerate (struct cache_fpl *fpl)
 
static int __noinline cache_fplookup_emptypath (struct cache_fpl *fpl)
 
static int __noinline cache_fplookup_noentry (struct cache_fpl *fpl)
 
static int __noinline cache_fplookup_dot (struct cache_fpl *fpl)
 
static int __noinline cache_fplookup_dotdot (struct cache_fpl *fpl)
 
static int __noinline cache_fplookup_neg (struct cache_fpl *fpl, struct namecache *ncp, uint32_t hash)
 
int cache_symlink_resolve (struct cache_fpl *fpl, const char *string, size_t len)
 
static int __noinline cache_fplookup_symlink (struct cache_fpl *fpl)
 
static int cache_fplookup_next (struct cache_fpl *fpl)
 
static int __noinline cache_fplookup_climb_mount (struct cache_fpl *fpl)
 
static void cache_fplookup_parse (struct cache_fpl *fpl)
 
static void cache_fplookup_parse_advance (struct cache_fpl *fpl)
 
static int __noinline cache_fplookup_failed_vexec (struct cache_fpl *fpl, int error)
 
static int cache_fplookup_impl (struct vnode *dvp, struct cache_fpl *fpl)
 
int cache_fplookup (struct nameidata *ndp, enum cache_fpl_status *status, struct pwd **pwdp)
 

Variables

static char __read_frequently cache_fast_lookup_enabled = true
 
 VFS_SMR_DECLARE
 
static u_int __read_mostly ncsize
 
u_int ncsizefactor = 2
 
static u_long __read_mostly ncnegfactor = 5
 
static u_int ncnegminpct = 3
 
static u_int __read_mostly neg_min
 
static struct neglist neglists [numneglists]
 
static u_int __read_mostly ncbuckethash
 
static struct mtx_padalign __read_mostlybucketlocks
 
static u_int __read_mostly ncvnodehash
 
static struct mtx __read_mostlyvnodelocks
 
static long zap_bucket_fail
 
static long zap_bucket_fail2
 
static long cache_lock_vnodes_cel_3_failures
 
static uma_zone_t __read_mostly cache_zone_small
 
static uma_zone_t __read_mostly cache_zone_small_ts
 
static uma_zone_t __read_mostly cache_zone_large
 
static uma_zone_t __read_mostly cache_zone_large_ts
 
static int cache_fast_lookup = 1
 

Macro Definition Documentation

◆ cache_assert_bucket_locked

#define cache_assert_bucket_locked (   x)    do { } while (0)

Definition at line 880 of file vfs_cache.c.

◆ cache_assert_bucket_unlocked

#define cache_assert_bucket_unlocked (   x)    do { } while (0)

Definition at line 881 of file vfs_cache.c.

◆ cache_fpl_aborted

#define cache_fpl_aborted (   x)    cache_fpl_aborted_impl((x), __LINE__)

Definition at line 4129 of file vfs_cache.c.

◆ cache_fpl_aborted_early

#define cache_fpl_aborted_early (   x)    cache_fpl_aborted_early_impl((x), __LINE__)

Definition at line 4097 of file vfs_cache.c.

◆ cache_fpl_assert_status

#define cache_fpl_assert_status (   fpl)    do { } while (0)

Definition at line 4059 of file vfs_cache.c.

◆ CACHE_FPL_FAILED

#define CACHE_FPL_FAILED   -2020

Definition at line 3863 of file vfs_cache.c.

◆ cache_fpl_handled

#define cache_fpl_handled (   x)    cache_fpl_handled_impl((x), __LINE__)

Definition at line 4159 of file vfs_cache.c.

◆ cache_fpl_handled_error

#define cache_fpl_handled_error (   x,
 
)    cache_fpl_handled_error_impl((x), (e), __LINE__)

Definition at line 4179 of file vfs_cache.c.

◆ CACHE_FPL_INTERNAL_CN_FLAGS

#define CACHE_FPL_INTERNAL_CN_FLAGS    (ISDOTDOT | MAKEENTRY | ISLASTCN)

Definition at line 4194 of file vfs_cache.c.

◆ cache_fpl_neg_ncp_canuse

#define cache_fpl_neg_ncp_canuse (   ncp)
Value:
({ \
struct namecache *_ncp = (ncp); \
u_char _nc_flag; \
\
atomic_thread_fence_acq(); \
_nc_flag = atomic_load_char(&_ncp->nc_flag); \
__predict_true((_nc_flag & (NCF_INVALID | NCF_WIP | NCF_WHITE)) == 0); \
})
#define NCF_WIP
Definition: vfs_cache.c:355
#define NCF_WHITE
Definition: vfs_cache.c:348
#define NCF_INVALID
Definition: vfs_cache.c:354

Definition at line 397 of file vfs_cache.c.

◆ cache_fpl_partial

#define cache_fpl_partial (   x)    cache_fpl_partial_impl((x), __LINE__)

Definition at line 4144 of file vfs_cache.c.

◆ cache_fpl_smr_assert_entered

#define cache_fpl_smr_assert_entered (   fpl)    do { } while (0)

Definition at line 4057 of file vfs_cache.c.

◆ cache_fpl_smr_assert_not_entered

#define cache_fpl_smr_assert_not_entered (   fpl)    do { } while (0)

Definition at line 4058 of file vfs_cache.c.

◆ cache_fpl_smr_enter

#define cache_fpl_smr_enter (   fpl)
Value:
({ \
struct cache_fpl *_fpl = (fpl); \
MPASS(_fpl->in_smr == false); \
vfs_smr_enter(); \
_fpl->in_smr = true; \
})

Definition at line 4068 of file vfs_cache.c.

◆ cache_fpl_smr_enter_initial

#define cache_fpl_smr_enter_initial (   fpl)
Value:
({ \
struct cache_fpl *_fpl = (fpl); \
vfs_smr_enter(); \
_fpl->in_smr = true; \
})

Definition at line 4062 of file vfs_cache.c.

◆ cache_fpl_smr_exit

#define cache_fpl_smr_exit (   fpl)
Value:
({ \
struct cache_fpl *_fpl = (fpl); \
MPASS(_fpl->in_smr == true); \
vfs_smr_exit(); \
_fpl->in_smr = false; \
})

Definition at line 4075 of file vfs_cache.c.

◆ CACHE_FPL_SUPPORTED_CN_FLAGS

#define CACHE_FPL_SUPPORTED_CN_FLAGS
Value:
(NC_NOMAKEENTRY | NC_KEEPPOSENTRY | LOCKLEAF | LOCKPARENT | WANTPARENT | \
FAILIFEXISTS | FOLLOW | EMPTYPATH | LOCKSHARED | SAVENAME | SAVESTART | \
WILLBEDIR | ISOPEN | NOMACCHECK | AUDITVNODE1 | AUDITVNODE2 | NOCAPCHECK | \
OPENREAD | OPENWRITE)

Definition at line 4188 of file vfs_cache.c.

◆ CACHE_LARGE_PAD

#define CACHE_LARGE_PAD   2

Definition at line 329 of file vfs_cache.c.

◆ cache_ncp_canuse

#define cache_ncp_canuse (   ncp)
Value:
({ \
struct namecache *_ncp = (ncp); \
u_char _nc_flag; \
\
atomic_thread_fence_acq(); \
_nc_flag = atomic_load_char(&_ncp->nc_flag); \
__predict_true((_nc_flag & (NCF_INVALID | NCF_WIP)) == 0); \
})

Definition at line 385 of file vfs_cache.c.

◆ cache_neg_hit_abort

#define cache_neg_hit_abort (   ncp)    do { } while (0)

Definition at line 1222 of file vfs_cache.c.

◆ CACHE_NEG_PROMOTION_THRESH

#define CACHE_NEG_PROMOTION_THRESH   2

Definition at line 1198 of file vfs_cache.c.

◆ CACHE_PATH_CUTOFF

#define CACHE_PATH_CUTOFF   41

Definition at line 328 of file vfs_cache.c.

◆ cache_rev_failed

#define cache_rev_failed (   var)    cache_rev_failed_impl((var), __LINE__)

Definition at line 3436 of file vfs_cache.c.

◆ cache_sort_vnodes

#define cache_sort_vnodes (   x,
 
)    _cache_sort_vnodes((void **)(x), (void **)(y))

Definition at line 884 of file vfs_cache.c.

◆ CACHE_ZONE_ALIGNMENT

#define CACHE_ZONE_ALIGNMENT   UMA_ALIGNOF(time_t)

Definition at line 309 of file vfs_cache.c.

◆ CACHE_ZONE_LARGE_SIZE

#define CACHE_ZONE_LARGE_SIZE   (offsetof(struct namecache, nc_name) + NAME_MAX + 1 + CACHE_LARGE_PAD)

Definition at line 334 of file vfs_cache.c.

◆ CACHE_ZONE_LARGE_TS_SIZE

#define CACHE_ZONE_LARGE_TS_SIZE   (offsetof(struct namecache_ts, nc_nc) + CACHE_ZONE_LARGE_SIZE)

Definition at line 335 of file vfs_cache.c.

◆ CACHE_ZONE_SMALL_SIZE

#define CACHE_ZONE_SMALL_SIZE   (offsetof(struct namecache, nc_name) + CACHE_PATH_CUTOFF + 1)

Definition at line 332 of file vfs_cache.c.

◆ CACHE_ZONE_SMALL_TS_SIZE

#define CACHE_ZONE_SMALL_TS_SIZE   (offsetof(struct namecache_ts, nc_nc) + CACHE_ZONE_SMALL_SIZE)

Definition at line 333 of file vfs_cache.c.

◆ DEBUGNODE_COUNTER

#define DEBUGNODE_COUNTER (   name,
  varname,
  descr 
)
Value:
static COUNTER_U64_DEFINE_EARLY(varname); \
SYSCTL_COUNTER_U64(_vfs_cache_debug, OID_AUTO, name, CTLFLAG_RD, &varname, \
descr);
const char * name
Definition: kern_fail.c:145
static COUNTER_U64_DEFINE_EARLY(neg_created)

Definition at line 567 of file vfs_cache.c.

◆ DEBUGNODE_ULONG

#define DEBUGNODE_ULONG (   name,
  varname,
  descr 
)     SYSCTL_ULONG(_vfs_cache_debug, OID_AUTO, name, CTLFLAG_RD, &varname, 0, descr);

Definition at line 565 of file vfs_cache.c.

◆ HASH2BUCKETLOCK

#define HASH2BUCKETLOCK (   hash)     ((struct mtx *)(&bucketlocks[((hash) & ncbuckethash)]))

Definition at line 485 of file vfs_cache.c.

◆ nc_neg

#define nc_neg   n_un.nu_neg

Definition at line 343 of file vfs_cache.c.

◆ nc_vp

#define nc_vp   n_un.nu_vp

Definition at line 342 of file vfs_cache.c.

◆ NCF_DTS

#define NCF_DTS   0x08

Definition at line 351 of file vfs_cache.c.

◆ NCF_DVDROP

#define NCF_DVDROP   0x10

Definition at line 352 of file vfs_cache.c.

◆ NCF_INVALID

#define NCF_INVALID   0x40

Definition at line 354 of file vfs_cache.c.

◆ NCF_ISDOTDOT

#define NCF_ISDOTDOT   0x02

Definition at line 349 of file vfs_cache.c.

◆ NCF_NEGATIVE

#define NCF_NEGATIVE   0x20

Definition at line 353 of file vfs_cache.c.

◆ NCF_TS

#define NCF_TS   0x04

Definition at line 350 of file vfs_cache.c.

◆ NCF_WHITE

#define NCF_WHITE   0x01

Definition at line 348 of file vfs_cache.c.

◆ NCF_WIP

#define NCF_WIP   0x80

Definition at line 355 of file vfs_cache.c.

◆ NCHHASH

#define NCHHASH (   hash)     (&nchashtbl[(hash) & nchash])

Definition at line 437 of file vfs_cache.c.

◆ ncneghash

#define ncneghash   3

◆ NEG_HOT

#define NEG_HOT   0x01

Definition at line 360 of file vfs_cache.c.

◆ numbucketlocks

#define numbucketlocks   (ncbuckethash + 1)

Definition at line 482 of file vfs_cache.c.

◆ numneglists

#define numneglists   (ncneghash + 1)

◆ numvnodelocks

#define numvnodelocks   (ncvnodehash + 1)

Definition at line 488 of file vfs_cache.c.

◆ STATNODE_COUNTER

#define STATNODE_COUNTER (   name,
  varname,
  descr 
)
Value:
static COUNTER_U64_DEFINE_EARLY(varname); \
SYSCTL_COUNTER_U64(_vfs_cache_stats, OID_AUTO, name, CTLFLAG_RD, &varname, \
descr);

Definition at line 533 of file vfs_cache.c.

◆ STATNODE_ULONG

#define STATNODE_ULONG (   name,
  varname,
  descr 
)     SYSCTL_ULONG(_vfs_cache_stats, OID_AUTO, name, CTLFLAG_RD, &varname, 0, descr);

Definition at line 531 of file vfs_cache.c.

Function Documentation

◆ __aligned()

__aligned ( CACHE_LINE_SIZE  )

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ _cache_sort_vnodes()

static void _cache_sort_vnodes ( void **  p1,
void **  p2 
)
static

Definition at line 886 of file vfs_cache.c.

◆ _Static_assert() [1/6]

_Static_assert ( (CACHE_FPL_SUPPORTED_CN_FLAGS &CACHE_FPL_INTERNAL_CN_FLAGS = =0,
"supported and internal flags overlap"   
)

◆ _Static_assert() [2/6]

_Static_assert ( (CACHE_ZONE_LARGE_SIZE %(CACHE_ZONE_ALIGNMENT+1))  = =0,
"bad zone size"   
)

◆ _Static_assert() [3/6]

_Static_assert ( (CACHE_ZONE_LARGE_TS_SIZE %(CACHE_ZONE_ALIGNMENT+1))  = =0,
"bad zone size"   
)

◆ _Static_assert() [4/6]

_Static_assert ( (CACHE_ZONE_SMALL_SIZE %(CACHE_ZONE_ALIGNMENT+1))  = =0,
"bad zone size"   
)

◆ _Static_assert() [5/6]

_Static_assert ( (CACHE_ZONE_SMALL_TS_SIZE %(CACHE_ZONE_ALIGNMENT+1))  = =0,
"bad zone size"   
)

◆ _Static_assert() [6/6]

_Static_assert ( sizeof(struct negstate)<=sizeof(struct vnode *)  ,
"the state must fit in a union with a pointer without growing it"   
)

◆ cache_alloc()

static struct namecache * cache_alloc ( int  len,
bool  ts 
)
static

Definition at line 721 of file vfs_cache.c.

References cache_alloc_uma(), cache_neg_evict_cond(), ncsize, and ts.

Referenced by cache_enter_time().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_alloc_uma()

static struct namecache * cache_alloc_uma ( int  len,
bool  ts 
)
static

Definition at line 681 of file vfs_cache.c.

References CACHE_PATH_CUTOFF, cache_zone_large, cache_zone_large_ts, cache_zone_small, cache_zone_small_ts, namecache_ts::nc_nc, and ts.

Referenced by cache_alloc().

Here is the caller graph for this function:

◆ cache_assert_vlp_locked()

static void cache_assert_vlp_locked ( struct mtx vlp)
inlinestatic

Definition at line 592 of file vfs_cache.c.

Referenced by cache_assert_vnode_locked(), and cache_lock_vnodes_cel_3().

Here is the caller graph for this function:

◆ cache_assert_vnode_locked()

static void cache_assert_vnode_locked ( struct vnode *  vp)
inlinestatic

Definition at line 600 of file vfs_cache.c.

References cache_assert_vlp_locked(), mtx, and VP2VNODELOCK().

Referenced by cache_hold_vnode(), cache_zap_locked(), cache_zap_locked_vnode_kl2(), cache_zap_negative_locked_vnode_kl(), and vn_dd_from_dst().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_can_fplookup()

static bool cache_can_fplookup ( struct cache_fpl fpl)
static

Definition at line 4226 of file vfs_cache.c.

References cache_fast_lookup_enabled, cache_fpl_aborted_early, CACHE_FPL_SUPPORTED_CN_FLAGS, cache_fpl::cnp, and cache_fpl::ndp.

Referenced by cache_fplookup().

Here is the caller graph for this function:

◆ cache_celockstate_init()

static void cache_celockstate_init ( struct celockstate cel)
inlinestatic

Definition at line 2137 of file vfs_cache.c.

Referenced by cache_enter_dotdot_prep(), and cache_enter_time().

Here is the caller graph for this function:

◆ cache_changesize()

void cache_changesize ( u_long  newmaxvnodes)

◆ cache_changesize_set_new()

static void cache_changesize_set_new ( struct nchashhead *  new_tbl,
u_long  new_hash 
)
static

Definition at line 2742 of file vfs_cache.c.

Referenced by cache_changesize().

Here is the caller graph for this function:

◆ cache_changesize_set_temp()

static void cache_changesize_set_temp ( struct nchashhead *  temptbl,
u_long  temphash 
)
static

Definition at line 2710 of file vfs_cache.c.

Referenced by cache_changesize().

Here is the caller graph for this function:

◆ cache_drop_vnode()

static void cache_drop_vnode ( struct vnode *  vp)
static

Definition at line 627 of file vfs_cache.c.

References vdrop().

Referenced by cache_free(), and cache_free_batch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_enter_dotdot_prep()

static void __noinline cache_enter_dotdot_prep ( struct vnode *  dvp,
struct vnode *  vp,
struct componentname *  cnp 
)
static

Definition at line 2345 of file vfs_cache.c.

References cache_celockstate_init(), cache_enter_lock_dd(), cache_enter_unlock(), cache_free(), cache_get_hash(), cache_zap_locked(), namecache::nc_flag, and NCF_ISDOTDOT.

Referenced by cache_enter_time().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_enter_lock()

static void cache_enter_lock ( struct celockstate cel,
struct vnode *  dvp,
struct vnode *  vp,
uint32_t  hash 
)
static

Definition at line 2257 of file vfs_cache.c.

References cache_lock_buckets_cel(), cache_lock_vnodes_cel(), cache_lock_vnodes_cel_3(), cache_unlock_vnodes_cel(), HASH2BUCKETLOCK, mtx, namecache::nc_flag, NCF_ISDOTDOT, NCF_NEGATIVE, NCP2BUCKETLOCK(), celockstate::vlp, and VP2VNODELOCK().

Referenced by cache_enter_time().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_enter_lock_dd()

static void cache_enter_lock_dd ( struct celockstate cel,
struct vnode *  dvp,
struct vnode *  vp,
uint32_t  hash 
)
static

Definition at line 2300 of file vfs_cache.c.

References cache_lock_buckets_cel(), cache_lock_vnodes_cel(), cache_lock_vnodes_cel_3(), cache_unlock_vnodes_cel(), HASH2BUCKETLOCK, mtx, namecache::nc_flag, NCF_ISDOTDOT, NCF_NEGATIVE, NCP2BUCKETLOCK(), celockstate::vlp, and VP2VNODELOCK().

Referenced by cache_enter_dotdot_prep().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_enter_time()

void cache_enter_time ( struct vnode *  dvp,
struct vnode *  vp,
struct componentname *  cnp,
struct timespec *  tsp,
struct timespec *  dtsp 
)

◆ cache_enter_time_flags()

void cache_enter_time_flags ( struct vnode *  dvp,
struct vnode *  vp,
struct componentname *  cnp,
struct timespec *  tsp,
struct timespec *  dtsp,
int  flags 
)

Definition at line 2597 of file vfs_cache.c.

References cache_enter_time(), cache_remove_cnp(), and flags.

Here is the call graph for this function:

◆ cache_enter_unlock()

static void cache_enter_unlock ( struct celockstate cel)
static

Definition at line 2337 of file vfs_cache.c.

References cache_unlock_buckets_cel(), and cache_unlock_vnodes_cel().

Referenced by cache_enter_dotdot_prep(), and cache_enter_time().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_fast_lookup_enabled_recalc()

void cache_fast_lookup_enabled_recalc ( void  )

Definition at line 3866 of file vfs_cache.c.

References cache_fast_lookup, and cache_fast_lookup_enabled.

Referenced by syscal_vfs_cache_fast_lookup().

Here is the caller graph for this function:

◆ cache_fpl_aborted_early_impl()

static int cache_fpl_aborted_early_impl ( struct cache_fpl fpl,
int  line 
)
static

◆ cache_fpl_aborted_impl()

static int __noinline cache_fpl_aborted_impl ( struct cache_fpl fpl,
int  line 
)
static

◆ cache_fpl_checkpoint()

static void cache_fpl_checkpoint ( struct cache_fpl fpl)
static

Definition at line 3998 of file vfs_cache.c.

References cache_fpl::ndp, and cache_fpl::snd.

Referenced by cache_fplookup_impl(), cache_fplookup_symlink(), and cache_fplookup_trailingslash().

Here is the caller graph for this function:

◆ cache_fpl_checkpoint_outer()

static void cache_fpl_checkpoint_outer ( struct cache_fpl fpl)
static

Definition at line 3990 of file vfs_cache.c.

References nameidata_outer::cn_flags, cache_fpl::ndp, nameidata_outer::ni_pathlen, and cache_fpl::snd_outer.

Referenced by cache_fplookup().

Here is the caller graph for this function:

◆ cache_fpl_cleanup_cnp()

static void cache_fpl_cleanup_cnp ( struct componentname *  cnp)
static

Definition at line 3956 of file vfs_cache.c.

References namei_zone.

Referenced by cache_fpl_aborted_impl(), and cache_fplookup().

Here is the caller graph for this function:

◆ cache_fpl_handle_root()

static struct vnode * cache_fpl_handle_root ( struct cache_fpl fpl)
static

Definition at line 3967 of file vfs_cache.c.

References cache_fpl_pathlen_dec(), cache_fpl::cnp, and cache_fpl::ndp.

Referenced by cache_fplookup(), and cache_fplookup_symlink().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_fpl_handled_error_impl()

static int cache_fpl_handled_error_impl ( struct cache_fpl fpl,
int  error,
int  line 
)
static

◆ cache_fpl_handled_impl()

static int cache_fpl_handled_impl ( struct cache_fpl fpl,
int  line 
)
static

◆ cache_fpl_isdotdot()

static bool cache_fpl_isdotdot ( struct componentname *  cnp)
static

Definition at line 4216 of file vfs_cache.c.

Referenced by cache_fplookup_dotdot(), cache_fplookup_final_modifying(), cache_fplookup_next(), cache_fplookup_noentry(), and cache_fplookup_partial_setup().

Here is the caller graph for this function:

◆ cache_fpl_islastcn()

static bool cache_fpl_islastcn ( struct nameidata *  ndp)
static

◆ cache_fpl_istrailingslash()

static bool cache_fpl_istrailingslash ( struct cache_fpl fpl)
static

◆ cache_fpl_partial_impl()

static int __noinline cache_fpl_partial_impl ( struct cache_fpl fpl,
int  line 
)
static

Definition at line 4132 of file vfs_cache.c.

References cache_fpl_smr_assert_entered, cache_fplookup_partial_setup(), cache_fpl::line, and cache_fpl::status.

Here is the call graph for this function:

◆ cache_fpl_pathlen_add()

static void cache_fpl_pathlen_add ( struct cache_fpl fpl,
size_t  n 
)
static

Definition at line 5519 of file vfs_cache.c.

Referenced by cache_fplookup_trailingslash(), and cache_symlink_resolve().

Here is the caller graph for this function:

◆ cache_fpl_pathlen_dec()

static void cache_fpl_pathlen_dec ( struct cache_fpl fpl)
static

Definition at line 5534 of file vfs_cache.c.

Referenced by cache_fpl_handle_root(), cache_fplookup_parse_advance(), cache_fplookup_partial_setup(), and cache_fplookup_skip_slashes().

Here is the caller graph for this function:

◆ cache_fpl_pathlen_inc()

static void cache_fpl_pathlen_inc ( struct cache_fpl fpl)
static

Definition at line 5529 of file vfs_cache.c.

Referenced by cache_fplookup_skip_slashes().

Here is the caller graph for this function:

◆ cache_fpl_pathlen_sub()

static void cache_fpl_pathlen_sub ( struct cache_fpl fpl,
size_t  n 
)
static

Definition at line 5524 of file vfs_cache.c.

Referenced by cache_fplookup_parse().

Here is the caller graph for this function:

◆ cache_fpl_restore_abort()

static void cache_fpl_restore_abort ( struct cache_fpl fpl)
static

Definition at line 4018 of file vfs_cache.c.

References cache_fpl_restore_partial(), cache_fpl::ndp, nameidata_outer::ni_pathlen, and cache_fpl::snd_outer.

Referenced by cache_fpl_aborted_impl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_fpl_restore_partial()

static void cache_fpl_restore_partial ( struct cache_fpl fpl)
static

Definition at line 4008 of file vfs_cache.c.

References nameidata_outer::cn_flags, cache_fpl::ndp, cache_fpl::snd, and cache_fpl::snd_outer.

Referenced by cache_fpl_restore_abort(), and cache_fplookup_partial_setup().

Here is the caller graph for this function:

◆ cache_fpl_terminated()

static bool cache_fpl_terminated ( struct cache_fpl fpl)
static

Definition at line 4182 of file vfs_cache.c.

References cache_fpl::status.

Referenced by cache_fplookup_impl().

Here is the caller graph for this function:

◆ cache_fplookup()

◆ cache_fplookup_climb_mount()

static int __noinline cache_fplookup_climb_mount ( struct cache_fpl fpl)
static

Definition at line 5352 of file vfs_cache.c.

References cache_fpl_partial, cache_fplookup_mp_supported(), cache_fpl::tvp, and cache_fpl::tvp_seqc.

Referenced by cache_fplookup_cross_mount().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_fplookup_cross_mount()

static int __noinline cache_fplookup_cross_mount ( struct cache_fpl fpl)
static

Definition at line 5409 of file vfs_cache.c.

References cache_fpl_partial, cache_fplookup_climb_mount(), cache_fplookup_mp_supported(), cache_fpl::tvp, and cache_fpl::tvp_seqc.

Referenced by cache_fplookup_dot(), and cache_fplookup_next().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_fplookup_degenerate()

static int __noinline cache_fplookup_degenerate ( struct cache_fpl fpl)
static

◆ cache_fplookup_dirfd()

static int __noinline cache_fplookup_dirfd ( struct cache_fpl fpl,
struct vnode **  vpp 
)
static

Definition at line 4260 of file vfs_cache.c.

References cache_fpl_aborted, cache_fpl_handled_error, cache_fpl_smr_exit, cache_fpl::cnp, fgetvp_lookup_smr(), cache_fpl::fsearch, and cache_fpl::ndp.

Referenced by cache_fplookup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_fplookup_dot()

static int __noinline cache_fplookup_dot ( struct cache_fpl fpl)
static

Definition at line 4994 of file vfs_cache.c.

References cache_fplookup_cross_mount(), cache_fplookup_is_mp(), cache_fpl::dvp, cache_fpl::dvp_seqc, cache_fpl::tvp, and cache_fpl::tvp_seqc.

Referenced by cache_fplookup_next().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_fplookup_dotdot()

static int __noinline cache_fplookup_dotdot ( struct cache_fpl fpl)
static

Definition at line 5018 of file vfs_cache.c.

References cache_fpl_aborted, cache_fpl_isdotdot(), cache_fpl_partial, cache_ncp_canuse, cache_fpl::cnp, cache_fpl::dvp, namecache::nc_flag, NCF_ISDOTDOT, NCF_NEGATIVE, cache_fpl::ndp, pr, rootvnode, cache_fpl::tvp, and cache_fpl::tvp_seqc.

Referenced by cache_fplookup_next().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_fplookup_emptypath()

static int __noinline cache_fplookup_emptypath ( struct cache_fpl fpl)
static

◆ cache_fplookup_failed_vexec()

static int __noinline cache_fplookup_failed_vexec ( struct cache_fpl fpl,
int  error 
)
static

◆ cache_fplookup_final()

static int cache_fplookup_final ( struct cache_fpl fpl)
static

◆ cache_fplookup_final_child()

static int cache_fplookup_final_child ( struct cache_fpl fpl,
enum vgetstate  tvs 
)
static

Definition at line 4386 of file vfs_cache.c.

References cache_fpl_aborted, cache_fpl_handled, cache_fpl::cnp, cache_fpl::tvp, cache_fpl::tvp_seqc, vget_finish(), vget_finish_ref(), vput(), and vrele().

Referenced by cache_fplookup_final(), and cache_fplookup_final_withparent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_fplookup_final_modifying()

static int __noinline cache_fplookup_final_modifying ( struct cache_fpl fpl)
static

◆ cache_fplookup_final_withparent()

static int __noinline cache_fplookup_final_withparent ( struct cache_fpl fpl)
static

◆ cache_fplookup_impl()

static int cache_fplookup_impl ( struct vnode *  dvp,
struct cache_fpl fpl 
)
static

◆ cache_fplookup_is_mp()

static bool cache_fplookup_is_mp ( struct cache_fpl fpl)
static

Definition at line 5465 of file vfs_cache.c.

References cache_fpl::tvp.

Referenced by cache_fplookup_dot(), cache_fplookup_final_modifying(), cache_fplookup_next(), and cache_fplookup_noentry().

Here is the caller graph for this function:

◆ cache_fplookup_modifying()

static int __noinline cache_fplookup_modifying ( struct cache_fpl fpl)
static

Definition at line 4615 of file vfs_cache.c.

References cache_fpl_islastcn(), cache_fpl_partial, cache_fplookup_final_modifying(), and cache_fpl::ndp.

Referenced by cache_fplookup_neg(), and cache_fplookup_noentry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_fplookup_mp_supported()

static bool cache_fplookup_mp_supported ( struct mount *  mp)
static

Definition at line 5324 of file vfs_cache.c.

Referenced by cache_fplookup_climb_mount(), cache_fplookup_cross_mount(), cache_fplookup_impl(), and cache_fplookup_symlink().

Here is the caller graph for this function:

◆ cache_fplookup_neg()

static int __noinline cache_fplookup_neg ( struct cache_fpl fpl,
struct namecache ncp,
uint32_t  hash 
)
static

◆ cache_fplookup_negative_promote()

static int __noinline cache_fplookup_negative_promote ( struct cache_fpl fpl,
struct namecache oncp,
uint32_t  hash 
)
static

Definition at line 4285 of file vfs_cache.c.

References cache_fpl_aborted, cache_fpl_handled_error, cache_fpl_smr_exit, cache_neg_promote_cond(), cache_fpl::cnp, and cache_fpl::dvp.

Referenced by cache_fplookup_neg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_fplookup_next()

◆ cache_fplookup_noentry()

◆ cache_fplookup_parse()

static void cache_fplookup_parse ( struct cache_fpl fpl)
static

Definition at line 5540 of file vfs_cache.c.

References cache_fpl_pathlen_sub(), cache_get_hash(), cache_get_hash_iter(), cache_get_hash_iter_finish(), cache_get_hash_iter_start(), cache_fpl::cnp, cache_fpl::dvp, cache_fpl::hash, cache_fpl::ndp, cache_fpl::nulchar, and panic().

Referenced by cache_fplookup_impl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_fplookup_parse_advance()

static void cache_fplookup_parse_advance ( struct cache_fpl fpl)
static

Definition at line 5607 of file vfs_cache.c.

References cache_fpl_pathlen_dec(), cache_fpl::cnp, and cache_fpl::ndp.

Referenced by cache_fplookup_impl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_fplookup_partial_setup()

static int __noinline cache_fplookup_partial_setup ( struct cache_fpl fpl)
static

◆ cache_fplookup_skip_slashes()

static int __noinline cache_fplookup_skip_slashes ( struct cache_fpl fpl)
static

Definition at line 5633 of file vfs_cache.c.

References cache_fpl_pathlen_dec(), cache_fpl_pathlen_inc(), cache_fpl::cnp, cache_fpl::dvp, cache_fpl::dvp_seqc, cache_fpl::ndp, cache_fpl::tvp, and cache_fpl::tvp_seqc.

Referenced by cache_fplookup_noentry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_fplookup_symlink()

static int __noinline cache_fplookup_symlink ( struct cache_fpl fpl)
static

◆ cache_fplookup_trailingslash()

static int __noinline cache_fplookup_trailingslash ( struct cache_fpl fpl)
static

◆ cache_free()

static void cache_free ( struct namecache ncp)
static

Definition at line 750 of file vfs_cache.c.

References cache_drop_vnode(), cache_free_uma(), namecache::nc_flag, and NCF_DVDROP.

Referenced by cache_enter_dotdot_prep(), cache_enter_time(), cache_lookup_dotdot(), cache_lookup_fallback(), cache_neg_evict(), and cache_remove_cnp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_free_batch()

static void cache_free_batch ( struct cache_freebatch *  batch)
static

Definition at line 762 of file vfs_cache.c.

References cache_drop_vnode(), cache_free_uma(), namecache::nc_flag, and NCF_DVDROP.

Referenced by cache_purge_impl(), and cache_purge_negative().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_free_uma()

static void cache_free_uma ( struct namecache ncp)
static

Definition at line 702 of file vfs_cache.c.

References CACHE_PATH_CUTOFF, cache_zone_large, cache_zone_large_ts, cache_zone_small, cache_zone_small_ts, namecache::nc_flag, namecache_ts::nc_nc, namecache::nc_nlen, and NCF_TS.

Referenced by cache_free(), and cache_free_batch().

Here is the caller graph for this function:

◆ cache_get_hash()

static uint32_t cache_get_hash ( char *  name,
u_char  len,
struct vnode *  dvp 
)
static

◆ cache_get_hash_iter()

static uint32_t cache_get_hash_iter ( char  c,
uint32_t  hash 
)
static

Definition at line 830 of file vfs_cache.c.

Referenced by cache_fplookup_parse().

Here is the caller graph for this function:

◆ cache_get_hash_iter_finish()

static uint32_t cache_get_hash_iter_finish ( uint32_t  hash)
static

Definition at line 837 of file vfs_cache.c.

Referenced by cache_fplookup_parse().

Here is the caller graph for this function:

◆ cache_get_hash_iter_start()

static uint32_t cache_get_hash_iter_start ( struct vnode *  dvp)
static

Definition at line 823 of file vfs_cache.c.

Referenced by cache_fplookup_parse().

Here is the caller graph for this function:

◆ cache_has_entries()

static bool cache_has_entries ( struct vnode *  vp)
static

Definition at line 2862 of file vfs_cache.c.

Referenced by cache_purge(), cache_purge_vgone(), and cache_purgevfs().

Here is the caller graph for this function:

◆ cache_hold_vnode()

static void cache_hold_vnode ( struct vnode *  vp)
static

Definition at line 617 of file vfs_cache.c.

References cache_assert_vnode_locked(), and vhold().

Referenced by cache_enter_time().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_lock_all_buckets()

static void cache_lock_all_buckets ( void  )
static

Definition at line 900 of file vfs_cache.c.

References bucketlocks, and numbucketlocks.

Referenced by cache_changesize().

Here is the caller graph for this function:

◆ cache_lock_all_vnodes()

static void cache_lock_all_vnodes ( void  )
static

Definition at line 918 of file vfs_cache.c.

References numvnodelocks, and vnodelocks.

Referenced by cache_changesize().

Here is the caller graph for this function:

◆ cache_lock_buckets_cel()

static void cache_lock_buckets_cel ( struct celockstate cel,
struct mtx blp1,
struct mtx blp2 
)
static

Definition at line 2220 of file vfs_cache.c.

References celockstate::blp, and cache_sort_vnodes.

Referenced by cache_enter_lock(), and cache_enter_lock_dd().

Here is the caller graph for this function:

◆ cache_lock_vnodes()

static void cache_lock_vnodes ( struct mtx vlp1,
struct mtx vlp2 
)
static

Definition at line 955 of file vfs_cache.c.

Referenced by cache_zap_unlocked_bucket().

Here is the caller graph for this function:

◆ cache_lock_vnodes_cel()

static void cache_lock_vnodes_cel ( struct celockstate cel,
struct vnode *  vp,
struct vnode *  dvp 
)
static

Definition at line 2144 of file vfs_cache.c.

References cache_sort_vnodes, mtx, celockstate::vlp, and VP2VNODELOCK().

Referenced by cache_enter_lock(), and cache_enter_lock_dd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_lock_vnodes_cel_3()

static bool cache_lock_vnodes_cel_3 ( struct celockstate cel,
struct vnode *  vp 
)
static

Definition at line 2182 of file vfs_cache.c.

References cache_assert_vlp_locked(), cache_lock_vnodes_cel_3_failures, cache_unlock_vnodes_cel(), mtx, celockstate::vlp, and VP2VNODELOCK().

Referenced by cache_enter_lock(), and cache_enter_lock_dd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_lookup()

int cache_lookup ( struct vnode *  dvp,
struct vnode **  vpp,
struct componentname *  cnp,
struct timespec *  tsp,
int *  ticksp 
)

◆ cache_lookup_dot()

static int __noinline cache_lookup_dot ( struct vnode *  dvp,
struct vnode **  vpp,
struct componentname *  cnp,
struct timespec *  tsp,
int *  ticksp 
)
static

Definition at line 1788 of file vfs_cache.c.

References ticks, vrefact(), and vrele().

Referenced by cache_lookup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_lookup_dotdot()

static int __noinline cache_lookup_dotdot ( struct vnode *  dvp,
struct vnode **  vpp,
struct componentname *  cnp,
struct timespec *  tsp,
int *  ticksp 
)
static

◆ cache_lookup_fallback()

static int __noinline cache_lookup_fallback ( struct vnode *  dvp,
struct vnode **  vpp,
struct componentname *  cnp,
struct timespec *  tsp,
int *  ticksp 
)
static

Lookup a name in the name cache

Arguments

  • dvp: Parent directory in which to search.
  • vpp: Return argument. Will contain desired vnode on cache hit.
  • cnp: Parameters of the name search. The most interesting bits of the cn_flags field have the following meanings:
    • MAKEENTRY: If clear, free an entry from the cache rather than look it up.
    • ISDOTDOT: Must be set if and only if cn_nameptr == ".."
  • tsp: Return storage for cache timestamp. On a successful (positive or negative) lookup, tsp will be filled with any timespec that was stored when this cache entry was created. However, it will be clear for "." entries.
  • ticks: Return storage for alternate cache timestamp. On a successful (positive or negative) lookup, it will contain the ticks value that was current when the cache entry was created, unless cnp was ".".

Either both tsp and ticks have to be provided or neither of them.

Returns

  • -1: A positive cache hit. vpp will contain the desired vnode.
  • ENOENT: A negative cache hit, or dvp was recycled out from under us due to a forced unmount. vpp will not be modified. If the entry is a whiteout, then the ISWHITEOUT flag will be set in cnp->cn_flags.
  • 0: A cache miss. vpp will not be modified.

Locking

On a cache hit, vpp will be returned locked and ref'd. If we're looking up .., dvp is unlocked. If we're looking up . an extra ref is taken, but the lock is not recursively acquired.

Definition at line 1946 of file vfs_cache.c.

References cache_free(), cache_get_hash(), cache_neg_hit_finish(), cache_neg_hit_prep(), cache_neg_promote(), cache_out_ts(), cache_zap_locked_bucket(), HASH2BUCKETLOCK, mtx, namecache::nc_flag, namecache::nc_name, namecache::nc_nlen, NCF_NEGATIVE, NCF_WHITE, NCHHASH, vget_finish(), vget_prep(), and zap_bucket_fail2.

Referenced by cache_lookup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_ncp_invalidate()

static void cache_ncp_invalidate ( struct namecache ncp)
static

Definition at line 370 of file vfs_cache.c.

References namecache::nc_flag, and NCF_INVALID.

Referenced by cache_zap_locked().

Here is the caller graph for this function:

◆ cache_neg_demote_locked()

static void cache_neg_demote_locked ( struct namecache ncp)
static

Definition at line 1256 of file vfs_cache.c.

References NCP2NEGLIST(), NCP2NEGSTATE(), negstate::neg_flag, negstate::neg_hit, and NEG_HOT.

Referenced by cache_neg_evict().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_neg_evict()

static bool cache_neg_evict ( void  )
static

◆ cache_neg_evict_cond()

static bool cache_neg_evict_cond ( u_long  lnumcache)
static

Definition at line 1518 of file vfs_cache.c.

References cache_neg_evict(), ncnegfactor, ncsize, and neg_min.

Referenced by cache_alloc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_neg_evict_select_entry()

static struct namecache * cache_neg_evict_select_entry ( struct neglist *  nl)
static

Definition at line 1412 of file vfs_cache.c.

References NCP2NEGSTATE(), and negstate::neg_hit.

Referenced by cache_neg_evict().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_neg_evict_select_list()

static struct neglist * cache_neg_evict_select_list ( void  )
static

Definition at line 1397 of file vfs_cache.c.

References neglists, and numneglists.

Referenced by cache_neg_evict().

Here is the caller graph for this function:

◆ cache_neg_hit_finish()

static void cache_neg_hit_finish ( struct namecache ncp)
static

Definition at line 1225 of file vfs_cache.c.

References namecache::nc_name.

Referenced by cache_fplookup_neg(), cache_lookup(), cache_lookup_dotdot(), cache_lookup_fallback(), and cache_neg_promote_cond().

Here is the caller graph for this function:

◆ cache_neg_hit_prep()

static bool cache_neg_hit_prep ( struct namecache ncp)
static

Definition at line 1201 of file vfs_cache.c.

References CACHE_NEG_PROMOTION_THRESH, NCP2NEGSTATE(), and negstate::neg_hit.

Referenced by cache_fplookup_neg(), cache_lookup(), cache_lookup_dotdot(), and cache_lookup_fallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_neg_init()

static void cache_neg_init ( struct namecache ncp)
static

Definition at line 1187 of file vfs_cache.c.

References namecache::nc_flag, NCF_NEGATIVE, NCP2NEGSTATE(), negstate::neg_flag, and negstate::neg_hit.

Referenced by cache_enter_time().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_neg_insert()

static void cache_neg_insert ( struct namecache ncp)
static

Definition at line 1363 of file vfs_cache.c.

References cache_assert_bucket_locked, namecache::nc_flag, NCF_NEGATIVE, and NCP2NEGLIST().

Referenced by cache_enter_time().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_neg_promote()

static void cache_neg_promote ( struct namecache ncp)
static

Definition at line 1352 of file vfs_cache.c.

References cache_neg_promote_locked(), and NCP2NEGLIST().

Referenced by cache_lookup_dotdot(), and cache_lookup_fallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_neg_promote_cond()

static bool cache_neg_promote_cond ( struct vnode *  dvp,
struct componentname *  cnp,
struct namecache oncp,
uint32_t  hash 
)
static

Definition at line 1282 of file vfs_cache.c.

References cache_ncp_canuse, cache_neg_hit_finish(), cache_neg_promote_locked(), namecache::nc_flag, namecache::nc_name, namecache::nc_nlen, NCF_NEGATIVE, NCHHASH, and NCP2NEGLIST().

Referenced by cache_fplookup_negative_promote(), and cache_lookup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_neg_promote_locked()

static void cache_neg_promote_locked ( struct namecache ncp)
static

Definition at line 1236 of file vfs_cache.c.

References NCP2NEGLIST(), NCP2NEGSTATE(), negstate::neg_flag, and NEG_HOT.

Referenced by cache_neg_promote(), and cache_neg_promote_cond().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_neg_remove()

static void cache_neg_remove ( struct namecache ncp)
static

Definition at line 1377 of file vfs_cache.c.

References cache_assert_bucket_locked, NCP2NEGLIST(), NCP2NEGSTATE(), negstate::neg_flag, and NEG_HOT.

Referenced by cache_zap_locked().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_out_ts()

static void cache_out_ts ( struct namecache ncp,
struct timespec *  tsp,
int *  ticksp 
)
static

Definition at line 499 of file vfs_cache.c.

References namecache::nc_flag, namecache_ts::nc_nc, namecache_ts::nc_ticks, namecache_ts::nc_time, and NCF_TS.

Referenced by cache_lookup(), cache_lookup_dotdot(), and cache_lookup_fallback().

Here is the caller graph for this function:

◆ cache_prehash()

static void cache_prehash ( struct vnode *  vp)
static

Definition at line 809 of file vfs_cache.c.

Referenced by cache_vnode_init().

Here is the caller graph for this function:

◆ cache_purge()

void cache_purge ( struct vnode *  vp)

Definition at line 2872 of file vfs_cache.c.

References cache_has_entries(), and cache_purge_impl().

Referenced by cache_purgevfs(), cache_vop_rename(), cache_vop_rmdir(), do_unlink(), vfs_domount_first(), and vfs_mountroot_shuffle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_purge_impl()

static void cache_purge_impl ( struct vnode *  vp)
static

Definition at line 2820 of file vfs_cache.c.

References cache_free_batch(), cache_zap_locked_vnode_kl2(), mtx, namecache::nc_flag, NCF_ISDOTDOT, and VP2VNODELOCK().

Referenced by cache_purge(), and cache_purge_vgone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_purge_negative()

void cache_purge_negative ( struct vnode *  vp)

Definition at line 2911 of file vfs_cache.c.

References cache_free_batch(), cache_zap_negative_locked_vnode_kl(), mtx, namecache::nc_flag, NCF_NEGATIVE, and VP2VNODELOCK().

Here is the call graph for this function:

◆ cache_purge_vgone()

void cache_purge_vgone ( struct vnode *  vp)

Definition at line 2885 of file vfs_cache.c.

References cache_has_entries(), cache_purge_impl(), mtx, mtx_wait_unlocked(), and VP2VNODELOCK().

Referenced by vgonel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_purgevfs()

void cache_purgevfs ( struct mount *  mp)

Definition at line 3013 of file vfs_cache.c.

References cache_has_entries(), cache_purge(), and vdrop().

Referenced by vfs_mountroot_shuffle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_recalc_neg_min()

static void cache_recalc_neg_min ( u_int  val)
static

Definition at line 1002 of file vfs_cache.c.

References ncsize, and neg_min.

Referenced by cache_changesize(), nchinit(), and sysctl_negminpct().

Here is the caller graph for this function:

◆ cache_remove_cnp()

static __noinline int cache_remove_cnp ( struct vnode *  dvp,
struct componentname *  cnp 
)
static

◆ cache_rev_failed_impl()

static void __inline cache_rev_failed_impl ( int *  reason,
int  line 
)
static

Definition at line 3431 of file vfs_cache.c.

◆ cache_roundup_2()

static u_int cache_roundup_2 ( u_int  val)
static

Definition at line 2609 of file vfs_cache.c.

References res.

Referenced by cache_changesize(), nchinit(), and nchinittbl().

Here is the caller graph for this function:

◆ cache_symlink_alloc()

char * cache_symlink_alloc ( size_t  size,
int  flags 
)

◆ cache_symlink_free()

void cache_symlink_free ( char *  string,
size_t  size 
)

◆ cache_symlink_resolve()

int cache_symlink_resolve ( struct cache_fpl fpl,
const char *  string,
size_t  len 
)

Definition at line 5132 of file vfs_cache.c.

References cache_fpl_istrailingslash(), cache_fpl_pathlen_add(), cache_fpl::cnp, cache_fpl::ndp, cache_fpl::nulchar, panic(), and cache_fpl::tvp.

Here is the call graph for this function:

◆ cache_trylock_vnodes()

static int cache_trylock_vnodes ( struct mtx vlp1,
struct mtx vlp2 
)
static

Definition at line 936 of file vfs_cache.c.

References cache_sort_vnodes.

Referenced by cache_zap_locked_bucket().

Here is the caller graph for this function:

◆ cache_unlock_all_buckets()

static void cache_unlock_all_buckets ( void  )
static

Definition at line 909 of file vfs_cache.c.

References bucketlocks, and numbucketlocks.

Referenced by cache_changesize().

Here is the caller graph for this function:

◆ cache_unlock_all_vnodes()

static void cache_unlock_all_vnodes ( void  )
static

Definition at line 927 of file vfs_cache.c.

References numvnodelocks, and vnodelocks.

Referenced by cache_changesize().

Here is the caller graph for this function:

◆ cache_unlock_buckets_cel()

static void cache_unlock_buckets_cel ( struct celockstate cel)
static

Definition at line 2238 of file vfs_cache.c.

References celockstate::blp.

Referenced by cache_enter_unlock().

Here is the caller graph for this function:

◆ cache_unlock_vnodes()

static void cache_unlock_vnodes ( struct mtx vlp1,
struct mtx vlp2 
)
static

Definition at line 968 of file vfs_cache.c.

Referenced by cache_zap_locked_bucket(), and cache_zap_unlocked_bucket().

Here is the caller graph for this function:

◆ cache_unlock_vnodes_cel()

static void cache_unlock_vnodes_cel ( struct celockstate cel)
static

Definition at line 2168 of file vfs_cache.c.

References celockstate::vlp.

Referenced by cache_enter_lock(), cache_enter_lock_dd(), cache_enter_unlock(), and cache_lock_vnodes_cel_3().

Here is the caller graph for this function:

◆ cache_vnode_init()

void cache_vnode_init ( struct vnode *  vp)

Definition at line 2691 of file vfs_cache.c.

References cache_prehash().

Referenced by vnode_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_vop_rename()

void cache_vop_rename ( struct vnode *  fdvp,
struct vnode *  fvp,
struct vnode *  tdvp,
struct vnode *  tvp,
struct componentname *  fcnp,
struct componentname *  tcnp 
)

Definition at line 2937 of file vfs_cache.c.

References cache_purge(), and cache_remove_cnp().

Here is the call graph for this function:

◆ cache_vop_rmdir()

void cache_vop_rmdir ( struct vnode *  dvp,
struct vnode *  vp 
)

Definition at line 2973 of file vfs_cache.c.

References cache_purge().

Here is the call graph for this function:

◆ cache_zap_locked()

◆ cache_zap_locked_bucket()

static int __noinline cache_zap_locked_bucket ( struct namecache ncp,
struct componentname *  cnp,
uint32_t  hash,
struct mtx blp 
)
static

Definition at line 1688 of file vfs_cache.c.

References cache_assert_bucket_locked, cache_trylock_vnodes(), cache_unlock_vnodes(), cache_zap_locked(), cache_zap_unlocked_bucket(), mtx, namecache::nc_flag, NCF_NEGATIVE, and VP2VNODELOCK().

Referenced by cache_lookup_fallback(), and cache_remove_cnp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_zap_locked_vnode_kl2()

static bool cache_zap_locked_vnode_kl2 ( struct namecache ncp,
struct vnode *  vp,
struct mtx **  vlpp 
)
static

Definition at line 1595 of file vfs_cache.c.

References cache_assert_vnode_locked(), cache_sort_vnodes, cache_zap_locked(), cache_zap_negative_locked_vnode_kl(), mtx, namecache::nc_flag, NCF_NEGATIVE, NCP2BUCKETLOCK(), and VP2VNODELOCK().

Referenced by cache_purge_impl(), and cache_remove_cnp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_zap_negative_locked_vnode_kl()

static void cache_zap_negative_locked_vnode_kl ( struct namecache ncp,
struct vnode *  vp 
)
static

Definition at line 1580 of file vfs_cache.c.

References cache_assert_vnode_locked(), cache_zap_locked(), mtx, namecache::nc_flag, NCF_NEGATIVE, and NCP2BUCKETLOCK().

Referenced by cache_lookup_dotdot(), cache_purge_negative(), and cache_zap_locked_vnode_kl2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cache_zap_unlocked_bucket()

static int cache_zap_unlocked_bucket ( struct namecache ncp,
struct componentname *  cnp,
struct vnode *  dvp,
struct mtx dvlp,
struct mtx vlp,
uint32_t  hash,
struct mtx blp 
)
static

Definition at line 1657 of file vfs_cache.c.

References cache_assert_bucket_unlocked, cache_lock_vnodes(), cache_sort_vnodes, cache_unlock_vnodes(), cache_zap_locked(), namecache::nc_name, namecache::nc_nlen, and NCHHASH.

Referenced by cache_zap_locked_bucket().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CK_SLIST_HEAD()

static __read_mostly CK_SLIST_HEAD ( nchashhead  ,
namecache   
)
static

Definition at line 439 of file vfs_cache.c.

◆ COUNTER_U64_DEFINE_EARLY() [1/5]

static COUNTER_U64_DEFINE_EARLY ( neg_created  )
static

◆ COUNTER_U64_DEFINE_EARLY() [2/5]

static COUNTER_U64_DEFINE_EARLY ( neg_evict_skipped_contended  )
static

◆ COUNTER_U64_DEFINE_EARLY() [3/5]

static COUNTER_U64_DEFINE_EARLY ( neg_evict_skipped_empty  )
static

◆ COUNTER_U64_DEFINE_EARLY() [4/5]

static COUNTER_U64_DEFINE_EARLY ( neg_evict_skipped_missed  )
static

◆ COUNTER_U64_DEFINE_EARLY() [5/5]

static COUNTER_U64_DEFINE_EARLY ( neg_evicted  )
static

◆ CTASSERT() [1/2]

CTASSERT ( (nitems(((struct celockstate *) 0) ->blp)==2)  )

◆ CTASSERT() [2/2]

CTASSERT ( (nitems(((struct celockstate *) 0) ->vlp)==3)  )

◆ DEBUGNODE_COUNTER()

DEBUGNODE_COUNTER ( zap_bucket_relock_success  ,
zap_bucket_relock_success  ,
"Number of successful removals after relocking"   
)

◆ DEBUGNODE_ULONG() [1/3]

DEBUGNODE_ULONG ( vnodes_cel_3_failures  ,
cache_lock_vnodes_cel_3_failures  ,
"Number of times 3-way vnode locking failed"   
)

◆ DEBUGNODE_ULONG() [2/3]

DEBUGNODE_ULONG ( zap_bucket_fail  ,
zap_bucket_fail  ,
""   
)

◆ DEBUGNODE_ULONG() [3/3]

DEBUGNODE_ULONG ( zap_bucket_fail2  ,
zap_bucket_fail2  ,
""   
)

◆ kern___realpathat()

static int kern___realpathat ( struct thread *  td,
int  fd,
const char *  path,
char *  buf,
size_t  size,
int  flags,
enum uio_seg  pathseg 
)
static

Definition at line 3134 of file vfs_cache.c.

References buf, cap_fstat_rights, fd, flags, free(), namei(), NDFREE(), path, and vn_fullpath_hardlink().

Referenced by sys___realpathat().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MALLOC_DEFINE()

static MALLOC_DEFINE ( M_VFSCACHE  ,
"vfscache"  ,
"VFS name cache entries"   
)
static

◆ ncfreetbl()

static void ncfreetbl ( struct nchashhead *  hashtbl)
static

Definition at line 2635 of file vfs_cache.c.

References free().

Referenced by cache_changesize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nchinit()

◆ nchinittbl()

static struct nchashhead * nchinittbl ( u_long  elements,
u_long *  hashmask 
)
static

Definition at line 2620 of file vfs_cache.c.

References cache_roundup_2(), and malloc().

Referenced by cache_changesize(), and nchinit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NCP2BUCKET()

static struct nchashhead * NCP2BUCKET ( struct namecache ncp)
inlinestatic

Definition at line 844 of file vfs_cache.c.

References cache_get_hash(), namecache::nc_name, namecache::nc_nlen, and NCHHASH.

Referenced by cache_zap_locked().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NCP2BUCKETLOCK()

static struct mtx * NCP2BUCKETLOCK ( struct namecache ncp)
inlinestatic

Definition at line 853 of file vfs_cache.c.

References cache_get_hash(), HASH2BUCKETLOCK, namecache::nc_name, and namecache::nc_nlen.

Referenced by cache_enter_lock(), cache_enter_lock_dd(), cache_neg_evict(), cache_zap_locked_vnode_kl2(), and cache_zap_negative_locked_vnode_kl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NCP2NEGLIST()

static struct neglist * NCP2NEGLIST ( struct namecache ncp)
inlinestatic

Definition at line 468 of file vfs_cache.c.

References ncneghash, and neglists.

Referenced by cache_neg_demote_locked(), cache_neg_insert(), cache_neg_promote(), cache_neg_promote_cond(), cache_neg_promote_locked(), and cache_neg_remove().

Here is the caller graph for this function:

◆ NCP2NEGSTATE()

static struct negstate * NCP2NEGSTATE ( struct namecache ncp)
inlinestatic

Definition at line 475 of file vfs_cache.c.

References namecache::nc_flag, and NCF_NEGATIVE.

Referenced by cache_neg_demote_locked(), cache_neg_evict_select_entry(), cache_neg_hit_prep(), cache_neg_init(), cache_neg_promote_locked(), and cache_neg_remove().

Here is the caller graph for this function:

◆ SDT_PROBE_DECLARE() [1/2]

SDT_PROBE_DECLARE ( vfs  ,
namei  ,
lookup  ,
entry   
)

◆ SDT_PROBE_DECLARE() [2/2]

SDT_PROBE_DECLARE ( vfs  ,
namei  ,
lookup  ,
return   
)

◆ SDT_PROBE_DEFINE1() [1/6]

SDT_PROBE_DEFINE1 ( vfs  ,
namecache  ,
fullpath  ,
entry  ,
"struct vnode *"   
)

◆ SDT_PROBE_DEFINE1() [2/6]

SDT_PROBE_DEFINE1 ( vfs  ,
namecache  ,
fullpath  ,
miss  ,
"struct vnode *"   
)

◆ SDT_PROBE_DEFINE1() [3/6]

SDT_PROBE_DEFINE1 ( vfs  ,
namecache  ,
purge  ,
batch  ,
"int"   
)

◆ SDT_PROBE_DEFINE1() [4/6]

SDT_PROBE_DEFINE1 ( vfs  ,
namecache  ,
purge_negative  ,
done  ,
"struct vnode *"   
)

◆ SDT_PROBE_DEFINE1() [5/6]

SDT_PROBE_DEFINE1 ( vfs  ,
namecache  ,
purgevfs  ,
done  ,
"struct mount *"   
)

◆ SDT_PROBE_DEFINE1() [6/6]

SDT_PROBE_DEFINE1 ( vfs  ,
namecache  ,
symlink  ,
alloc__fail  ,
"size_t"   
)

◆ SDT_PROBE_DEFINE2() [1/8]

SDT_PROBE_DEFINE2 ( vfs  ,
namecache  ,
enter_negative  ,
done  ,
"struct vnode *"  ,
"char *"   
)

◆ SDT_PROBE_DEFINE2() [2/8]

SDT_PROBE_DEFINE2 ( vfs  ,
namecache  ,
evict_negative  ,
done  ,
"struct vnode *"  ,
"char *"   
)

◆ SDT_PROBE_DEFINE2() [3/8]

SDT_PROBE_DEFINE2 ( vfs  ,
namecache  ,
fullpath_smr  ,
hit  ,
"struct vnode *"  ,
"const char *"   
)

◆ SDT_PROBE_DEFINE2() [4/8]

SDT_PROBE_DEFINE2 ( vfs  ,
namecache  ,
lookup  ,
hit__negative  ,
"struct vnode *"  ,
"char *"   
)

◆ SDT_PROBE_DEFINE2() [5/8]

SDT_PROBE_DEFINE2 ( vfs  ,
namecache  ,
lookup  ,
miss  ,
"struct vnode *"  ,
"char *"   
)

◆ SDT_PROBE_DEFINE2() [6/8]

SDT_PROBE_DEFINE2 ( vfs  ,
namecache  ,
removecnp  ,
hit  ,
"struct vnode *"  ,
"struct componentname *"   
)

◆ SDT_PROBE_DEFINE2() [7/8]

SDT_PROBE_DEFINE2 ( vfs  ,
namecache  ,
removecnp  ,
miss  ,
"struct vnode *"  ,
"struct componentname *"   
)

◆ SDT_PROBE_DEFINE2() [8/8]

SDT_PROBE_DEFINE2 ( vfs  ,
namecache  ,
zap_negative  ,
done  ,
"struct vnode *"  ,
"char *"   
)

◆ SDT_PROBE_DEFINE3() [1/8]

SDT_PROBE_DEFINE3 ( vfs  ,
fplookup  ,
lookup  ,
done  ,
"struct nameidata"  ,
"int"  ,
"bool"   
)

◆ SDT_PROBE_DEFINE3() [2/8]

SDT_PROBE_DEFINE3 ( vfs  ,
namecache  ,
enter  ,
done  ,
"struct vnode *"  ,
"char *"  ,
"struct vnode *"   
)

◆ SDT_PROBE_DEFINE3() [3/8]

SDT_PROBE_DEFINE3 ( vfs  ,
namecache  ,
enter  ,
duplicate  ,
"struct vnode *"  ,
"char *"  ,
"struct vnode *"   
)

◆ SDT_PROBE_DEFINE3() [4/8]

SDT_PROBE_DEFINE3 ( vfs  ,
namecache  ,
fullpath  ,
hit  ,
"struct vnode *"  ,
"char *"  ,
"struct vnode *"   
)

◆ SDT_PROBE_DEFINE3() [5/8]

SDT_PROBE_DEFINE3 ( vfs  ,
namecache  ,
fullpath  ,
return  ,
"int"  ,
"struct vnode *"  ,
"char *"   
)

◆ SDT_PROBE_DEFINE3() [6/8]

SDT_PROBE_DEFINE3 ( vfs  ,
namecache  ,
lookup  ,
hit  ,
"struct vnode *"  ,
"char *"  ,
"struct vnode *"   
)

◆ SDT_PROBE_DEFINE3() [7/8]

SDT_PROBE_DEFINE3 ( vfs  ,
namecache  ,
purge  ,
done  ,
"struct vnode *"  ,
"size_t"  ,
"size_t"   
)

◆ SDT_PROBE_DEFINE3() [8/8]

SDT_PROBE_DEFINE3 ( vfs  ,
namecache  ,
zap  ,
done  ,
"struct vnode *"  ,
"char *"  ,
"struct vnode *"   
)

◆ SDT_PROBE_DEFINE4()

SDT_PROBE_DEFINE4 ( vfs  ,
namecache  ,
fullpath_smr  ,
miss  ,
"struct vnode *"  ,
"struct namecache *"  ,
"int"  ,
"int"   
)

◆ SDT_PROVIDER_DECLARE()

SDT_PROVIDER_DECLARE ( vfs  )

◆ STATNODE_COUNTER() [1/16]

STATNODE_COUNTER ( dotdothis  ,
dotdothits  ,
"Number of '..' hits"   
)

◆ STATNODE_COUNTER() [2/16]

STATNODE_COUNTER ( dothits  ,
dothits  ,
"Number of '.' hits"   
)

◆ STATNODE_COUNTER() [3/16]

STATNODE_COUNTER ( drops  ,
numdrops  ,
"Number of dropped entries due to reaching the limit"   
)

◆ STATNODE_COUNTER() [4/16]

STATNODE_COUNTER ( fullpathcalls  ,
numfullpathcalls  ,
"Number of fullpath search calls"   
)

◆ STATNODE_COUNTER() [5/16]

STATNODE_COUNTER ( fullpathfail1  ,
numfullpathfail1  ,
"Number of fullpath search errors (ENOTDIR)"   
)

◆ STATNODE_COUNTER() [6/16]

STATNODE_COUNTER ( fullpathfail2  ,
numfullpathfail2  ,
"Number of fullpath search errors (VOP_VPTOCNP failures)"   
)

◆ STATNODE_COUNTER() [7/16]

STATNODE_COUNTER ( fullpathfail4  ,
numfullpathfail4  ,
"Number of fullpath search errors (ENOMEM)"   
)

◆ STATNODE_COUNTER() [8/16]

STATNODE_COUNTER ( fullpathfound  ,
numfullpathfound  ,
"Number of successful fullpath calls"   
)

◆ STATNODE_COUNTER() [9/16]

STATNODE_COUNTER ( heldvnodes  ,
numcachehv  ,
"Number of namecache entries with vnodes held"   
)

◆ STATNODE_COUNTER() [10/16]

STATNODE_COUNTER ( miss  ,
nummiss  ,
"Number of cache misses"   
)

◆ STATNODE_COUNTER() [11/16]

STATNODE_COUNTER ( misszap  ,
nummisszap  ,
"Number of cache misses we do not want to cache"   
)

◆ STATNODE_COUNTER() [12/16]

STATNODE_COUNTER ( neghits  ,
numneghits  ,
"Number of cache hits (negative)"   
)

◆ STATNODE_COUNTER() [13/16]

STATNODE_COUNTER ( negzaps  ,
numnegzaps  ,
"Number of cache hits (negative) we do not want to cache"   
)

◆ STATNODE_COUNTER() [14/16]

STATNODE_COUNTER ( poshits  ,
numposhits  ,
"Number of cache hits (positive)"   
)

◆ STATNODE_COUNTER() [15/16]

STATNODE_COUNTER ( posszaps  ,
numposzaps  ,
"Number of cache hits (positive) we do not want to cache"   
)

◆ STATNODE_COUNTER() [16/16]

STATNODE_COUNTER ( symlinktoobig  ,
symlinktoobig  ,
"Number of times symlink did not fit the cache"   
)

◆ STATNODE_ULONG() [1/2]

STATNODE_ULONG ( count  ,
numcache  ,
"Number of cache entries"   
)

◆ STATNODE_ULONG() [2/2]

STATNODE_ULONG ( neg  ,
numneg  ,
"Number of negative cache entries"   
)

◆ sys___getcwd()

int sys___getcwd ( struct thread *  td,
struct __getcwd_args *  uap 
)

Definition at line 3077 of file vfs_cache.c.

References buf, namei_zone, and vn_getcwd().

Here is the call graph for this function:

◆ sys___realpathat()

int sys___realpathat ( struct thread *  td,
struct __realpathat_args *  uap 
)

Definition at line 3158 of file vfs_cache.c.

References kern___realpathat().

Here is the call graph for this function:

◆ syscal_vfs_cache_fast_lookup()

static int syscal_vfs_cache_fast_lookup ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 3887 of file vfs_cache.c.

References cache_fast_lookup, cache_fast_lookup_enabled_recalc(), and sysctl_handle_int().

Here is the call graph for this function:

◆ SYSCTL_COUNTER_U64() [1/6]

SYSCTL_COUNTER_U64 ( _vfs_cache_neg  ,
OID_AUTO  ,
created  ,
CTLFLAG_RD  ,
neg_created,
"Number of created negative entries"   
)

◆ SYSCTL_COUNTER_U64() [2/6]

SYSCTL_COUNTER_U64 ( _vfs_cache_neg  ,
OID_AUTO  ,
evict_skipped_contended  ,
CTLFLAG_RD  ,
neg_evict_skipped_contended,
"Number of times evicting failed due to contention"   
)

◆ SYSCTL_COUNTER_U64() [3/6]

SYSCTL_COUNTER_U64 ( _vfs_cache_neg  ,
OID_AUTO  ,
evict_skipped_empty  ,
CTLFLAG_RD  ,
neg_evict_skipped_empty,
"Number of times evicting failed due to lack of entries"   
)

◆ SYSCTL_COUNTER_U64() [4/6]

SYSCTL_COUNTER_U64 ( _vfs_cache_neg  ,
OID_AUTO  ,
evict_skipped_missed  ,
CTLFLAG_RD  ,
neg_evict_skipped_missed,
"Number of times evicting failed due to target entry disappearing"   
)

◆ SYSCTL_COUNTER_U64() [5/6]

SYSCTL_COUNTER_U64 ( _vfs_cache_neg  ,
OID_AUTO  ,
evicted  ,
CTLFLAG_RD  ,
neg_evicted,
"Number of evicted negative entries"   
)

◆ SYSCTL_COUNTER_U64() [6/6]

SYSCTL_COUNTER_U64 ( _vfs_cache_neg  ,
OID_AUTO  ,
hits  ,
CTLFLAG_RD  ,
numneghits,
"Number of cache hits (negative)"   
)

◆ SYSCTL_INT()

SYSCTL_INT ( _debug_sizeof  ,
OID_AUTO  ,
namecache  ,
CTLFLAG_RD  ,
SYSCTL_NULL_INT_PTR  ,
sizeof(struct namecache ,
"sizeof(struct namecache)"   
)

◆ sysctl_nchstats()

static int sysctl_nchstats ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 980 of file vfs_cache.c.

References counter_u64_fetch().

Here is the call graph for this function:

◆ sysctl_neg_hot()

static int sysctl_neg_hot ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 1172 of file vfs_cache.c.

References neglists, and numneglists.

◆ sysctl_negminpct()

static int sysctl_negminpct ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 1009 of file vfs_cache.c.

References cache_recalc_neg_min(), ncnegminpct, and sysctl_handle_int().

Here is the call graph for this function:

◆ SYSCTL_NODE() [1/5]

static SYSCTL_NODE ( _vfs  ,
OID_AUTO  ,
cache  ,
CTLFLAG_RW|  CTLFLAG_MPSAFE,
,
"Name cache"   
)
static

◆ SYSCTL_NODE() [2/5]

static SYSCTL_NODE ( _vfs_cache  ,
OID_AUTO  ,
debug  ,
CTLFLAG_RW|  CTLFLAG_MPSAFE,
,
"Name cache debugging"   
)
static

◆ SYSCTL_NODE() [3/5]

static SYSCTL_NODE ( _vfs_cache  ,
OID_AUTO  ,
neg  ,
CTLFLAG_RW|  CTLFLAG_MPSAFE,
,
"Name cache negative entry statistics"   
)
static

◆ SYSCTL_NODE() [4/5]

static SYSCTL_NODE ( _vfs_cache  ,
OID_AUTO  ,
param  ,
CTLFLAG_RW|  CTLFLAG_MPSAFE,
,
"Name cache parameters"   
)
static

◆ SYSCTL_NODE() [5/5]

static SYSCTL_NODE ( _vfs_cache  ,
OID_AUTO  ,
stats  ,
CTLFLAG_RW|  CTLFLAG_MPSAFE,
,
"Name cache statistics"   
)
static

◆ SYSCTL_PROC() [1/4]

SYSCTL_PROC ( _vfs  ,
OID_AUTO  ,
cache_fast_lookup  ,
CTLTYPE_INT|CTLFLAG_RW|  CTLFLAG_MPSAFE,
cache_fast_lookup,
,
syscal_vfs_cache_fast_lookup  ,
"IU"  ,
""   
)

◆ SYSCTL_PROC() [2/4]

SYSCTL_PROC ( _vfs_cache  ,
OID_AUTO  ,
nchstats  ,
CTLTYPE_OPAQUE|CTLFLAG_RD|  CTLFLAG_MPSAFE,
,
,
sysctl_nchstats  ,
"LU"  ,
"VFS cache effectiveness statistics"   
)

◆ SYSCTL_PROC() [3/4]

SYSCTL_PROC ( _vfs_cache_neg  ,
OID_AUTO  ,
hot  ,
CTLTYPE_INT|CTLFLAG_RD|  CTLFLAG_MPSAFE,
,
,
sysctl_neg_hot  ,
"I"  ,
"Number of hot negative entries"   
)

◆ SYSCTL_PROC() [4/4]

SYSCTL_PROC ( _vfs_cache_param  ,
OID_AUTO  ,
negminpct  ,
CTLTYPE_INT|CTLFLAG_MPSAFE|  CTLFLAG_RW,
NULL  ,
,
sysctl_negminpct  ,
"I"  ,
"Negative entry \% of namecache capacity above which automatic eviction is allowed"   
)

◆ SYSCTL_UINT() [1/3]

SYSCTL_UINT ( _vfs_cache_param  ,
OID_AUTO  ,
negmin  ,
CTLFLAG_RD  ,
neg_min,
,
"Negative entry count above which automatic eviction is allowed"   
)

◆ SYSCTL_UINT() [2/3]

SYSCTL_UINT ( _vfs_cache_param  ,
OID_AUTO  ,
size  ,
CTLFLAG_RW  ,
ncsize,
,
"Total namecache capacity"   
)

◆ SYSCTL_UINT() [3/3]

SYSCTL_UINT ( _vfs_cache_param  ,
OID_AUTO  ,
sizefactor  ,
CTLFLAG_RW  ,
ncsizefactor,
,
"Size factor for namecache  
)

◆ SYSCTL_ULONG() [1/2]

SYSCTL_ULONG ( _vfs_cache_neg  ,
OID_AUTO  ,
count  ,
CTLFLAG_RD  ,
numneg,
,
"Number of negative cache entries"   
)

◆ SYSCTL_ULONG() [2/2]

SYSCTL_ULONG ( _vfs_cache_param  ,
OID_AUTO  ,
negfactor  ,
CTLFLAG_RW  ,
ncnegfactor,
,
"Ratio of negative namecache entries"   
)

◆ SYSINIT()

SYSINIT ( vfs  ,
SI_SUB_VFS  ,
SI_ORDER_SECOND  ,
nchinit  ,
NULL   
)

◆ TAILQ_HEAD()

TAILQ_HEAD ( cache_freebatch  ,
namecache   
)

◆ vfs_cache_lookup()

int vfs_cache_lookup ( struct vop_lookup_args *  ap)

Definition at line 3045 of file vfs_cache.c.

References cache_lookup(), flags, and vn_dir_check_exec().

Here is the call graph for this function:

◆ vn_commname()

int vn_commname ( struct vnode *  vp,
char *  buf,
u_int  buflen 
)

Definition at line 3726 of file vfs_cache.c.

References buf, mtx, namecache::nc_flag, namecache::nc_name, namecache::nc_nlen, NCF_ISDOTDOT, and VP2VNODELOCK().

Referenced by do_execve().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vn_dd_from_dst()

static struct namecache * vn_dd_from_dst ( struct vnode *  vp)
static

Definition at line 3229 of file vfs_cache.c.

References cache_assert_vnode_locked(), namecache::nc_flag, and NCF_ISDOTDOT.

Referenced by vn_vptocnp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vn_dir_dd_ino()

struct vnode * vn_dir_dd_ino ( struct vnode *  vp)

Definition at line 3701 of file vfs_cache.c.

References mtx, namecache::nc_flag, NCF_ISDOTDOT, vget_finish(), vget_prep(), and VP2VNODELOCK().

Here is the call graph for this function:

◆ vn_fullpath()

int vn_fullpath ( struct vnode *  vp,
char **  retbuf,
char **  freebuf 
)

Definition at line 3170 of file vfs_cache.c.

References buf, free(), malloc(), pwd_drop(), pwd_hold(), vn_fullpath_any(), and vn_fullpath_any_smr().

Referenced by do_execve(), kern_proc_vmmap_out(), proc_get_binpath(), ptrace_vm_entry(), and vn_fill_kinfo_vnode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vn_fullpath_any()

static int vn_fullpath_any ( struct vnode *  vp,
struct vnode *  rdir,
char *  buf,
char **  retbuf,
size_t *  buflen 
)
static

Definition at line 3575 of file vfs_cache.c.

References buf, vn_fullpath_dir(), vn_vptocnp(), vref(), and vrele().

Referenced by vn_fullpath(), vn_fullpath_global(), and vn_getcwd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vn_fullpath_any_smr()

static int vn_fullpath_any_smr ( struct vnode *  vp,
struct vnode *  rdir,
char *  buf,
char **  retbuf,
size_t *  buflen,
size_t  addend 
)
static

◆ vn_fullpath_dir()

static int vn_fullpath_dir ( struct vnode *  vp,
struct vnode *  rdir,
char *  buf,
char **  retbuf,
size_t *  len,
size_t  addend 
)
static

Definition at line 3317 of file vfs_cache.c.

References buf, rootvnode, vn_vptocnp(), vput(), vref(), and vrele().

Referenced by vn_fullpath_any(), and vn_fullpath_hardlink().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vn_fullpath_global()

int vn_fullpath_global ( struct vnode *  vp,
char **  retbuf,
char **  freebuf 
)

Definition at line 3205 of file vfs_cache.c.

References buf, free(), malloc(), rootvnode, vn_fullpath_any(), and vn_fullpath_any_smr().

Referenced by coredump(), and vn_path_to_global_path().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vn_fullpath_hardlink()

int vn_fullpath_hardlink ( struct vnode *  vp,
struct vnode *  dvp,
const char *  hrdl_name,
size_t  hrdl_name_length,
char **  retbuf,
char **  freebuf,
size_t *  buflen 
)

Definition at line 3620 of file vfs_cache.c.

References buf, free(), malloc(), pwd_drop(), pwd_hold(), type, vn_fullpath_any_smr(), vn_fullpath_dir(), and vref().

Referenced by do_execve(), kern___realpathat(), and proc_get_binpath().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vn_getcwd()

int vn_getcwd ( char *  buf,
char **  retbuf,
size_t *  buflen 
)

Definition at line 3098 of file vfs_cache.c.

References buf, pwd_drop(), pwd_hold(), vn_fullpath_any(), and vn_fullpath_any_smr().

Referenced by coredump(), and sys___getcwd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vn_path_to_global_path()

int vn_path_to_global_path ( struct thread *  td,
struct vnode *  vp,
char *  path,
u_int  pathlen 
)

Definition at line 3759 of file vfs_cache.c.

References free(), namei(), NDFREE(), path, vn_fullpath_global(), vput(), and vrele().

Referenced by kern_jail_set(), kern_unmount(), and vfs_domount().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vn_vptocnp()

int vn_vptocnp ( struct vnode **  vp,
char *  buf,
size_t *  buflen 
)

Definition at line 3242 of file vfs_cache.c.

References buf, mtx, namecache::nc_flag, namecache::nc_name, namecache::nc_nlen, NCF_ISDOTDOT, vn_dd_from_dst(), VP2VNODELOCK(), vput(), vref(), and vrele().

Referenced by vn_fullpath_any(), and vn_fullpath_dir().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VP2VNODELOCK()

Variable Documentation

◆ bucketlocks

struct mtx_padalign __read_mostly* bucketlocks
static

Definition at line 484 of file vfs_cache.c.

Referenced by cache_lock_all_buckets(), cache_unlock_all_buckets(), and nchinit().

◆ cache_fast_lookup

int cache_fast_lookup = 1
static

Definition at line 3861 of file vfs_cache.c.

Referenced by cache_fast_lookup_enabled_recalc(), and syscal_vfs_cache_fast_lookup().

◆ cache_fast_lookup_enabled

char __read_frequently cache_fast_lookup_enabled = true
static

◆ cache_lock_vnodes_cel_3_failures

long cache_lock_vnodes_cel_3_failures
static

Definition at line 577 of file vfs_cache.c.

Referenced by cache_lock_vnodes_cel_3().

◆ cache_zone_large

uma_zone_t __read_mostly cache_zone_large
static

◆ cache_zone_large_ts

uma_zone_t __read_mostly cache_zone_large_ts
static

Definition at line 644 of file vfs_cache.c.

Referenced by cache_alloc_uma(), cache_free_uma(), and nchinit().

◆ cache_zone_small

uma_zone_t __read_mostly cache_zone_small
static

◆ cache_zone_small_ts

uma_zone_t __read_mostly cache_zone_small_ts
static

Definition at line 642 of file vfs_cache.c.

Referenced by cache_alloc_uma(), cache_free_uma(), and nchinit().

◆ ncbuckethash

u_int __read_mostly ncbuckethash
static

Definition at line 483 of file vfs_cache.c.

Referenced by nchinit().

◆ ncnegfactor

u_long __read_mostly ncnegfactor = 5
static

Definition at line 419 of file vfs_cache.c.

Referenced by cache_neg_evict_cond().

◆ ncnegminpct

u_int ncnegminpct = 3
static

Definition at line 428 of file vfs_cache.c.

Referenced by cache_changesize(), nchinit(), and sysctl_negminpct().

◆ ncsize

u_int __read_mostly ncsize
static

◆ ncsizefactor

u_int ncsizefactor = 2

Definition at line 415 of file vfs_cache.c.

Referenced by cache_changesize(), nchinit(), and vntblinit().

◆ ncvnodehash

u_int __read_mostly ncvnodehash
static

Definition at line 489 of file vfs_cache.c.

Referenced by nchinit(), and VP2VNODELOCK().

◆ neg_min

u_int __read_mostly neg_min
static

Definition at line 430 of file vfs_cache.c.

Referenced by cache_neg_evict_cond(), and cache_recalc_neg_min().

◆ neglists

struct neglist neglists[numneglists]
static

Definition at line 465 of file vfs_cache.c.

Referenced by cache_neg_evict_select_list(), nchinit(), NCP2NEGLIST(), and sysctl_neg_hot().

◆ VFS_SMR_DECLARE

VFS_SMR_DECLARE

Definition at line 406 of file vfs_cache.c.

◆ vnodelocks

struct mtx __read_mostly* vnodelocks
static

Definition at line 490 of file vfs_cache.c.

Referenced by cache_lock_all_vnodes(), cache_unlock_all_vnodes(), nchinit(), and VP2VNODELOCK().

◆ zap_bucket_fail

long zap_bucket_fail
static

Definition at line 573 of file vfs_cache.c.

Referenced by cache_remove_cnp().

◆ zap_bucket_fail2

long zap_bucket_fail2
static

Definition at line 575 of file vfs_cache.c.

Referenced by cache_lookup_fallback().