| 72 | } |
| 73 | |
| 74 | int |
| 75 | vfs_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 | |
| 109 | void |
| 110 | vfs_hash_ref(const struct mount *mp, u_int hash, struct thread *td, |
no test coverage detected