From 2d78a5531ef1ac9bd45e67b7a04dee2f52e1f224 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Sun, 5 Feb 2017 03:23:16 +0000 Subject: vfs: use atomic_fcmpset in vfs_refcount_* --- sys/kern/vfs_subr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/kern/vfs_subr.c') diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 792fbb610a84..039d06829e2c 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -2461,11 +2461,11 @@ vfs_refcount_acquire_if_not_zero(volatile u_int *count) { u_int old; + old = *count; for (;;) { - old = *count; if (old == 0) return (0); - if (atomic_cmpset_int(count, old, old + 1)) + if (atomic_fcmpset_int(count, &old, old + 1)) return (1); } } @@ -2475,11 +2475,11 @@ vfs_refcount_release_if_not_last(volatile u_int *count) { u_int old; + old = *count; for (;;) { - old = *count; if (old == 1) return (0); - if (atomic_cmpset_int(count, old, old - 1)) + if (atomic_fcmpset_int(count, &old, old - 1)) return (1); } } -- cgit v1.2.3