Date: Wed, 12 Aug 2020 04:52:35 +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: r364139 - head/sys/kern Message-ID: <202008120452.07C4qZQ1065701@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008120452.07C4qZQ1065701>