Date: Sat, 1 Feb 2020 06:39:49 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357358 - in head/sys: kern sys Message-ID: <202002010639.0116dnCn051450@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Sat Feb 1 06:39:49 2020 New Revision: 357358 URL: https://svnweb.freebsd.org/changeset/base/357358 Log: vfs: add vrefactn Differential Revision: https://reviews.freebsd.org/D23427 Modified: head/sys/kern/vfs_subr.c head/sys/sys/vnode.h Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sat Feb 1 06:39:10 2020 (r357357) +++ head/sys/kern/vfs_subr.c Sat Feb 1 06:39:49 2020 (r357358) @@ -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. * Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Sat Feb 1 06:39:10 2020 (r357357) +++ head/sys/sys/vnode.h Sat Feb 1 06:39:49 2020 (r357358) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002010639.0116dnCn051450>