Lines Matching full:vp

108 static void	delmntque(struct vnode *vp);
112 static int vtryrecycle(struct vnode *vp, bool isvnlru);
115 static void vn_seqc_write_end_free(struct vnode *vp);
118 static void vdropl_recycle(struct vnode *vp);
119 static void vdrop_recycle(struct vnode *vp);
124 static int v_inval_buf_range_locked(struct vnode *vp, struct bufobj *bo,
323 static void vdbatch_dequeue(struct vnode *vp);
433 struct vnode *vp; in sysctl_try_reclaim_vnode() local
455 vp = nd.ni_vp; in sysctl_try_reclaim_vnode()
457 if (VN_IS_DOOMED(vp)) { in sysctl_try_reclaim_vnode()
468 vgone(vp); in sysctl_try_reclaim_vnode()
470 vput(vp); in sysctl_try_reclaim_vnode()
481 struct vnode *vp; in sysctl_ftry_reclaim_vnode() local
495 vp = fp->f_vnode; in sysctl_ftry_reclaim_vnode()
497 error = vn_lock(vp, LK_EXCLUSIVE); in sysctl_ftry_reclaim_vnode()
501 vgone(vp); in sysctl_ftry_reclaim_vnode()
502 VOP_UNLOCK(vp); in sysctl_ftry_reclaim_vnode()
516 /* Shift count for (uintptr_t)vp to initialize vp->v_hash. */
593 struct vnode *vp; in vn_alloc_marker() local
595 vp = malloc(sizeof(struct vnode), M_VNODE_MARKER, M_WAITOK | M_ZERO); in vn_alloc_marker()
596 vp->v_type = VMARKER; in vn_alloc_marker()
597 vp->v_mount = mp; in vn_alloc_marker()
599 return (vp); in vn_alloc_marker()
603 vn_free_marker(struct vnode *vp) in vn_free_marker() argument
606 MPASS(vp->v_type == VMARKER); in vn_free_marker()
607 free(vp, M_VNODE_MARKER); in vn_free_marker()
664 struct vnode *vp; in vnode_init() local
666 vp = mem; in vnode_init()
667 bzero(vp, size); in vnode_init()
671 vp->v_vnlock = &vp->v_lock; in vnode_init()
672 mtx_init(&vp->v_interlock, "vnode interlock", NULL, MTX_DEF); in vnode_init()
676 lockinit(vp->v_vnlock, PVFS, "vnode", VLKTIMEOUT, in vnode_init()
681 bufobj_init(&vp->v_bufobj, vp); in vnode_init()
685 cache_vnode_init(vp); in vnode_init()
689 rangelock_init(&vp->v_rl); in vnode_init()
691 vp->v_dbatchcpu = NOCPU; in vnode_init()
693 vp->v_state = VSTATE_DEAD; in vnode_init()
698 vp->v_holdcnt = VHOLD_NO_SMR; in vnode_init()
699 vp->v_type = VNON; in vnode_init()
701 TAILQ_INSERT_BEFORE(vnode_list_free_marker, vp, v_vnodelist); in vnode_init()
712 struct vnode *vp; in vnode_fini() local
715 vp = mem; in vnode_fini()
716 vdbatch_dequeue(vp); in vnode_fini()
718 TAILQ_REMOVE(&vnode_list, vp, v_vnodelist); in vnode_fini()
720 rangelock_destroy(&vp->v_rl); in vnode_fini()
721 lockdestroy(vp->v_vnlock); in vnode_fini()
722 mtx_destroy(&vp->v_interlock); in vnode_fini()
723 bo = &vp->v_bufobj; in vnode_fini()
1241 struct vnode *vp, *mvp; in vlrureclaim() local
1254 vp = mvp; in vlrureclaim()
1256 vp = TAILQ_NEXT(vp, v_vnodelist); in vlrureclaim()
1257 if (__predict_false(vp == NULL)) in vlrureclaim()
1260 if (__predict_false(vp->v_type == VMARKER)) in vlrureclaim()
1269 if (vp->v_usecount > 0 || vp->v_holdcnt == 0 || in vlrureclaim()
1270 (!reclaim_nc_src && !LIST_EMPTY(&vp->v_cache_src))) in vlrureclaim()
1273 if (vp->v_type == VBAD || vp->v_type == VNON) in vlrureclaim()
1276 object = atomic_load_ptr(&vp->v_object); in vlrureclaim()
1288 if (!VI_TRYLOCK(vp)) in vlrureclaim()
1290 if (__predict_false(vp->v_type == VBAD || vp->v_type == VNON)) { in vlrureclaim()
1291 VI_UNLOCK(vp); in vlrureclaim()
1294 if (vp->v_mount == NULL) { in vlrureclaim()
1295 VI_UNLOCK(vp); in vlrureclaim()
1298 vholdl(vp); in vlrureclaim()
1299 VI_UNLOCK(vp); in vlrureclaim()
1301 TAILQ_INSERT_AFTER(&vnode_list, vp, mvp, v_vnodelist); in vlrureclaim()
1304 if (vn_start_write(vp, &mp, V_NOWAIT) != 0) { in vlrureclaim()
1305 vdrop_recycle(vp); in vlrureclaim()
1308 if (VOP_LOCK(vp, LK_EXCLUSIVE|LK_NOWAIT) != 0) { in vlrureclaim()
1309 vdrop_recycle(vp); in vlrureclaim()
1314 VI_LOCK(vp); in vlrureclaim()
1315 if (vp->v_usecount > 0 || in vlrureclaim()
1316 (!reclaim_nc_src && !LIST_EMPTY(&vp->v_cache_src)) || in vlrureclaim()
1317 (vp->v_object != NULL && vp->v_object->handle == vp && in vlrureclaim()
1318 vp->v_object->resident_page_count > trigger)) { in vlrureclaim()
1319 VOP_UNLOCK(vp); in vlrureclaim()
1320 vdropl_recycle(vp); in vlrureclaim()
1325 vgonel(vp); in vlrureclaim()
1326 VOP_UNLOCK(vp); in vlrureclaim()
1327 vdropl_recycle(vp); in vlrureclaim()
1335 MPASS(vp->v_type != VMARKER); in vlrureclaim()
1339 TAILQ_INSERT_AFTER(&vnode_list, vp, mvp, v_vnodelist); in vlrureclaim()
1367 struct vnode *vp; in vnlru_free_impl() local
1381 vp = mvp; in vnlru_free_impl()
1383 vp = TAILQ_NEXT(vp, v_vnodelist); in vnlru_free_impl()
1384 if (__predict_false(vp == NULL)) { in vnlru_free_impl()
1395 vp = mvp; in vnlru_free_impl()
1408 if (__predict_false(vp->v_type == VMARKER)) in vnlru_free_impl()
1410 if (vp->v_holdcnt > 0) in vnlru_free_impl()
1418 if (mnt_op != NULL && (mp = vp->v_mount) != NULL && in vnlru_free_impl()
1422 if (__predict_false(vp->v_type == VBAD || vp->v_type == VNON)) { in vnlru_free_impl()
1425 if (!vhold_recycle_free(vp)) in vnlru_free_impl()
1428 TAILQ_INSERT_AFTER(&vnode_list, vp, mvp, v_vnodelist); in vnlru_free_impl()
1451 vtryrecycle(vp, isvnlru); in vnlru_free_impl()
1457 vp = mvp; in vnlru_free_impl()
1904 vtryrecycle(struct vnode *vp, bool isvnlru) in vtryrecycle() argument
1908 CTR2(KTR_VFS, "%s: vp %p", __func__, vp); in vtryrecycle()
1909 VNPASS(vp->v_holdcnt > 0, vp); in vtryrecycle()
1914 if (VOP_LOCK(vp, LK_EXCLUSIVE | LK_NOWAIT) != 0) { in vtryrecycle()
1916 "%s: impossible to recycle, vp %p lock is already held", in vtryrecycle()
1917 __func__, vp); in vtryrecycle()
1918 vdrop_recycle(vp); in vtryrecycle()
1924 if (vn_start_write(vp, &vnmp, V_NOWAIT) != 0) { in vtryrecycle()
1925 VOP_UNLOCK(vp); in vtryrecycle()
1928 __func__, vp); in vtryrecycle()
1929 vdrop_recycle(vp); in vtryrecycle()
1938 VI_LOCK(vp); in vtryrecycle()
1939 if (vp->v_usecount) { in vtryrecycle()
1940 VOP_UNLOCK(vp); in vtryrecycle()
1941 vdropl_recycle(vp); in vtryrecycle()
1945 __func__, vp); in vtryrecycle()
1948 if (!VN_IS_DOOMED(vp)) { in vtryrecycle()
1953 vgonel(vp); in vtryrecycle()
1955 VOP_UNLOCK(vp); in vtryrecycle()
1956 vdropl_recycle(vp); in vtryrecycle()
2052 vn_free(struct vnode *vp) in vn_free() argument
2056 uma_zfree_smr(vnode_zone, vp); in vn_free()
2066 struct vnode *vp; in getnewvnode() local
2078 vp = td->td_vp_reserved; in getnewvnode()
2081 vp = vn_alloc(mp); in getnewvnode()
2085 vn_set_state(vp, VSTATE_UNINITIALIZED); in getnewvnode()
2101 lo = &vp->v_vnlock->lock_object; in getnewvnode()
2114 vp->v_vnlock->lock_object.lo_flags |= LK_NOSHARE; in getnewvnode()
2118 KASSERT(vp->v_object == NULL, ("stale v_object %p", vp)); in getnewvnode()
2119 KASSERT(vp->v_lockf == NULL, ("stale v_lockf %p", vp)); in getnewvnode()
2120 KASSERT(vp->v_pollinfo == NULL, ("stale v_pollinfo %p", vp)); in getnewvnode()
2121 vp->v_type = VNON; in getnewvnode()
2122 vp->v_op = vops; in getnewvnode()
2123 vp->v_irflag = 0; in getnewvnode()
2124 v_init_counters(vp); in getnewvnode()
2125 vn_seqc_init(vp); in getnewvnode()
2126 vp->v_bufobj.bo_ops = &buf_ops_bio; in getnewvnode()
2132 mac_vnode_init(vp); in getnewvnode()
2134 mac_vnode_associate_singlelabel(mp, vp); in getnewvnode()
2137 vp->v_bufobj.bo_bsize = mp->mnt_stat.f_iosize; in getnewvnode()
2146 vp->v_hash = (uintptr_t)vp >> vnsz2log; in getnewvnode()
2148 *vpp = vp; in getnewvnode()
2175 freevnode(struct vnode *vp) in freevnode() argument
2188 CTR2(KTR_VFS, "%s: destroying the vnode %p", __func__, vp); in freevnode()
2192 vn_seqc_write_end_free(vp); in freevnode()
2194 bo = &vp->v_bufobj; in freevnode()
2195 VNASSERT(vp->v_data == NULL, vp, ("cleaned vnode isn't")); in freevnode()
2196 VNPASS(vp->v_holdcnt == VHOLD_NO_SMR, vp); in freevnode()
2197 VNASSERT(vp->v_usecount == 0, vp, ("Non-zero use count")); in freevnode()
2198 VNASSERT(vp->v_writecount == 0, vp, ("Non-zero write count")); in freevnode()
2199 VNASSERT(bo->bo_numoutput == 0, vp, ("Clean vnode has pending I/O's")); in freevnode()
2200 VNASSERT(bo->bo_clean.bv_cnt == 0, vp, ("cleanbufcnt not 0")); in freevnode()
2201 VNASSERT(pctrie_is_empty(&bo->bo_clean.bv_root), vp, in freevnode()
2203 VNASSERT(bo->bo_dirty.bv_cnt == 0, vp, ("dirtybufcnt not 0")); in freevnode()
2204 VNASSERT(pctrie_is_empty(&bo->bo_dirty.bv_root), vp, in freevnode()
2206 VNASSERT((vp->v_iflag & (VI_DOINGINACT | VI_OWEINACT)) == 0, vp, in freevnode()
2208 VI_UNLOCK(vp); in freevnode()
2209 cache_assert_no_entries(vp); in freevnode()
2212 mac_vnode_destroy(vp); in freevnode()
2214 if (vp->v_pollinfo != NULL) { in freevnode()
2220 VOP_LOCK(vp, LK_EXCLUSIVE | LK_NOWAIT); in freevnode()
2221 destroy_vpollinfo(vp->v_pollinfo); in freevnode()
2222 VOP_UNLOCK(vp); in freevnode()
2223 vp->v_pollinfo = NULL; in freevnode()
2225 vp->v_mountedhere = NULL; in freevnode()
2226 vp->v_unpcb = NULL; in freevnode()
2227 vp->v_rdev = NULL; in freevnode()
2228 vp->v_fifoinfo = NULL; in freevnode()
2229 vp->v_iflag = 0; in freevnode()
2230 vp->v_vflag = 0; in freevnode()
2232 vn_free(vp); in freevnode()
2239 delmntque(struct vnode *vp) in delmntque() argument
2243 VNPASS((vp->v_mflag & VMP_LAZYLIST) == 0, vp); in delmntque()
2245 mp = vp->v_mount; in delmntque()
2247 VI_LOCK(vp); in delmntque()
2248 vp->v_mount = NULL; in delmntque()
2249 VNASSERT(mp->mnt_nvnodelistsize > 0, vp, in delmntque()
2251 TAILQ_REMOVE(&mp->mnt_nvnodelist, vp, v_nmntvnodes); in delmntque()
2258 ASSERT_VI_LOCKED(vp, __func__); in delmntque()
2262 insmntque1_int(struct vnode *vp, struct mount *mp, bool dtr) in insmntque1_int() argument
2265 KASSERT(vp->v_mount == NULL, in insmntque1_int()
2267 VNASSERT(mp != NULL, vp, ("Don't call insmntque(foo, NULL)")); in insmntque1_int()
2269 ASSERT_VOP_ELOCKED(vp, "insmntque: non-locked vp"); in insmntque1_int()
2286 VI_LOCK(vp); in insmntque1_int()
2290 (vp->v_vflag & VV_FORCEINSMQ) == 0) { in insmntque1_int()
2291 VI_UNLOCK(vp); in insmntque1_int()
2294 vp->v_data = NULL; in insmntque1_int()
2295 vp->v_op = &dead_vnodeops; in insmntque1_int()
2296 vgone(vp); in insmntque1_int()
2297 vput(vp); in insmntque1_int()
2301 vp->v_mount = mp; in insmntque1_int()
2303 TAILQ_INSERT_TAIL(&mp->mnt_nvnodelist, vp, v_nmntvnodes); in insmntque1_int()
2304 VNASSERT(mp->mnt_nvnodelistsize >= 0, vp, in insmntque1_int()
2307 VI_UNLOCK(vp); in insmntque1_int()
2318 insmntque(struct vnode *vp, struct mount *mp) in insmntque() argument
2320 return (insmntque1_int(vp, mp, true)); in insmntque()
2324 insmntque1(struct vnode *vp, struct mount *mp) in insmntque1() argument
2326 return (insmntque1_int(vp, mp, false)); in insmntque1()
2421 vinvalbuf(struct vnode *vp, int flags, int slpflag, int slptimeo) in vinvalbuf() argument
2424 CTR3(KTR_VFS, "%s: vp %p with flags %d", __func__, vp, flags); in vinvalbuf()
2425 ASSERT_VOP_LOCKED(vp, "vinvalbuf"); in vinvalbuf()
2426 if (vp->v_object != NULL && vp->v_object->handle != vp) in vinvalbuf()
2428 return (bufobj_invalbuf(&vp->v_bufobj, flags, slpflag, slptimeo)); in vinvalbuf()
2553 vtruncbuf(struct vnode *vp, off_t length, int blksize) in vtruncbuf() argument
2559 CTR4(KTR_VFS, "%s: vp %p with block %d:%ju", __func__, in vtruncbuf()
2560 vp, blksize, (uintmax_t)length); in vtruncbuf()
2567 ASSERT_VOP_LOCKED(vp, "vtruncbuf"); in vtruncbuf()
2569 bo = &vp->v_bufobj; in vtruncbuf()
2573 while (v_inval_buf_range_locked(vp, bo, startlbn, INT64_MAX) == EAGAIN) in vtruncbuf()
2593 VNASSERT((bp->b_flags & B_DELWRI), vp, in vtruncbuf()
2605 vnode_pager_setsize(vp, length); in vtruncbuf()
2615 v_inval_buf_range(struct vnode *vp, daddr_t startlbn, daddr_t endlbn, in v_inval_buf_range() argument
2621 ASSERT_VOP_LOCKED(vp, "v_inval_buf_range"); in v_inval_buf_range()
2626 bo = &vp->v_bufobj; in v_inval_buf_range()
2630 while (v_inval_buf_range_locked(vp, bo, startlbn, endlbn) == EAGAIN) in v_inval_buf_range()
2634 vn_pages_remove(vp, OFF_TO_IDX(start), OFF_TO_IDX(end + PAGE_SIZE - 1)); in v_inval_buf_range()
2638 v_inval_buf_range_locked(struct vnode *vp, struct bufobj *bo, in v_inval_buf_range_locked() argument
2646 ASSERT_VOP_LOCKED(vp, "v_inval_buf_range_locked"); in v_inval_buf_range_locked()
2676 nbp->b_vp != vp || in v_inval_buf_range_locked()
2825 bgetvp(struct vnode *vp, struct buf *bp) in bgetvp() argument
2830 bo = &vp->v_bufobj; in bgetvp()
2834 CTR3(KTR_BUF, "bgetvp(%p) vp %p flags %X", bp, vp, bp->b_flags); in bgetvp()
2835 VNASSERT((bp->b_xflags & (BX_VNDIRTY|BX_VNCLEAN)) == 0, vp, in bgetvp()
2842 bp->b_vp = vp; in bgetvp()
2851 vhold(vp); in bgetvp()
2869 struct vnode *vp; in brelvp() local
2871 CTR3(KTR_BUF, "brelvp(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags); in brelvp()
2877 vp = bp->b_vp; /* XXX */ in brelvp()
2891 vdrop(vp); in brelvp()
2948 struct vnode *vp; in sync_vnode() local
2954 vp = bo2vnode(*bo); in sync_vnode()
2955 if (VOP_ISLOCKED(vp) != 0 || VI_TRYLOCK(vp) == 0) in sync_vnode()
2963 vholdl(vp); in sync_vnode()
2965 VI_UNLOCK(vp); in sync_vnode()
2966 if (vn_start_write(vp, &mp, V_NOWAIT) != 0) { in sync_vnode()
2967 vdrop(vp); in sync_vnode()
2973 ("suspended mp syncing vp %p", vp)); in sync_vnode()
2974 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); in sync_vnode()
2975 (void) VOP_FSYNC(vp, MNT_LAZY, td); in sync_vnode()
2976 VOP_UNLOCK(vp); in sync_vnode()
2989 vdrop(vp); in sync_vnode()
3200 struct vnode *vp; in reassignbuf() local
3207 vp = bp->b_vp; in reassignbuf()
3213 CTR3(KTR_BUF, "reassignbuf(%p) vp %p flags %X", in reassignbuf()
3235 switch (vp->v_type) { in reassignbuf()
3279 v_init_counters(struct vnode *vp) in v_init_counters() argument
3282 VNASSERT(vp->v_type == VNON && vp->v_data == NULL && vp->v_iflag == 0, in v_init_counters()
3283 vp, ("%s called for an initialized vnode", __FUNCTION__)); in v_init_counters()
3284 ASSERT_VI_UNLOCKED(vp, __FUNCTION__); in v_init_counters()
3286 refcount_init(&vp->v_holdcnt, 1); in v_init_counters()
3287 refcount_init(&vp->v_usecount, 1); in v_init_counters()
3301 vget_prep_smr(struct vnode *vp) in vget_prep_smr() argument
3307 if (refcount_acquire_if_not_zero(&vp->v_usecount)) { in vget_prep_smr()
3310 if (vhold_smr(vp)) in vget_prep_smr()
3319 vget_prep(struct vnode *vp) in vget_prep() argument
3323 if (refcount_acquire_if_not_zero(&vp->v_usecount)) { in vget_prep()
3326 vhold(vp); in vget_prep()
3333 vget_abort(struct vnode *vp, enum vgetstate vs) in vget_abort() argument
3338 vrele(vp); in vget_abort()
3341 vdrop(vp); in vget_abort()
3349 vget(struct vnode *vp, int flags) in vget() argument
3353 vs = vget_prep(vp); in vget()
3354 return (vget_finish(vp, flags, vs)); in vget()
3358 vget_finish(struct vnode *vp, int flags, enum vgetstate vs) in vget_finish() argument
3363 ASSERT_VI_LOCKED(vp, __func__); in vget_finish()
3365 ASSERT_VI_UNLOCKED(vp, __func__); in vget_finish()
3366 VNPASS(vs == VGET_HOLDCNT || vs == VGET_USECOUNT, vp); in vget_finish()
3367 VNPASS(vp->v_holdcnt > 0, vp); in vget_finish()
3368 VNPASS(vs == VGET_HOLDCNT || vp->v_usecount > 0, vp); in vget_finish()
3370 error = vn_lock(vp, flags); in vget_finish()
3372 vget_abort(vp, vs); in vget_finish()
3374 vp); in vget_finish()
3378 vget_finish_ref(vp, vs); in vget_finish()
3383 vget_finish_ref(struct vnode *vp, enum vgetstate vs) in vget_finish_ref() argument
3387 VNPASS(vs == VGET_HOLDCNT || vs == VGET_USECOUNT, vp); in vget_finish_ref()
3388 VNPASS(vp->v_holdcnt > 0, vp); in vget_finish_ref()
3389 VNPASS(vs == VGET_HOLDCNT || vp->v_usecount > 0, vp); in vget_finish_ref()
3399 old = atomic_fetchadd_int(&vp->v_usecount, 1); in vget_finish_ref()
3400 VNASSERT(old >= 0, vp, ("%s: wrong use count %d", __func__, old)); in vget_finish_ref()
3403 old = atomic_fetchadd_int(&vp->v_holdcnt, -1); in vget_finish_ref()
3404 VNASSERT(old > 1, vp, ("%s: wrong hold count %d", __func__, old)); in vget_finish_ref()
3406 refcount_release(&vp->v_holdcnt); in vget_finish_ref()
3412 vref(struct vnode *vp) in vref() argument
3416 CTR2(KTR_VFS, "%s: vp %p", __func__, vp); in vref()
3417 vs = vget_prep(vp); in vref()
3418 vget_finish_ref(vp, vs); in vref()
3422 vrefact(struct vnode *vp) in vrefact() argument
3426 CTR2(KTR_VFS, "%s: vp %p", __func__, vp); in vrefact()
3427 old = refcount_acquire(&vp->v_usecount); in vrefact()
3428 VNASSERT(old > 0, vp, ("%s: wrong use count %d", __func__, old)); in vrefact()
3432 vlazy(struct vnode *vp) in vlazy() argument
3436 VNASSERT(vp->v_holdcnt > 0, vp, ("%s: vnode not held", __func__)); in vlazy()
3438 if ((vp->v_mflag & VMP_LAZYLIST) != 0) in vlazy()
3443 if (VN_IS_DOOMED(vp)) in vlazy()
3445 mp = vp->v_mount; in vlazy()
3447 if ((vp->v_mflag & VMP_LAZYLIST) == 0) { in vlazy()
3448 vp->v_mflag |= VMP_LAZYLIST; in vlazy()
3449 TAILQ_INSERT_TAIL(&mp->mnt_lazyvnodelist, vp, v_lazylist); in vlazy()
3456 vunlazy(struct vnode *vp) in vunlazy() argument
3460 ASSERT_VI_LOCKED(vp, __func__); in vunlazy()
3461 VNPASS(!VN_IS_DOOMED(vp), vp); in vunlazy()
3463 mp = vp->v_mount; in vunlazy()
3465 VNPASS(vp->v_mflag & VMP_LAZYLIST, vp); in vunlazy()
3472 if (vp->v_holdcnt == 0) { in vunlazy()
3473 vp->v_mflag &= ~VMP_LAZYLIST; in vunlazy()
3474 TAILQ_REMOVE(&mp->mnt_lazyvnodelist, vp, v_lazylist); in vunlazy()
3485 vunlazy_gone(struct vnode *vp) in vunlazy_gone() argument
3489 ASSERT_VOP_ELOCKED(vp, __func__); in vunlazy_gone()
3490 ASSERT_VI_LOCKED(vp, __func__); in vunlazy_gone()
3491 VNPASS(!VN_IS_DOOMED(vp), vp); in vunlazy_gone()
3493 if (vp->v_mflag & VMP_LAZYLIST) { in vunlazy_gone()
3494 mp = vp->v_mount; in vunlazy_gone()
3496 VNPASS(vp->v_mflag & VMP_LAZYLIST, vp); in vunlazy_gone()
3497 vp->v_mflag &= ~VMP_LAZYLIST; in vunlazy_gone()
3498 TAILQ_REMOVE(&mp->mnt_lazyvnodelist, vp, v_lazylist); in vunlazy_gone()
3505 vdefer_inactive(struct vnode *vp) in vdefer_inactive() argument
3508 ASSERT_VI_LOCKED(vp, __func__); in vdefer_inactive()
3509 VNPASS(vp->v_holdcnt > 0, vp); in vdefer_inactive()
3510 if (VN_IS_DOOMED(vp)) { in vdefer_inactive()
3511 vdropl(vp); in vdefer_inactive()
3514 if (vp->v_iflag & VI_DEFINACT) { in vdefer_inactive()
3515 VNPASS(vp->v_holdcnt > 1, vp); in vdefer_inactive()
3516 vdropl(vp); in vdefer_inactive()
3519 if (vp->v_usecount > 0) { in vdefer_inactive()
3520 vp->v_iflag &= ~VI_OWEINACT; in vdefer_inactive()
3521 vdropl(vp); in vdefer_inactive()
3524 vlazy(vp); in vdefer_inactive()
3525 vp->v_iflag |= VI_DEFINACT; in vdefer_inactive()
3526 VI_UNLOCK(vp); in vdefer_inactive()
3531 vdefer_inactive_unlocked(struct vnode *vp) in vdefer_inactive_unlocked() argument
3534 VI_LOCK(vp); in vdefer_inactive_unlocked()
3535 if ((vp->v_iflag & VI_OWEINACT) == 0) { in vdefer_inactive_unlocked()
3536 vdropl(vp); in vdefer_inactive_unlocked()
3539 vdefer_inactive(vp); in vdefer_inactive_unlocked()
3561 vput_final(struct vnode *vp, enum vput_op func) in vput_final() argument
3566 CTR2(KTR_VFS, "%s: vp %p", __func__, vp); in vput_final()
3567 VNPASS(vp->v_holdcnt > 0, vp); in vput_final()
3569 VI_LOCK(vp); in vput_final()
3575 if (vp->v_usecount > 0) in vput_final()
3582 if (VN_IS_DOOMED(vp)) in vput_final()
3585 if (__predict_true(VOP_NEED_INACTIVE(vp) == 0)) in vput_final()
3588 if (vp->v_iflag & VI_DOINGINACT) in vput_final()
3597 vp->v_iflag |= VI_OWEINACT; in vput_final()
3602 switch (VOP_ISLOCKED(vp)) { in vput_final()
3608 error = vn_lock(vp, LK_EXCLUSIVE | LK_INTERLOCK); in vput_final()
3609 VI_LOCK(vp); in vput_final()
3623 if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) { in vput_final()
3624 error = VOP_LOCK(vp, LK_UPGRADE | LK_INTERLOCK | in vput_final()
3626 VI_LOCK(vp); in vput_final()
3630 if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) { in vput_final()
3631 error = VOP_LOCK(vp, LK_TRYUPGRADE | LK_INTERLOCK); in vput_final()
3632 VI_LOCK(vp); in vput_final()
3638 VNASSERT((vp->v_vflag & VV_UNREF) == 0, vp, in vput_final()
3640 vp->v_vflag |= VV_UNREF; in vput_final()
3643 error = vinactive(vp); in vput_final()
3645 VOP_UNLOCK(vp); in vput_final()
3648 VOP_LOCK(vp, LK_EXCLUSIVE); in vput_final()
3651 vp->v_vflag &= ~VV_UNREF; in vput_final()
3652 vdropl(vp); in vput_final()
3654 vdefer_inactive(vp); in vput_final()
3659 VOP_UNLOCK(vp); in vput_final()
3660 vdropl(vp); in vput_final()
3677 vrele(struct vnode *vp) in vrele() argument
3680 ASSERT_VI_UNLOCKED(vp, __func__); in vrele()
3681 if (!refcount_release(&vp->v_usecount)) in vrele()
3683 vput_final(vp, VRELE); in vrele()
3691 vput(struct vnode *vp) in vput() argument
3694 ASSERT_VOP_LOCKED(vp, __func__); in vput()
3695 ASSERT_VI_UNLOCKED(vp, __func__); in vput()
3696 if (!refcount_release(&vp->v_usecount)) { in vput()
3697 VOP_UNLOCK(vp); in vput()
3700 vput_final(vp, VPUT); in vput()
3708 vunref(struct vnode *vp) in vunref() argument
3711 ASSERT_VOP_LOCKED(vp, __func__); in vunref()
3712 ASSERT_VI_UNLOCKED(vp, __func__); in vunref()
3713 if (!refcount_release(&vp->v_usecount)) in vunref()
3715 vput_final(vp, VUNREF); in vunref()
3719 vhold(struct vnode *vp) in vhold() argument
3723 CTR2(KTR_VFS, "%s: vp %p", __func__, vp); in vhold()
3724 old = atomic_fetchadd_int(&vp->v_holdcnt, 1); in vhold()
3725 VNASSERT(old >= 0 && (old & VHOLD_ALL_FLAGS) == 0, vp, in vhold()
3732 vholdnz(struct vnode *vp) in vholdnz() argument
3735 CTR2(KTR_VFS, "%s: vp %p", __func__, vp); in vholdnz()
3737 int old = atomic_fetchadd_int(&vp->v_holdcnt, 1); in vholdnz()
3738 VNASSERT(old > 0 && (old & VHOLD_ALL_FLAGS) == 0, vp, in vholdnz()
3741 atomic_add_int(&vp->v_holdcnt, 1); in vholdnz()
3756 * count = atomic_fetchadd_int(&vp->v_holdcnt, 1);
3765 vhold_smr(struct vnode *vp) in vhold_smr() argument
3771 count = atomic_load_int(&vp->v_holdcnt); in vhold_smr()
3774 VNASSERT((count & ~VHOLD_NO_SMR) == 0, vp, in vhold_smr()
3778 VNASSERT(count >= 0, vp, ("invalid hold count %d\n", count)); in vhold_smr()
3779 if (atomic_fcmpset_int(&vp->v_holdcnt, &count, count + 1)) { in vhold_smr()
3804 vhold_recycle_free(struct vnode *vp) in vhold_recycle_free() argument
3810 count = atomic_load_int(&vp->v_holdcnt); in vhold_recycle_free()
3813 VNASSERT((count & ~VHOLD_NO_SMR) == 0, vp, in vhold_recycle_free()
3817 VNASSERT(count >= 0, vp, ("invalid hold count %d\n", count)); in vhold_recycle_free()
3821 if (atomic_fcmpset_int(&vp->v_holdcnt, &count, count + 1)) { in vhold_recycle_free()
3831 struct vnode *vp; in vdbatch_process() local
3854 vp = vd->tab[i]; in vdbatch_process()
3856 MPASS(vp->v_dbatchcpu != NOCPU); in vdbatch_process()
3857 vp->v_dbatchcpu = NOCPU; in vdbatch_process()
3872 vp = vd->tab[i]; in vdbatch_process()
3874 TAILQ_REMOVE(&vnode_list, vp, v_vnodelist); in vdbatch_process()
3875 TAILQ_INSERT_TAIL(&vnode_list, vp, v_vnodelist); in vdbatch_process()
3876 MPASS(vp->v_dbatchcpu != NOCPU); in vdbatch_process()
3877 vp->v_dbatchcpu = NOCPU; in vdbatch_process()
3885 vdbatch_enqueue(struct vnode *vp) in vdbatch_enqueue() argument
3889 ASSERT_VI_LOCKED(vp, __func__); in vdbatch_enqueue()
3890 VNPASS(!VN_IS_DOOMED(vp), vp); in vdbatch_enqueue()
3892 if (vp->v_dbatchcpu != NOCPU) { in vdbatch_enqueue()
3893 VI_UNLOCK(vp); in vdbatch_enqueue()
3906 vp->v_dbatchcpu = curcpu; in vdbatch_enqueue()
3907 vd->tab[vd->index] = vp; in vdbatch_enqueue()
3909 VI_UNLOCK(vp); in vdbatch_enqueue()
3922 vdbatch_dequeue(struct vnode *vp) in vdbatch_dequeue() argument
3928 VNPASS(vp->v_type == VBAD || vp->v_type == VNON, vp); in vdbatch_dequeue()
3930 cpu = vp->v_dbatchcpu; in vdbatch_dequeue()
3937 if (vd->tab[i] != vp) in vdbatch_dequeue()
3939 vp->v_dbatchcpu = NOCPU; in vdbatch_dequeue()
3949 MPASS(vp->v_dbatchcpu == NOCPU); in vdbatch_dequeue()
3962 vdropl_final(struct vnode *vp) in vdropl_final() argument
3965 ASSERT_VI_LOCKED(vp, __func__); in vdropl_final()
3966 VNPASS(VN_IS_DOOMED(vp), vp); in vdropl_final()
3973 if (__predict_false(!atomic_cmpset_int(&vp->v_holdcnt, 0, VHOLD_NO_SMR))) { in vdropl_final()
3975 VI_UNLOCK(vp); in vdropl_final()
3985 freevnode(vp); in vdropl_final()
3989 vdrop(struct vnode *vp) in vdrop() argument
3992 ASSERT_VI_UNLOCKED(vp, __func__); in vdrop()
3993 CTR2(KTR_VFS, "%s: vp %p", __func__, vp); in vdrop()
3994 if (refcount_release_if_not_last(&vp->v_holdcnt)) in vdrop()
3996 VI_LOCK(vp); in vdrop()
3997 vdropl(vp); in vdrop()
4001 vdropl_impl(struct vnode *vp, bool enqueue) in vdropl_impl() argument
4004 ASSERT_VI_LOCKED(vp, __func__); in vdropl_impl()
4005 CTR2(KTR_VFS, "%s: vp %p", __func__, vp); in vdropl_impl()
4006 if (!refcount_release(&vp->v_holdcnt)) { in vdropl_impl()
4007 VI_UNLOCK(vp); in vdropl_impl()
4010 VNPASS((vp->v_iflag & VI_OWEINACT) == 0, vp); in vdropl_impl()
4011 VNPASS((vp->v_iflag & VI_DEFINACT) == 0, vp); in vdropl_impl()
4012 if (VN_IS_DOOMED(vp)) { in vdropl_impl()
4013 vdropl_final(vp); in vdropl_impl()
4018 if (vp->v_mflag & VMP_LAZYLIST) { in vdropl_impl()
4019 vunlazy(vp); in vdropl_impl()
4023 VI_UNLOCK(vp); in vdropl_impl()
4032 vdbatch_enqueue(vp); in vdropl_impl()
4036 vdropl(struct vnode *vp) in vdropl() argument
4039 vdropl_impl(vp, true); in vdropl()
4054 vdropl_recycle(struct vnode *vp) in vdropl_recycle() argument
4057 vdropl_impl(vp, false); in vdropl_recycle()
4061 vdrop_recycle(struct vnode *vp) in vdrop_recycle() argument
4064 VI_LOCK(vp); in vdrop_recycle()
4065 vdropl_recycle(vp); in vdrop_recycle()
4073 vinactivef(struct vnode *vp) in vinactivef() argument
4077 ASSERT_VOP_ELOCKED(vp, "vinactive"); in vinactivef()
4078 ASSERT_VI_LOCKED(vp, "vinactive"); in vinactivef()
4079 VNPASS((vp->v_iflag & VI_DOINGINACT) == 0, vp); in vinactivef()
4080 CTR2(KTR_VFS, "%s: vp %p", __func__, vp); in vinactivef()
4081 vp->v_iflag |= VI_DOINGINACT; in vinactivef()
4082 vp->v_iflag &= ~VI_OWEINACT; in vinactivef()
4083 VI_UNLOCK(vp); in vinactivef()
4095 if ((vp->v_vflag & VV_NOSYNC) == 0) in vinactivef()
4096 vnode_pager_clean_async(vp); in vinactivef()
4098 error = VOP_INACTIVE(vp); in vinactivef()
4099 VI_LOCK(vp); in vinactivef()
4100 VNPASS(vp->v_iflag & VI_DOINGINACT, vp); in vinactivef()
4101 vp->v_iflag &= ~VI_DOINGINACT; in vinactivef()
4106 vinactive(struct vnode *vp) in vinactive() argument
4109 ASSERT_VOP_ELOCKED(vp, "vinactive"); in vinactive()
4110 ASSERT_VI_LOCKED(vp, "vinactive"); in vinactive()
4111 CTR2(KTR_VFS, "%s: vp %p", __func__, vp); in vinactive()
4113 if ((vp->v_iflag & VI_OWEINACT) == 0) in vinactive()
4115 if (vp->v_iflag & VI_DOINGINACT) in vinactive()
4117 if (vp->v_usecount > 0) { in vinactive()
4118 vp->v_iflag &= ~VI_OWEINACT; in vinactive()
4121 return (vinactivef(vp)); in vinactive()
4152 struct vnode *vp, *mvp, *rootvp = NULL; in vflush() local
4173 MNT_VNODE_FOREACH_ALL(vp, mp, mvp) { in vflush()
4174 vholdl(vp); in vflush()
4175 error = vn_lock(vp, LK_INTERLOCK | LK_EXCLUSIVE); in vflush()
4177 vdrop(vp); in vflush()
4184 if ((flags & SKIPSYSTEM) && (vp->v_vflag & VV_SYSTEM)) { in vflush()
4185 VOP_UNLOCK(vp); in vflush()
4186 vdrop(vp); in vflush()
4195 vnode_pager_clean_async(vp); in vflush()
4197 error = VOP_FSYNC(vp, MNT_WAIT, td); in vflush()
4200 VOP_UNLOCK(vp); in vflush()
4201 vdrop(vp); in vflush()
4205 error = VOP_GETATTR(vp, &vattr, td->td_ucred); in vflush()
4206 VI_LOCK(vp); in vflush()
4208 if ((vp->v_type == VNON || in vflush()
4210 (vp->v_writecount <= 0 || vp->v_type != VREG)) { in vflush()
4211 VOP_UNLOCK(vp); in vflush()
4212 vdropl(vp); in vflush()
4216 VI_LOCK(vp); in vflush()
4223 if (vp->v_usecount == 0 || (flags & FORCECLOSE)) { in vflush()
4224 vgonel(vp); in vflush()
4229 vn_printf(vp, "vflush: busy vnode "); in vflush()
4232 VOP_UNLOCK(vp); in vflush()
4233 vdropl(vp); in vflush()
4267 vrecycle(struct vnode *vp) in vrecycle() argument
4271 VI_LOCK(vp); in vrecycle()
4272 recycled = vrecyclel(vp); in vrecycle()
4273 VI_UNLOCK(vp); in vrecycle()
4278 * vrecycle, with the vp interlock held.
4281 vrecyclel(struct vnode *vp) in vrecyclel() argument
4285 ASSERT_VOP_ELOCKED(vp, __func__); in vrecyclel()
4286 ASSERT_VI_LOCKED(vp, __func__); in vrecyclel()
4287 CTR2(KTR_VFS, "%s: vp %p", __func__, vp); in vrecyclel()
4289 if (vp->v_usecount == 0) { in vrecyclel()
4291 vgonel(vp); in vrecyclel()
4301 vgone(struct vnode *vp) in vgone() argument
4303 VI_LOCK(vp); in vgone()
4304 vgonel(vp); in vgone()
4305 VI_UNLOCK(vp); in vgone()
4312 vfs_notify_upper(struct vnode *vp, enum vfs_notify_upper_type event) in vfs_notify_upper() argument
4317 mp = atomic_load_ptr(&vp->v_mount); in vfs_notify_upper()
4331 VFS_RECLAIM_LOWERVP(ump->mp, vp); in vfs_notify_upper()
4334 VFS_UNLINK_LOWERVP(ump->mp, vp); in vfs_notify_upper()
4349 * vgone, with the vp interlock held.
4352 vgonel(struct vnode *vp) in vgonel() argument
4359 ASSERT_VOP_ELOCKED(vp, "vgonel"); in vgonel()
4360 ASSERT_VI_LOCKED(vp, "vgonel"); in vgonel()
4361 VNASSERT(vp->v_holdcnt, vp, in vgonel()
4362 ("vgonel: vp %p has no reference.", vp)); in vgonel()
4363 CTR2(KTR_VFS, "%s: vp %p", __func__, vp); in vgonel()
4369 if (VN_IS_DOOMED(vp)) { in vgonel()
4370 VNPASS(vn_get_state(vp) == VSTATE_DESTROYING || \ in vgonel()
4371 vn_get_state(vp) == VSTATE_DEAD, vp); in vgonel()
4377 vn_seqc_write_begin_locked(vp); in vgonel()
4378 vunlazy_gone(vp); in vgonel()
4379 vn_irflag_set_locked(vp, VIRF_DOOMED); in vgonel()
4380 vn_set_state(vp, VSTATE_DESTROYING); in vgonel()
4390 active = vp->v_usecount > 0; in vgonel()
4391 oweinact = (vp->v_iflag & VI_OWEINACT) != 0; in vgonel()
4392 doinginact = (vp->v_iflag & VI_DOINGINACT) != 0; in vgonel()
4397 if (vp->v_iflag & VI_DEFINACT) { in vgonel()
4398 VNASSERT(vp->v_holdcnt > 1, vp, ("lost hold count")); in vgonel()
4399 vp->v_iflag &= ~VI_DEFINACT; in vgonel()
4400 vdropl(vp); in vgonel()
4402 VNASSERT(vp->v_holdcnt > 0, vp, ("vnode without hold count")); in vgonel()
4403 VI_UNLOCK(vp); in vgonel()
4405 cache_purge_vgone(vp); in vgonel()
4406 vfs_notify_upper(vp, VFS_NOTIFY_UPPER_RECLAIM); in vgonel()
4413 VOP_CLOSE(vp, FNONBLOCK, NOCRED, td); in vgonel()
4417 VI_LOCK(vp); in vgonel()
4418 vinactivef(vp); in vgonel()
4419 oweinact = (vp->v_iflag & VI_OWEINACT) != 0; in vgonel()
4420 VI_UNLOCK(vp); in vgonel()
4424 if (vp->v_type == VSOCK) in vgonel()
4425 vfs_unp_reclaim(vp); in vgonel()
4432 if (!TAILQ_EMPTY(&vp->v_bufobj.bo_dirty.bv_hd)) in vgonel()
4433 (void) vn_start_secondary_write(vp, &mp, V_WAIT); in vgonel()
4434 if (vinvalbuf(vp, V_SAVE, 0, 0) != 0) { in vgonel()
4435 while (vinvalbuf(vp, 0, 0, 0) != 0) in vgonel()
4439 BO_LOCK(&vp->v_bufobj); in vgonel()
4440 KASSERT(TAILQ_EMPTY(&vp->v_bufobj.bo_dirty.bv_hd) && in vgonel()
4441 vp->v_bufobj.bo_dirty.bv_cnt == 0 && in vgonel()
4442 TAILQ_EMPTY(&vp->v_bufobj.bo_clean.bv_hd) && in vgonel()
4443 vp->v_bufobj.bo_clean.bv_cnt == 0, in vgonel()
4444 ("vp %p bufobj not invalidated", vp)); in vgonel()
4451 object = vp->v_bufobj.bo_object; in vgonel()
4453 vp->v_bufobj.bo_flag |= BO_DEAD; in vgonel()
4454 BO_UNLOCK(&vp->v_bufobj); in vgonel()
4463 object->handle == vp) in vgonel()
4464 vnode_destroy_vobject(vp); in vgonel()
4469 if (VOP_RECLAIM(vp)) in vgonel()
4473 VNASSERT(vp->v_object == NULL, vp, in vgonel()
4474 ("vop_reclaim left v_object vp=%p", vp)); in vgonel()
4478 if (vp->v_lockf != NULL) { in vgonel()
4479 (void)VOP_ADVLOCKPURGE(vp); in vgonel()
4480 vp->v_lockf = NULL; in vgonel()
4485 if (vp->v_mount == NULL) { in vgonel()
4486 VI_LOCK(vp); in vgonel()
4488 delmntque(vp); in vgonel()
4489 ASSERT_VI_LOCKED(vp, "vgonel 2"); in vgonel()
4495 vp->v_vnlock = &vp->v_lock; in vgonel()
4496 vp->v_op = &dead_vnodeops; in vgonel()
4497 vp->v_type = VBAD; in vgonel()
4498 vn_set_state(vp, VSTATE_DEAD); in vgonel()
4532 vn_printf(struct vnode *vp, const char *fmt, ...) in vn_printf() argument
4543 printf("%p: ", (void *)vp); in vn_printf()
4544 printf("type %s state %s op %p\n", vtypename[vp->v_type], in vn_printf()
4545 vstatename[vp->v_state], vp->v_op); in vn_printf()
4546 holdcnt = atomic_load_int(&vp->v_holdcnt); in vn_printf()
4548 vp->v_usecount, vp->v_writecount, holdcnt & ~VHOLD_ALL_FLAGS, in vn_printf()
4549 vp->v_seqc_users); in vn_printf()
4550 switch (vp->v_type) { in vn_printf()
4552 printf(" mountedhere %p\n", vp->v_mountedhere); in vn_printf()
4555 printf(" rdev %p\n", vp->v_rdev); in vn_printf()
4558 printf(" socket %p\n", vp->v_unpcb); in vn_printf()
4561 printf(" fifoinfo %p\n", vp->v_fifoinfo); in vn_printf()
4575 irflag = vn_irflag_read(vp); in vn_printf()
4589 if (vp->v_vflag & VV_ROOT) in vn_printf()
4591 if (vp->v_vflag & VV_ISTTY) in vn_printf()
4593 if (vp->v_vflag & VV_NOSYNC) in vn_printf()
4595 if (vp->v_vflag & VV_ETERNALDEV) in vn_printf()
4597 if (vp->v_vflag & VV_CACHEDLABEL) in vn_printf()
4599 if (vp->v_vflag & VV_VMSIZEVNLOCK) in vn_printf()
4601 if (vp->v_vflag & VV_COPYONWRITE) in vn_printf()
4603 if (vp->v_vflag & VV_SYSTEM) in vn_printf()
4605 if (vp->v_vflag & VV_PROCDEP) in vn_printf()
4607 if (vp->v_vflag & VV_DELETED) in vn_printf()
4609 if (vp->v_vflag & VV_MD) in vn_printf()
4611 if (vp->v_vflag & VV_FORCEINSMQ) in vn_printf()
4613 if (vp->v_vflag & VV_READLINK) in vn_printf()
4615 flags = vp->v_vflag & ~(VV_ROOT | VV_ISTTY | VV_NOSYNC | VV_ETERNALDEV | in vn_printf()
4622 if (vp->v_iflag & VI_MOUNT) in vn_printf()
4624 if (vp->v_iflag & VI_DOINGINACT) in vn_printf()
4626 if (vp->v_iflag & VI_OWEINACT) in vn_printf()
4628 if (vp->v_iflag & VI_DEFINACT) in vn_printf()
4630 if (vp->v_iflag & VI_FOPENING) in vn_printf()
4632 flags = vp->v_iflag & ~(VI_MOUNT | VI_DOINGINACT | in vn_printf()
4638 if (vp->v_mflag & VMP_LAZYLIST) in vn_printf()
4640 flags = vp->v_mflag & ~(VMP_LAZYLIST); in vn_printf()
4646 if (mtx_owned(VI_MTX(vp))) in vn_printf()
4649 if (vp->v_object != NULL) in vn_printf()
4652 vp->v_object, vp->v_object->ref_count, in vn_printf()
4653 vp->v_object->resident_page_count, in vn_printf()
4654 vp->v_bufobj.bo_clean.bv_cnt, in vn_printf()
4655 vp->v_bufobj.bo_dirty.bv_cnt); in vn_printf()
4657 lockmgr_printinfo(vp->v_vnlock); in vn_printf()
4658 if (vp->v_data != NULL) in vn_printf()
4659 VOP_PRINT(vp); in vn_printf()
4670 struct vnode *vp; in DB_SHOW_COMMAND_FLAGS() local
4680 TAILQ_FOREACH(vp, &mp->mnt_nvnodelist, v_nmntvnodes) { in DB_SHOW_COMMAND_FLAGS()
4681 if (vp->v_type != VMARKER && VOP_ISLOCKED(vp)) in DB_SHOW_COMMAND_FLAGS()
4682 vn_printf(vp, "vnode "); in DB_SHOW_COMMAND_FLAGS()
4692 struct vnode *vp; in DB_SHOW_COMMAND() local
4696 vp = (struct vnode *)addr; in DB_SHOW_COMMAND()
4697 vn_printf(vp, "vnode "); in DB_SHOW_COMMAND()
4708 struct vnode *vp; in DB_SHOW_COMMAND() local
4878 TAILQ_FOREACH(vp, &mp->mnt_nvnodelist, v_nmntvnodes) { in DB_SHOW_COMMAND()
4879 if (vp->v_type != VMARKER && vp->v_holdcnt > 0) { in DB_SHOW_COMMAND()
4880 vn_printf(vp, "vnode "); in DB_SHOW_COMMAND()
4886 TAILQ_FOREACH(vp, &mp->mnt_nvnodelist, v_nmntvnodes) { in DB_SHOW_COMMAND()
4887 if (vp->v_type != VMARKER && vp->v_holdcnt == 0) { in DB_SHOW_COMMAND()
4888 vn_printf(vp, "vnode "); in DB_SHOW_COMMAND()
5097 vfs_deferred_inactive(struct vnode *vp, int lkflags) in vfs_deferred_inactive() argument
5100 ASSERT_VI_LOCKED(vp, __func__); in vfs_deferred_inactive()
5101 VNPASS((vp->v_iflag & VI_DEFINACT) == 0, vp); in vfs_deferred_inactive()
5102 if ((vp->v_iflag & VI_OWEINACT) == 0) { in vfs_deferred_inactive()
5103 vdropl(vp); in vfs_deferred_inactive()
5106 if (vn_lock(vp, lkflags) == 0) { in vfs_deferred_inactive()
5107 VI_LOCK(vp); in vfs_deferred_inactive()
5108 vinactive(vp); in vfs_deferred_inactive()
5109 VOP_UNLOCK(vp); in vfs_deferred_inactive()
5110 vdropl(vp); in vfs_deferred_inactive()
5113 vdefer_inactive_unlocked(vp); in vfs_deferred_inactive()
5117 vfs_periodic_inactive_filter(struct vnode *vp, void *arg) in vfs_periodic_inactive_filter() argument
5120 return (vp->v_iflag & VI_DEFINACT); in vfs_periodic_inactive_filter()
5126 struct vnode *vp, *mvp; in vfs_periodic_inactive() local
5133 MNT_VNODE_FOREACH_LAZY(vp, mp, mvp, vfs_periodic_inactive_filter, NULL) { in vfs_periodic_inactive()
5134 if ((vp->v_iflag & VI_DEFINACT) == 0) { in vfs_periodic_inactive()
5135 VI_UNLOCK(vp); in vfs_periodic_inactive()
5138 vp->v_iflag &= ~VI_DEFINACT; in vfs_periodic_inactive()
5139 vfs_deferred_inactive(vp, lkflags); in vfs_periodic_inactive()
5144 vfs_want_msync(struct vnode *vp) in vfs_want_msync() argument
5152 if (vp->v_vflag & VV_NOSYNC) in vfs_want_msync()
5154 obj = vp->v_object; in vfs_want_msync()
5159 vfs_periodic_msync_inactive_filter(struct vnode *vp, void *arg __unused) in vfs_periodic_msync_inactive_filter() argument
5162 if (vp->v_vflag & VV_NOSYNC) in vfs_periodic_msync_inactive_filter()
5164 if (vp->v_iflag & VI_DEFINACT) in vfs_periodic_msync_inactive_filter()
5166 return (vfs_want_msync(vp)); in vfs_periodic_msync_inactive_filter()
5172 struct vnode *vp, *mvp; in vfs_periodic_msync_inactive() local
5180 MNT_VNODE_FOREACH_LAZY(vp, mp, mvp, vfs_periodic_msync_inactive_filter, NULL) { in vfs_periodic_msync_inactive()
5182 if (vp->v_iflag & VI_DEFINACT) { in vfs_periodic_msync_inactive()
5183 vp->v_iflag &= ~VI_DEFINACT; in vfs_periodic_msync_inactive()
5186 if (!vfs_want_msync(vp)) { in vfs_periodic_msync_inactive()
5188 vfs_deferred_inactive(vp, lkflags); in vfs_periodic_msync_inactive()
5190 VI_UNLOCK(vp); in vfs_periodic_msync_inactive()
5193 if (vget(vp, lkflags) == 0) { in vfs_periodic_msync_inactive()
5194 if ((vp->v_vflag & VV_NOSYNC) == 0) { in vfs_periodic_msync_inactive()
5196 vnode_pager_clean_sync(vp); in vfs_periodic_msync_inactive()
5198 vnode_pager_clean_async(vp); in vfs_periodic_msync_inactive()
5200 vput(vp); in vfs_periodic_msync_inactive()
5202 vdrop(vp); in vfs_periodic_msync_inactive()
5205 vdefer_inactive_unlocked(vp); in vfs_periodic_msync_inactive()
5244 v_addpollinfo(struct vnode *vp) in v_addpollinfo() argument
5248 if (vp->v_pollinfo != NULL) in v_addpollinfo()
5252 knlist_init(&vi->vpi_selinfo.si_note, vp, vfs_knllock, in v_addpollinfo()
5254 VI_LOCK(vp); in v_addpollinfo()
5255 if (vp->v_pollinfo != NULL) { in v_addpollinfo()
5256 VI_UNLOCK(vp); in v_addpollinfo()
5260 vp->v_pollinfo = vi; in v_addpollinfo()
5261 VI_UNLOCK(vp); in v_addpollinfo()
5273 vn_pollrecord(struct vnode *vp, struct thread *td, int events) in vn_pollrecord() argument
5276 v_addpollinfo(vp); in vn_pollrecord()
5277 mtx_lock(&vp->v_pollinfo->vpi_lock); in vn_pollrecord()
5278 if (vp->v_pollinfo->vpi_revents & events) { in vn_pollrecord()
5286 events &= vp->v_pollinfo->vpi_revents; in vn_pollrecord()
5287 vp->v_pollinfo->vpi_revents &= ~events; in vn_pollrecord()
5289 mtx_unlock(&vp->v_pollinfo->vpi_lock); in vn_pollrecord()
5292 vp->v_pollinfo->vpi_events |= events; in vn_pollrecord()
5293 selrecord(td, &vp->v_pollinfo->vpi_selinfo); in vn_pollrecord()
5294 mtx_unlock(&vp->v_pollinfo->vpi_lock); in vn_pollrecord()
5328 struct vnode *vp; in vfs_allocate_syncvnode() local
5334 error = getnewvnode("syncer", mp, &sync_vnodeops, &vp); in vfs_allocate_syncvnode()
5337 vp->v_type = VNON; in vfs_allocate_syncvnode()
5338 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); in vfs_allocate_syncvnode()
5339 vp->v_vflag |= VV_FORCEINSMQ; in vfs_allocate_syncvnode()
5340 error = insmntque1(vp, mp); in vfs_allocate_syncvnode()
5343 vp->v_vflag &= ~VV_FORCEINSMQ; in vfs_allocate_syncvnode()
5344 vn_set_state(vp, VSTATE_CONSTRUCTED); in vfs_allocate_syncvnode()
5345 VOP_UNLOCK(vp); in vfs_allocate_syncvnode()
5362 bo = &vp->v_bufobj; in vfs_allocate_syncvnode()
5369 mp->mnt_syncer = vp; in vfs_allocate_syncvnode()
5370 vp = NULL; in vfs_allocate_syncvnode()
5374 if (vp != NULL) { in vfs_allocate_syncvnode()
5375 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); in vfs_allocate_syncvnode()
5376 vgone(vp); in vfs_allocate_syncvnode()
5377 vput(vp); in vfs_allocate_syncvnode()
5384 struct vnode *vp; in vfs_deallocate_syncvnode() local
5387 vp = mp->mnt_syncer; in vfs_deallocate_syncvnode()
5388 if (vp != NULL) in vfs_deallocate_syncvnode()
5391 if (vp != NULL) in vfs_deallocate_syncvnode()
5392 vrele(vp); in vfs_deallocate_syncvnode()
5459 struct vnode *vp = ap->a_vp; in sync_reclaim() local
5462 bo = &vp->v_bufobj; in sync_reclaim()
5465 if (vp->v_mount->mnt_syncer == vp) in sync_reclaim()
5466 vp->v_mount->mnt_syncer = NULL; in sync_reclaim()
5480 vn_need_pageq_flush(struct vnode *vp) in vn_need_pageq_flush() argument
5484 obj = vp->v_object; in vn_need_pageq_flush()
5485 return (obj != NULL && (vp->v_vflag & VV_NOSYNC) == 0 && in vn_need_pageq_flush()
5493 vn_isdisk_error(struct vnode *vp, int *errp) in vn_isdisk_error() argument
5497 if (vp->v_type != VCHR) { in vn_isdisk_error()
5503 if (vp->v_rdev == NULL) in vn_isdisk_error()
5505 else if (vp->v_rdev->si_devsw == NULL) in vn_isdisk_error()
5507 else if (!(vp->v_rdev->si_devsw->d_flags & D_DISK)) in vn_isdisk_error()
5516 vn_isdisk(struct vnode *vp) in vn_isdisk() argument
5520 return (vn_isdisk_error(vp, &error)); in vn_isdisk()
5697 extattr_check_cred(struct vnode *vp, int attrnamespace, struct ucred *cred, in extattr_check_cred() argument
5716 return (VOP_ACCESS(vp, accmode, cred, td)); in extattr_check_cred()
5746 vfs_badlock(const char *msg, const char *str, struct vnode *vp) in vfs_badlock() argument
5754 vn_printf(vp, "vnode "); in vfs_badlock()
5756 printf("%s: %p %s\n", str, (void *)vp, msg); in vfs_badlock()
5762 assert_vi_locked(struct vnode *vp, const char *str) in assert_vi_locked() argument
5765 if (vfs_badlock_mutex && !mtx_owned(VI_MTX(vp))) in assert_vi_locked()
5766 vfs_badlock("interlock is not locked but should be", str, vp); in assert_vi_locked()
5770 assert_vi_unlocked(struct vnode *vp, const char *str) in assert_vi_unlocked() argument
5773 if (vfs_badlock_mutex && mtx_owned(VI_MTX(vp))) in assert_vi_unlocked()
5774 vfs_badlock("interlock is locked but should not be", str, vp); in assert_vi_unlocked()
5778 assert_vop_locked(struct vnode *vp, const char *str) in assert_vop_locked() argument
5780 if (KERNEL_PANICKED() || vp == NULL) in assert_vop_locked()
5784 if ((vp->v_irflag & VIRF_CROSSMP) == 0 && in assert_vop_locked()
5785 witness_is_owned(&vp->v_vnlock->lock_object) == -1) in assert_vop_locked()
5787 int locked = VOP_ISLOCKED(vp); in assert_vop_locked()
5790 vfs_badlock("is not locked but should be", str, vp); in assert_vop_locked()
5794 assert_vop_unlocked(struct vnode *vp, const char *str) in assert_vop_unlocked() argument
5796 if (KERNEL_PANICKED() || vp == NULL) in assert_vop_unlocked()
5800 if ((vp->v_irflag & VIRF_CROSSMP) == 0 && in assert_vop_unlocked()
5801 witness_is_owned(&vp->v_vnlock->lock_object) == 1) in assert_vop_unlocked()
5803 if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) in assert_vop_unlocked()
5805 vfs_badlock("is locked but should not be", str, vp); in assert_vop_unlocked()
5809 assert_vop_elocked(struct vnode *vp, const char *str) in assert_vop_elocked() argument
5811 if (KERNEL_PANICKED() || vp == NULL) in assert_vop_elocked()
5814 if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) in assert_vop_elocked()
5815 vfs_badlock("is not exclusive locked but should be", str, vp); in assert_vop_elocked()
5886 struct vnode *vp; in vop_fplookup_vexec_debugpost() local
5889 vp = a->a_vp; in vop_fplookup_vexec_debugpost()
5893 VNPASS(VN_IS_DOOMED(vp), vp); in vop_fplookup_vexec_debugpost()
5911 vop_fsync_debugprepost(struct vnode *vp, const char *name) in vop_fsync_debugprepost() argument
5913 if (vp->v_type == VCHR) in vop_fsync_debugprepost()
5917 * is actually determined by vp's write mount as indicated in vop_fsync_debugprepost()
5919 * may not be the same as vp->v_mount. However, if the in vop_fsync_debugprepost()
5930 else if (MNT_SHARED_WRITES(vp->v_mount)) in vop_fsync_debugprepost()
5931 ASSERT_VOP_LOCKED(vp, name); in vop_fsync_debugprepost()
5933 ASSERT_VOP_ELOCKED(vp, name); in vop_fsync_debugprepost()
6021 struct vnode *vp = a->a_vp; in vop_unlock_debugpre() local
6023 VNPASS(vn_get_state(vp) != VSTATE_UNINITIALIZED, vp); in vop_unlock_debugpre()
6024 ASSERT_VOP_LOCKED(vp, "VOP_UNLOCK"); in vop_unlock_debugpre()
6094 struct vnode *vp; in vop_deleteextattr_pre() local
6097 vp = a->a_vp; in vop_deleteextattr_pre()
6098 vn_seqc_write_begin(vp); in vop_deleteextattr_pre()
6105 struct vnode *vp; in vop_deleteextattr_post() local
6108 vp = a->a_vp; in vop_deleteextattr_post()
6109 vn_seqc_write_end(vp); in vop_deleteextattr_post()
6118 struct vnode *vp, *tdvp; in vop_link_pre() local
6121 vp = a->a_vp; in vop_link_pre()
6123 vn_seqc_write_begin(vp); in vop_link_pre()
6131 struct vnode *vp, *tdvp; in vop_link_post() local
6134 vp = a->a_vp; in vop_link_post()
6136 vn_seqc_write_end(vp); in vop_link_post()
6139 VFS_KNOTE_LOCKED(vp, NOTE_LINK); in vop_link_post()
6208 struct vnode *vp; in vop_reclaim_post() local
6211 vp = a->a_vp; in vop_reclaim_post()
6212 ASSERT_VOP_IN_SEQC(vp); in vop_reclaim_post()
6214 VFS_KNOTE_LOCKED(vp, NOTE_REVOKE); in vop_reclaim_post()
6221 struct vnode *dvp, *vp; in vop_remove_pre() local
6225 vp = a->a_vp; in vop_remove_pre()
6227 vn_seqc_write_begin(vp); in vop_remove_pre()
6234 struct vnode *dvp, *vp; in vop_remove_post() local
6238 vp = a->a_vp; in vop_remove_post()
6240 vn_seqc_write_end(vp); in vop_remove_post()
6243 VFS_KNOTE_LOCKED(vp, NOTE_DELETE); in vop_remove_post()
6289 struct vnode *dvp, *vp; in vop_rmdir_pre() local
6293 vp = a->a_vp; in vop_rmdir_pre()
6295 vn_seqc_write_begin(vp); in vop_rmdir_pre()
6302 struct vnode *dvp, *vp; in vop_rmdir_post() local
6306 vp = a->a_vp; in vop_rmdir_post()
6308 vn_seqc_write_end(vp); in vop_rmdir_post()
6310 vp->v_vflag |= VV_UNLINKED; in vop_rmdir_post()
6312 VFS_KNOTE_LOCKED(vp, NOTE_DELETE); in vop_rmdir_post()
6320 struct vnode *vp; in vop_setattr_pre() local
6323 vp = a->a_vp; in vop_setattr_pre()
6324 vn_seqc_write_begin(vp); in vop_setattr_pre()
6331 struct vnode *vp; in vop_setattr_post() local
6334 vp = a->a_vp; in vop_setattr_post()
6335 vn_seqc_write_end(vp); in vop_setattr_post()
6337 VFS_KNOTE_LOCKED(vp, NOTE_ATTRIB); in vop_setattr_post()
6344 struct vnode *vp; in vop_setacl_pre() local
6347 vp = a->a_vp; in vop_setacl_pre()
6348 vn_seqc_write_begin(vp); in vop_setacl_pre()
6355 struct vnode *vp; in vop_setacl_post() local
6358 vp = a->a_vp; in vop_setacl_post()
6359 vn_seqc_write_end(vp); in vop_setacl_post()
6366 struct vnode *vp; in vop_setextattr_pre() local
6369 vp = a->a_vp; in vop_setextattr_pre()
6370 vn_seqc_write_begin(vp); in vop_setextattr_pre()
6377 struct vnode *vp; in vop_setextattr_post() local
6380 vp = a->a_vp; in vop_setextattr_post()
6381 vn_seqc_write_end(vp); in vop_setextattr_post()
6383 VFS_KNOTE_LOCKED(vp, NOTE_ATTRIB); in vop_setextattr_post()
6578 struct vnode *vp = arg; in vfs_knllock() local
6580 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); in vfs_knllock()
6586 struct vnode *vp = arg; in vfs_knlunlock() local
6588 VOP_UNLOCK(vp); in vfs_knlunlock()
6595 struct vnode *vp = arg; in vfs_knl_assert_lock() local
6598 ASSERT_VOP_LOCKED(vp, "vfs_knl_assert_locked"); in vfs_knl_assert_lock()
6600 ASSERT_VOP_UNLOCKED(vp, "vfs_knl_assert_unlocked"); in vfs_knl_assert_lock()
6607 struct vnode *vp = ap->a_vp; in vfs_kqfilter() local
6611 KASSERT(vp->v_type != VFIFO || (kn->kn_filter != EVFILT_READ && in vfs_kqfilter()
6628 kn->kn_hook = (caddr_t)vp; in vfs_kqfilter()
6630 v_addpollinfo(vp); in vfs_kqfilter()
6631 if (vp->v_pollinfo == NULL) in vfs_kqfilter()
6633 knl = &vp->v_pollinfo->vpi_selinfo.si_note; in vfs_kqfilter()
6634 vhold(vp); in vfs_kqfilter()
6646 struct vnode *vp = (struct vnode *)kn->kn_hook; in filt_vfsdetach() local
6648 KASSERT(vp->v_pollinfo != NULL, ("Missing v_pollinfo")); in filt_vfsdetach()
6649 knlist_remove(&vp->v_pollinfo->vpi_selinfo.si_note, kn, 0); in filt_vfsdetach()
6650 vdrop(vp); in filt_vfsdetach()
6657 struct vnode *vp = (struct vnode *)kn->kn_hook; in filt_vfsread() local
6665 if (hint == NOTE_REVOKE || (hint == 0 && vp->v_type == VBAD)) { in filt_vfsread()
6666 VI_LOCK(vp); in filt_vfsread()
6668 VI_UNLOCK(vp); in filt_vfsread()
6672 if (vn_getsize_locked(vp, &size, curthread->td_ucred) != 0) in filt_vfsread()
6675 VI_LOCK(vp); in filt_vfsread()
6678 VI_UNLOCK(vp); in filt_vfsread()
6686 struct vnode *vp = (struct vnode *)kn->kn_hook; in filt_vfswrite() local
6688 VI_LOCK(vp); in filt_vfswrite()
6694 if (hint == NOTE_REVOKE || (hint == 0 && vp->v_type == VBAD)) in filt_vfswrite()
6698 VI_UNLOCK(vp); in filt_vfswrite()
6705 struct vnode *vp = (struct vnode *)kn->kn_hook; in filt_vfsvnode() local
6708 VI_LOCK(vp); in filt_vfsvnode()
6711 if (hint == NOTE_REVOKE || (hint == 0 && vp->v_type == VBAD)) { in filt_vfsvnode()
6713 VI_UNLOCK(vp); in filt_vfsvnode()
6717 VI_UNLOCK(vp); in filt_vfsvnode()
6805 struct vnode *vp; in vfs_cache_root_fallback() local
6811 vp = mp->mnt_rootvnode; in vfs_cache_root_fallback()
6812 if (vp != NULL) { in vfs_cache_root_fallback()
6813 if (!VN_IS_DOOMED(vp)) { in vfs_cache_root_fallback()
6814 vrefact(vp); in vfs_cache_root_fallback()
6816 error = vn_lock(vp, flags); in vfs_cache_root_fallback()
6818 *vpp = vp; in vfs_cache_root_fallback()
6821 vrele(vp); in vfs_cache_root_fallback()
6830 if (vp != NULL) { in vfs_cache_root_fallback()
6832 vrele(vp); in vfs_cache_root_fallback()
6866 struct vnode *vp; in vfs_cache_root() local
6871 vp = atomic_load_ptr(&mp->mnt_rootvnode); in vfs_cache_root()
6872 if (vp == NULL || VN_IS_DOOMED(vp)) { in vfs_cache_root()
6876 vrefact(vp); in vfs_cache_root()
6878 error = vn_lock(vp, flags); in vfs_cache_root()
6880 vrele(vp); in vfs_cache_root()
6883 *vpp = vp; in vfs_cache_root()
6890 struct vnode *vp; in vfs_cache_root_clear() local
6896 vp = mp->mnt_rootvnode; in vfs_cache_root_clear()
6897 if (vp != NULL) in vfs_cache_root_clear()
6898 vn_seqc_write_begin(vp); in vfs_cache_root_clear()
6900 return (vp); in vfs_cache_root_clear()
6904 vfs_cache_root_set(struct mount *mp, struct vnode *vp) in vfs_cache_root_set() argument
6908 vrefact(vp); in vfs_cache_root_set()
6909 mp->mnt_rootvnode = vp; in vfs_cache_root_set()
6922 struct vnode *vp; in __mnt_vnode_next_all() local
6927 for (vp = TAILQ_NEXT(*mvp, v_nmntvnodes); vp != NULL; in __mnt_vnode_next_all()
6928 vp = TAILQ_NEXT(vp, v_nmntvnodes)) { in __mnt_vnode_next_all()
6930 if (vp->v_type == VMARKER || VN_IS_DOOMED(vp)) in __mnt_vnode_next_all()
6932 VI_LOCK(vp); in __mnt_vnode_next_all()
6933 if (VN_IS_DOOMED(vp)) { in __mnt_vnode_next_all()
6934 VI_UNLOCK(vp); in __mnt_vnode_next_all()
6939 if (vp == NULL) { in __mnt_vnode_next_all()
6946 TAILQ_INSERT_AFTER(&mp->mnt_nvnodelist, vp, *mvp, v_nmntvnodes); in __mnt_vnode_next_all()
6948 return (vp); in __mnt_vnode_next_all()
6954 struct vnode *vp; in __mnt_vnode_first_all() local
6960 TAILQ_FOREACH(vp, &mp->mnt_nvnodelist, v_nmntvnodes) { in __mnt_vnode_first_all()
6962 if (vp->v_type == VMARKER || VN_IS_DOOMED(vp)) in __mnt_vnode_first_all()
6964 VI_LOCK(vp); in __mnt_vnode_first_all()
6965 if (VN_IS_DOOMED(vp)) { in __mnt_vnode_first_all()
6966 VI_UNLOCK(vp); in __mnt_vnode_first_all()
6971 if (vp == NULL) { in __mnt_vnode_first_all()
6978 TAILQ_INSERT_AFTER(&mp->mnt_nvnodelist, vp, *mvp, v_nmntvnodes); in __mnt_vnode_first_all()
6980 return (vp); in __mnt_vnode_first_all()
7020 * Relock the mp mount vnode list lock with the vp vnode interlock in the
7030 struct vnode *vp) in mnt_vnode_next_lazy_relock() argument
7036 VNASSERT(vp->v_mount == mp && vp->v_type != VMARKER, vp, in mnt_vnode_next_lazy_relock()
7038 ASSERT_VI_UNLOCKED(vp, __func__); in mnt_vnode_next_lazy_relock()
7042 TAILQ_INSERT_BEFORE(vp, mvp, v_lazylist); in mnt_vnode_next_lazy_relock()
7050 vhold(vp); in mnt_vnode_next_lazy_relock()
7052 VI_LOCK(vp); in mnt_vnode_next_lazy_relock()
7053 if (VN_IS_DOOMED(vp)) { in mnt_vnode_next_lazy_relock()
7054 VNPASS((vp->v_mflag & VMP_LAZYLIST) == 0, vp); in mnt_vnode_next_lazy_relock()
7057 VNPASS(vp->v_mflag & VMP_LAZYLIST, vp); in mnt_vnode_next_lazy_relock()
7061 if (!refcount_release_if_not_last(&vp->v_holdcnt)) in mnt_vnode_next_lazy_relock()
7066 vdropl(vp); in mnt_vnode_next_lazy_relock()
7076 struct vnode *vp; in mnt_vnode_next_lazy() local
7081 vp = TAILQ_NEXT(*mvp, v_lazylist); in mnt_vnode_next_lazy()
7082 while (vp != NULL) { in mnt_vnode_next_lazy()
7083 if (vp->v_type == VMARKER) { in mnt_vnode_next_lazy()
7084 vp = TAILQ_NEXT(vp, v_lazylist); in mnt_vnode_next_lazy()
7092 VNPASS(!VN_IS_DOOMED(vp), vp); in mnt_vnode_next_lazy()
7093 if (!cb(vp, cbarg)) { in mnt_vnode_next_lazy()
7095 vp = TAILQ_NEXT(vp, v_lazylist); in mnt_vnode_next_lazy()
7100 TAILQ_INSERT_AFTER(&mp->mnt_lazyvnodelist, vp, *mvp, in mnt_vnode_next_lazy()
7110 if (!VI_TRYLOCK(vp) && in mnt_vnode_next_lazy()
7111 !mnt_vnode_next_lazy_relock(*mvp, mp, vp)) in mnt_vnode_next_lazy()
7113 KASSERT(vp->v_type != VMARKER, ("locked marker %p", vp)); in mnt_vnode_next_lazy()
7114 KASSERT(vp->v_mount == mp || vp->v_mount == NULL, in mnt_vnode_next_lazy()
7115 ("alien vnode on the lazy list %p %p", vp, mp)); in mnt_vnode_next_lazy()
7116 VNPASS(vp->v_mount == mp, vp); in mnt_vnode_next_lazy()
7117 VNPASS(!VN_IS_DOOMED(vp), vp); in mnt_vnode_next_lazy()
7123 if (vp == NULL) { in mnt_vnode_next_lazy()
7128 TAILQ_INSERT_AFTER(&mp->mnt_lazyvnodelist, vp, *mvp, v_lazylist); in mnt_vnode_next_lazy()
7130 ASSERT_VI_LOCKED(vp, "lazy iter"); in mnt_vnode_next_lazy()
7131 return (vp); in mnt_vnode_next_lazy()
7148 struct vnode *vp; in __mnt_vnode_first_lazy() local
7159 vp = TAILQ_FIRST(&mp->mnt_lazyvnodelist); in __mnt_vnode_first_lazy()
7160 if (vp == NULL) { in __mnt_vnode_first_lazy()
7165 TAILQ_INSERT_BEFORE(vp, *mvp, v_lazylist); in __mnt_vnode_first_lazy()
7183 vn_dir_check_exec(struct vnode *vp, struct componentname *cnp) in vn_dir_check_exec() argument
7191 return (VOP_ACCESS(vp, VEXEC, cnp->cn_cred, curthread)); in vn_dir_check_exec()
7199 vn_seqc_write_begin_locked(struct vnode *vp) in vn_seqc_write_begin_locked() argument
7202 ASSERT_VI_LOCKED(vp, __func__); in vn_seqc_write_begin_locked()
7203 VNPASS(vp->v_holdcnt > 0, vp); in vn_seqc_write_begin_locked()
7204 VNPASS(vp->v_seqc_users >= 0, vp); in vn_seqc_write_begin_locked()
7205 vp->v_seqc_users++; in vn_seqc_write_begin_locked()
7206 if (vp->v_seqc_users == 1) in vn_seqc_write_begin_locked()
7207 seqc_sleepable_write_begin(&vp->v_seqc); in vn_seqc_write_begin_locked()
7211 vn_seqc_write_begin(struct vnode *vp) in vn_seqc_write_begin() argument
7214 VI_LOCK(vp); in vn_seqc_write_begin()
7215 vn_seqc_write_begin_locked(vp); in vn_seqc_write_begin()
7216 VI_UNLOCK(vp); in vn_seqc_write_begin()
7220 vn_seqc_write_end_locked(struct vnode *vp) in vn_seqc_write_end_locked() argument
7223 ASSERT_VI_LOCKED(vp, __func__); in vn_seqc_write_end_locked()
7224 VNPASS(vp->v_seqc_users > 0, vp); in vn_seqc_write_end_locked()
7225 vp->v_seqc_users--; in vn_seqc_write_end_locked()
7226 if (vp->v_seqc_users == 0) in vn_seqc_write_end_locked()
7227 seqc_sleepable_write_end(&vp->v_seqc); in vn_seqc_write_end_locked()
7231 vn_seqc_write_end(struct vnode *vp) in vn_seqc_write_end() argument
7234 VI_LOCK(vp); in vn_seqc_write_end()
7235 vn_seqc_write_end_locked(vp); in vn_seqc_write_end()
7236 VI_UNLOCK(vp); in vn_seqc_write_end()
7246 vn_seqc_init(struct vnode *vp) in vn_seqc_init() argument
7249 vp->v_seqc = 0; in vn_seqc_init()
7250 vp->v_seqc_users = 0; in vn_seqc_init()
7254 vn_seqc_write_end_free(struct vnode *vp) in vn_seqc_write_end_free() argument
7257 VNPASS(seqc_in_modify(vp->v_seqc), vp); in vn_seqc_write_end_free()
7258 VNPASS(vp->v_seqc_users == 1, vp); in vn_seqc_write_end_free()
7262 vn_irflag_set_locked(struct vnode *vp, short toset) in vn_irflag_set_locked() argument
7266 ASSERT_VI_LOCKED(vp, __func__); in vn_irflag_set_locked()
7267 flags = vn_irflag_read(vp); in vn_irflag_set_locked()
7268 VNASSERT((flags & toset) == 0, vp, in vn_irflag_set_locked()
7271 atomic_store_short(&vp->v_irflag, flags | toset); in vn_irflag_set_locked()
7275 vn_irflag_set(struct vnode *vp, short toset) in vn_irflag_set() argument
7278 VI_LOCK(vp); in vn_irflag_set()
7279 vn_irflag_set_locked(vp, toset); in vn_irflag_set()
7280 VI_UNLOCK(vp); in vn_irflag_set()
7284 vn_irflag_set_cond_locked(struct vnode *vp, short toset) in vn_irflag_set_cond_locked() argument
7288 ASSERT_VI_LOCKED(vp, __func__); in vn_irflag_set_cond_locked()
7289 flags = vn_irflag_read(vp); in vn_irflag_set_cond_locked()
7290 atomic_store_short(&vp->v_irflag, flags | toset); in vn_irflag_set_cond_locked()
7294 vn_irflag_set_cond(struct vnode *vp, short toset) in vn_irflag_set_cond() argument
7297 VI_LOCK(vp); in vn_irflag_set_cond()
7298 vn_irflag_set_cond_locked(vp, toset); in vn_irflag_set_cond()
7299 VI_UNLOCK(vp); in vn_irflag_set_cond()
7303 vn_irflag_unset_locked(struct vnode *vp, short tounset) in vn_irflag_unset_locked() argument
7307 ASSERT_VI_LOCKED(vp, __func__); in vn_irflag_unset_locked()
7308 flags = vn_irflag_read(vp); in vn_irflag_unset_locked()
7309 VNASSERT((flags & tounset) == tounset, vp, in vn_irflag_unset_locked()
7312 atomic_store_short(&vp->v_irflag, flags & ~tounset); in vn_irflag_unset_locked()
7316 vn_irflag_unset(struct vnode *vp, short tounset) in vn_irflag_unset() argument
7319 VI_LOCK(vp); in vn_irflag_unset()
7320 vn_irflag_unset_locked(vp, tounset); in vn_irflag_unset()
7321 VI_UNLOCK(vp); in vn_irflag_unset()
7325 vn_getsize_locked(struct vnode *vp, off_t *size, struct ucred *cred) in vn_getsize_locked() argument
7330 ASSERT_VOP_LOCKED(vp, __func__); in vn_getsize_locked()
7331 error = VOP_GETATTR(vp, &vattr, cred); in vn_getsize_locked()
7342 vn_getsize(struct vnode *vp, off_t *size, struct ucred *cred) in vn_getsize() argument
7346 VOP_LOCK(vp, LK_SHARED); in vn_getsize()
7347 error = vn_getsize_locked(vp, size, cred); in vn_getsize()
7348 VOP_UNLOCK(vp); in vn_getsize()
7354 vn_set_state_validate(struct vnode *vp, __enum_uint8(vstate) state) in vn_set_state_validate() argument
7357 switch (vp->v_state) { in vn_set_state_validate()
7368 ASSERT_VOP_ELOCKED(vp, __func__); in vn_set_state_validate()
7377 ASSERT_VOP_ELOCKED(vp, __func__); in vn_set_state_validate()
7395 vn_printf(vp, "invalid state transition %d -> %d\n", vp->v_state, state); in vn_set_state_validate()
7396 panic("invalid state transition %d -> %d\n", vp->v_state, state); in vn_set_state_validate()