[Ocfs2-commits] mfasheh commits r2034 - in trunk/fs/ocfs2: . cluster dlm

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Mar 21 19:30:11 CST 2005


Author: mfasheh
Signed-off-by: jlbec
Date: 2005-03-21 19:30:10 -0600 (Mon, 21 Mar 2005)
New Revision: 2034

Modified:
   trunk/fs/ocfs2/cluster/heartbeat.c
   trunk/fs/ocfs2/cluster/heartbeat.h
   trunk/fs/ocfs2/dlm/dlmmod.c
   trunk/fs/ocfs2/super.c
Log:
* move some checks into heartbeat and show dlm how to call it.

Signed-off-by: jlbec



Modified: trunk/fs/ocfs2/cluster/heartbeat.c
===================================================================
--- trunk/fs/ocfs2/cluster/heartbeat.c	2005-03-22 01:22:04 UTC (rev 2033)
+++ trunk/fs/ocfs2/cluster/heartbeat.c	2005-03-22 01:30:10 UTC (rev 2034)
@@ -898,3 +898,29 @@
 out:
 	up_write(&hb_callback_sem);
 }
+
+/* Makes sure our local node is configured with a node number, and is
+ * heartbeating. */
+int hb_check_local_node_heartbeating(void)
+{
+	unsigned long testing_map[BITS_TO_LONGS(NM_MAX_NODES)];
+	u8 node_num;
+
+	/* if this node was set then we have networking */
+	node_num = nm_this_node();
+	if (node_num == NM_MAX_NODES) {
+		hbprintk("this node has not been configured.\n");
+		return 0;
+	}
+
+	hb_fill_node_map(testing_map, sizeof(testing_map));
+
+	if (!test_bit(node_num, testing_map)) {
+		hbprintk("this node (%u) does not have heartbeating enabled.",
+			 node_num);
+		return 0;
+	}
+
+	return 1;
+}
+EXPORT_SYMBOL(hb_check_local_node_heartbeating);

Modified: trunk/fs/ocfs2/cluster/heartbeat.h
===================================================================
--- trunk/fs/ocfs2/cluster/heartbeat.h	2005-03-22 01:22:04 UTC (rev 2033)
+++ trunk/fs/ocfs2/cluster/heartbeat.h	2005-03-22 01:30:10 UTC (rev 2034)
@@ -61,5 +61,6 @@
 int hb_unregister_callback(struct hb_callback_func *hc); 
 void hb_fill_node_map(unsigned long *map, unsigned bytes);
 void hb_init(void);
+int hb_check_local_node_heartbeating(void);
 
 #endif /* CLUSTER_HEARTBEAT_H */

Modified: trunk/fs/ocfs2/dlm/dlmmod.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmmod.c	2005-03-22 01:22:04 UTC (rev 2033)
+++ trunk/fs/ocfs2/dlm/dlmmod.c	2005-03-22 01:30:10 UTC (rev 2034)
@@ -1686,8 +1686,9 @@
 		goto leave;
 	}
 
-	if (nm_this_node() == NM_MAX_NODES) {
-		dlmprintk0("a local node has not been configured\n");
+	if (!hb_check_local_node_heartbeating()) {
+		dlmprintk0("the local node has not ben configured, or is not "
+			   "heartbeating\n");
 		goto leave;
 	}
 

Modified: trunk/fs/ocfs2/super.c
===================================================================
--- trunk/fs/ocfs2/super.c	2005-03-22 01:22:04 UTC (rev 2033)
+++ trunk/fs/ocfs2/super.c	2005-03-22 01:30:10 UTC (rev 2034)
@@ -303,29 +303,6 @@
 	return status;
 } /* ocfs_release_system_inodes */
 
-static int ocfs2_hb_is_ok(void)
-{
-	unsigned long testing_map[BITS_TO_LONGS(NM_MAX_NODES)];
-	u8 node_num;
-
-	/* if this node was set then we have networking */
-	node_num = nm_this_node();
-	if (node_num == NM_MAX_NODES) {
-		LOG_ERROR_STR("ocfs2: this node has not been configured.");
-		return 0;
-	}
-
-	hb_fill_node_map(testing_map, sizeof(testing_map));
-
-	if (!test_bit(node_num, testing_map)) {
-		LOG_ERROR_ARGS("ocfs2: this node (%u) does not have "
-			      "heartbeating enabled.", node_num);
-		return 0;
-	}
-
-	return 1;
-}
-
 static int ocfs_fill_super(struct super_block *sb, void *data, int silent)
 {
 	struct dentry *root;
@@ -338,7 +315,7 @@
 
 	/* for now we only have one cluster/node, make sure we see it
 	 * in the heartbeat universe */
-	if (!ocfs2_hb_is_ok()) {
+	if (!hb_check_local_node_heartbeating()) {
 		status = -EINVAL;
 		goto read_super_error;
 	}



More information about the Ocfs2-commits mailing list