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);
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to