From 27f4eda3ddce4009a0ec9be68f474fe3be38933f Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Thu, 4 Jan 2024 08:11:44 -0500 Subject: [PATCH] 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 --- 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 d2a245081f3..eb82f2d86af 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -3345,14 +3345,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