diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 13b7415ce892..1a683315a8e7 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -3046,6 +3046,19 @@ vrefact(struct vnode *vp) #endif } +void +vrefactn(struct vnode *vp, u_int n) +{ + + CTR2(KTR_VFS, "%s: vp %p", __func__, vp); +#ifdef INVARIANTS + int old = atomic_fetchadd_int(&vp->v_usecount, n); + VNASSERT(old > 0, vp, ("%s: wrong use count %d", __func__, old)); +#else + atomic_add_int(&vp->v_usecount, n); +#endif +} + /* * Return reference count of a vnode. * diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 08c596c1e5a8..db95d351ae19 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -900,6 +900,7 @@ void vrele(struct vnode *vp); void vref(struct vnode *vp); void vrefl(struct vnode *vp); void vrefact(struct vnode *vp); +void vrefactn(struct vnode *vp, u_int n); int vrefcnt(struct vnode *vp); void v_addpollinfo(struct vnode *vp);