Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jan 2024 14:32:36 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 208e68be1fae - stable/14 - vfs: Simplify vrefact()
Message-ID:  <202401111432.40BEWa24024253@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=208e68be1faed42ede97431476b33fc88cfd2429

commit 208e68be1faed42ede97431476b33fc88cfd2429
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-01-04 13:11:44 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-01-11 14:19:45 +0000

    vfs: Simplify vrefact()
    
    refcount_acquire() returns the old value, just use that.  No functional
    change intended.
    
    Reviewed by:    kib
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D43255
    
    (cherry picked from commit 27f4eda3ddce4009a0ec9be68f474fe3be38933f)
---
 sys/kern/vfs_subr.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 0fe2bc46446c..811c5cef45d1 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -3360,14 +3360,11 @@ vref(struct vnode *vp)
 void
 vrefact(struct vnode *vp)
 {
+	int old __diagused;
 
 	CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
-#ifdef INVARIANTS
-	int old = atomic_fetchadd_int(&vp->v_usecount, 1);
+	old = refcount_acquire(&vp->v_usecount);
 	VNASSERT(old > 0, vp, ("%s: wrong use count %d", __func__, old));
-#else
-	refcount_acquire(&vp->v_usecount);
-#endif
 }
 
 void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401111432.40BEWa24024253>