Skip to contentSkip to conversation

ocfs2: include disk heartbeat in ocfs2_nodemanager to avoid userspace changes

PATCH New Jeff Mahoney 1 participant 1 message Feb 21, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 14/14 ocfs2: include disk heartbeat in ocfs2_nodemanager to avoid userspace changes

This patch removes disk heartbeat's modularity which makes it the default.

Without this patch, userspace changes are required.

This patch is not intended for permanent application, just to make it easier for users not interested in testing the userspace clustering implementation to use ocfs2.

In order to switch to user clustering, use "o2cb offline" to shut down the cluster, echo "user" > /sys/o2cb/heartbeat_mode, and "o2cb online" to start it back up again.

 fs/Kconfig                        |   12 ------------
 fs/ocfs2/cluster/Makefile         |    3 +--
 fs/ocfs2/cluster/disk_heartbeat.c |    8 ++------
 fs/ocfs2/cluster/disk_heartbeat.h |    2 ++
 fs/ocfs2/cluster/nodemanager.c    |    7 +++++++
 5 files changed, 12 insertions(+), 20 deletions(-)
fs/Kconfig +0 -12
diff -ruNpX ../dontdiff linux-2.6.16-rc4.ocfs2-staging1/fs/Kconfig linux-2.6.16-rc4.ocfs2-staging2/fs/Kconfig
@@ -356,18 +356,6 @@ config OCFS2_FS
 	          - POSIX ACLs
 	          - readpages / writepages (not user visible)
 
-config OCFS2_FS_O2CB
-	tristate "O2CB Kernelspace Clustering"
-	depends on OCFS2_FS
-	default y
-	help
-	  OCFS2 includes a simple kernelspace clustering package that requires
-	  a very small userspace complement to configure it. However, it is
-	  not as flexible as an external cluster manager, and is only
-	  limited to maintaining a cluster for OCFS2 file systems.
-	  If you are not using an external clustering package, choose
-	  this option.
-
 config OCFS2_FS_USERSPACE_CLUSTER
 	tristate "Userspace Clustering"
 	depends on OCFS2_FS
fs/ocfs2/cluster/disk_heartbeat.c +2 -6
diff -ruNpX ../dontdiff linux-2.6.16-rc4.ocfs2-staging1/fs/ocfs2/cluster/disk_heartbeat.c linux-2.6.16-rc4.ocfs2-staging2/fs/ocfs2/cluster/disk_heartbeat.c
@@ -1509,7 +1509,7 @@ void o2hb_stop_all_regions(void)
 	spin_unlock(&o2hb_live_lock);
 }
 
-static int __init o2hb_disk_heartbeat_init(void)
+int o2hb_disk_heartbeat_init(void)
 {
 	int i;
 
@@ -1520,14 +1520,10 @@ static int __init o2hb_disk_heartbeat_in
 	return o2hb_register_heartbeat_group(&disk_heartbeat_group);
 }
 
-static void __exit o2hb_disk_heartbeat_exit(void)
+void o2hb_disk_heartbeat_exit(void)
 {
 	o2hb_unregister_heartbeat_group(&disk_heartbeat_group);
 }
 
 MODULE_AUTHOR("Oracle");
 MODULE_LICENSE("GPL");
-
-module_init(o2hb_disk_heartbeat_init);
-module_exit(o2hb_disk_heartbeat_exit);
-
fs/ocfs2/cluster/disk_heartbeat.h +2 -0
diff -ruNpX ../dontdiff linux-2.6.16-rc4.ocfs2-staging1/fs/ocfs2/cluster/disk_heartbeat.h linux-2.6.16-rc4.ocfs2-staging2/fs/ocfs2/cluster/disk_heartbeat.h
@@ -37,5 +37,7 @@ extern unsigned int o2hb_dead_threshold;
 #define O2HB_MAX_WRITE_TIMEOUT_MS (O2HB_REGION_TIMEOUT_MS * (o2hb_dead_threshold - 1))
 void o2hb_stop_all_regions(void);
 void o2hb_dead_threshold_set(unsigned int threshold);
+int o2hb_disk_heartbeat_init(void);
+void o2hb_disk_heartbeat_exit(void);
 
 #endif /* O2CLUSTER_DISK_HEARTBEAT_H */
fs/ocfs2/cluster/Makefile +1 -2
diff -ruNpX ../dontdiff linux-2.6.16-rc4.ocfs2-staging1/fs/ocfs2/cluster/Makefile linux-2.6.16-rc4.ocfs2-staging2/fs/ocfs2/cluster/Makefile
@@ -3,8 +3,7 @@ obj-$(CONFIG_OCFS2_FS_O2CB) += ocfs2_dis
 obj-$(CONFIG_OCFS2_FS_USERSPACE_CLUSTER) += ocfs2_user_heartbeat.o
 
 ocfs2_nodemanager-objs := nodemanager.o heartbeat.o tcp.o net_proc.o \
-	masklog.o ver.o sys.o
+	masklog.o ver.o sys.o disk_heartbeat.o quorum.o
 
-ocfs2_disk_heartbeat-objs := disk_heartbeat.o quorum.o
 ocfs2_user_heartbeat-objs := user_heartbeat.o
 
fs/ocfs2/cluster/nodemanager.c +7 -0
diff -ruNpX ../dontdiff linux-2.6.16-rc4.ocfs2-staging1/fs/ocfs2/cluster/nodemanager.c linux-2.6.16-rc4.ocfs2-staging2/fs/ocfs2/cluster/nodemanager.c
@@ -30,6 +30,7 @@
 #include "nodemanager.h"
 #include "quorum.h"
 #include "heartbeat.h"
+#include "disk_heartbeat.h"
 #include "masklog.h"
 #include "ver.h"
 #include "sys.h"
@@ -736,6 +737,7 @@ static void __exit exit_o2nm(void)
 
 	/* XXX sync with hb callbacks and shut down hb? */
 	o2net_unregister_hb_callbacks();
+	o2hb_disk_heartbeat_exit();
 	o2cb_sys_shutdown();
 	configfs_unregister_subsystem(&o2nm_cluster_group.cs_subsys);
 	o2nm_remove_proc(o2nm_proc);
@@ -842,6 +844,10 @@ static int __init init_o2nm(void)
 	cluster_print_version();
 
 	o2hb_init();
+	ret = o2hb_disk_heartbeat_init();
+	if (ret)
+		goto out;
+
 	o2net_init();
 
 	ocfs2_table_header = register_sysctl_table(ocfs2_root_table, 0);
@@ -900,6 +906,7 @@ out_sysctl:
 	unregister_sysctl_table(ocfs2_table_header);
 out_o2net:
 	o2net_exit();
+	o2hb_disk_heartbeat_exit();
 out:
 	return ret;
 }