[Ocfs2-commits] zab commits r2171 - trunk/fs/ocfs2/cluster

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Apr 25 19:40:18 CDT 2005


Author: zab
Signed-off-by: mfasheh
Date: 2005-04-25 19:40:17 -0500 (Mon, 25 Apr 2005)
New Revision: 2171

Modified:
   trunk/fs/ocfs2/cluster/heartbeat.c
Log:
o use atomic_dec_and_test() instead of _sub_and_test() as the latter isn't
  quite universally available.

Signed-off-by: mfasheh


Modified: trunk/fs/ocfs2/cluster/heartbeat.c
===================================================================
--- trunk/fs/ocfs2/cluster/heartbeat.c	2005-04-23 02:12:55 UTC (rev 2170)
+++ trunk/fs/ocfs2/cluster/heartbeat.c	2005-04-26 00:40:17 UTC (rev 2171)
@@ -159,8 +159,14 @@
 static inline void hb_bio_wait_dec(struct hb_bio_wait_ctxt *wc,
 				   unsigned int num)
 {
-	if (atomic_sub_and_test(num, &wc->wc_num_reqs))
-		complete(&wc->wc_io_complete);
+	/* sadly atomic_sub_and_test() isn't available on all platforms.  The
+	 * good news is that the fast path only completes one at a time */
+	while(num--) {
+		if (atomic_dec_and_test(&wc->wc_num_reqs)) {
+			BUG_ON(num > 0);
+			complete(&wc->wc_io_complete);
+		}
+	}
 }
 
 static void hb_wait_on_io(struct hb_region *reg,



More information about the Ocfs2-commits mailing list