git: 27f4eda3ddce - main - vfs: Simplify vrefact()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 04 Jan 2024 13:40:15 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=27f4eda3ddce4009a0ec9be68f474fe3be38933f commit 27f4eda3ddce4009a0ec9be68f474fe3be38933f Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-01-04 13:11:44 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-01-04 13:39:52 +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 --- 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 d2a245081f3d..eb82f2d86aff 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