MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vfs_hash_get

Function vfs_hash_get

freebsd/kern/vfs_hash.c:74–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74int
75vfs_hash_get(const struct mount *mp, u_int hash, int flags, struct thread *td,
76 struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg)
77{
78 struct vnode *vp;
79 enum vgetstate vs;
80 int error;
81
82 while (1) {
83 rw_rlock(&vfs_hash_lock);
84 LIST_FOREACH(vp, vfs_hash_bucket(mp, hash), v_hashlist) {
85 if (vp->v_hash != hash)
86 continue;
87 if (vp->v_mount != mp)
88 continue;
89 if (fn != NULL && fn(vp, arg))
90 continue;
91 vs = vget_prep(vp);
92 rw_runlock(&vfs_hash_lock);
93 error = vget_finish(vp, flags, vs);
94 if (error == ENOENT && (flags & LK_NOWAIT) == 0)
95 break;
96 if (error)
97 return (error);
98 *vpp = vp;
99 return (0);
100 }
101 if (vp == NULL) {
102 rw_runlock(&vfs_hash_lock);
103 *vpp = NULL;
104 return (0);
105 }
106 }
107}
108
109void
110vfs_hash_ref(const struct mount *mp, u_int hash, struct thread *td,

Callers 1

sfs_vnode_getFunction · 0.85

Calls 3

vfs_hash_bucketFunction · 0.85
vget_prepFunction · 0.85
vget_finishFunction · 0.85

Tested by

no test coverage detected