svn commit: r364139 - head/sys/kern
Mateusz Guzik
mjg at FreeBSD.org
Wed Aug 12 04:52:36 UTC 2020
Author: mjg
Date: Wed Aug 12 04:52:35 2020
New Revision: 364139
URL: https://svnweb.freebsd.org/changeset/base/364139
Log:
vfs: reimplement vref on top of vget
No change in generated assembly.
Modified:
head/sys/kern/vfs_subr.c
Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c Wed Aug 12 04:35:49 2020 (r364138)
+++ head/sys/kern/vfs_subr.c Wed Aug 12 04:52:35 2020 (r364139)
@@ -2920,36 +2920,14 @@ vget_finish_ref(struct vnode *vp, enum vgetstate vs)
}
}
-/*
- * Increase the reference (use) and hold count of a vnode.
- * This will also remove the vnode from the free list if it is presently free.
- */
void
vref(struct vnode *vp)
{
- int old;
+ enum vgetstate vs;
CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
- if (refcount_acquire_if_not_zero(&vp->v_usecount)) {
- VNODE_REFCOUNT_FENCE_ACQ();
- VNASSERT(vp->v_holdcnt > 0, vp,
- ("%s: active vnode not held", __func__));
- return;
- }
- vhold(vp);
- /*
- * See the comment in vget_finish.
- */
- old = atomic_fetchadd_int(&vp->v_usecount, 1);
- VNASSERT(old >= 0, vp, ("%s: wrong use count %d", __func__, old));
- if (old != 0) {
-#ifdef INVARIANTS
- old = atomic_fetchadd_int(&vp->v_holdcnt, -1);
- VNASSERT(old > 1, vp, ("%s: wrong hold count %d", __func__, old));
-#else
- refcount_release(&vp->v_holdcnt);
-#endif
- }
+ vs = vget_prep(vp);
+ vget_finish_ref(vp, vs);
}
void
More information about the svn-src-all
mailing list