Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Feb 2017 03:23:16 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r313268 - head/sys/kern
Message-ID:  <201702050323.v153NGMP035133@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Sun Feb  5 03:23:16 2017
New Revision: 313268
URL: https://svnweb.freebsd.org/changeset/base/313268

Log:
  vfs: use atomic_fcmpset in vfs_refcount_*

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Sun Feb  5 02:49:42 2017	(r313267)
+++ head/sys/kern/vfs_subr.c	Sun Feb  5 03:23:16 2017	(r313268)
@@ -2461,11 +2461,11 @@ vfs_refcount_acquire_if_not_zero(volatil
 {
 	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(volatil
 {
 	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);
 	}
 }



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