[Ocfs2-commits] mfasheh commits r2131 - trunk/fs/ocfs2/cluster

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Apr 11 19:11:46 CDT 2005


Author: mfasheh
Signed-off-by: manish
Date: 2005-04-11 19:11:44 -0500 (Mon, 11 Apr 2005)
New Revision: 2131

Modified:
   trunk/fs/ocfs2/cluster/heartbeat.c
Log:
* only read heartbeat sectors up until our highest configured node 

Signed-off-by: manish



Modified: trunk/fs/ocfs2/cluster/heartbeat.c
===================================================================
--- trunk/fs/ocfs2/cluster/heartbeat.c	2005-04-09 01:47:29 UTC (rev 2130)
+++ trunk/fs/ocfs2/cluster/heartbeat.c	2005-04-12 00:11:44 UTC (rev 2131)
@@ -502,9 +502,28 @@
 	return 0;
 }
 
+/* This could be faster if we just implmented a find_last_bit, but I
+ * don't think the circumstances warrant it. */
+static int hb_highest_node(unsigned long *nodes,
+			   int numbits)
+{
+	int highest, node;
+
+	highest = numbits;
+	node = -1;
+	while ((node = find_next_bit(nodes, numbits, node + 1)) != -1) {
+		if (node >= numbits)
+			break;
+
+		highest = node;
+	}
+
+	return highest;
+}
+
 static void hb_do_disk_heartbeat(struct hb_region *reg)
 {
-	int i, ret, change = 0;
+	int i, ret, highest_node, change = 0;
 	unsigned long configured_nodes[BITS_TO_LONGS(NM_MAX_NODES)];
 	struct bio *write_bio;
 	struct hb_bio_wait_ctxt write_wc;
@@ -512,7 +531,17 @@
 	if (nm_configured_node_map(configured_nodes, sizeof(configured_nodes)))
 		return;
 
-	ret = hb_read_slots(reg, NM_MAX_NODES - 1);
+	highest_node = hb_highest_node(configured_nodes, NM_MAX_NODES);
+	if (highest_node >= NM_MAX_NODES) {
+		printk("ocfs2_heartbeat: no configured nodes found!\n");
+		return;
+	}
+
+	/* No sense in reading the slots of nodes that don't exist
+	 * yet. Of course, if the node definitions have holes in them
+	 * then we're reading an empty slot anyway... Consider this
+	 * best-effort. */
+	ret = hb_read_slots(reg, highest_node + 1);
 	if (ret < 0) {
 		hbprintk("ret = %d reading slots\n", ret);
 		return;



More information about the Ocfs2-commits mailing list