vfs: use atomic_fcmpset in vfs_refcount_*

This commit is contained in:
Mateusz Guzik 2017-02-05 03:23:16 +00:00
parent 9613442e83
commit 2d78a5531e

View File

@ -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);
}
}