Jeff Mahoney
2006-Feb-21 16:57 UTC
[Ocfs2-devel] [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(-) Signed-off-by: Jeff Mahoney <jeffm at suse.com> diff -ruNpX ../dontdiff linux-2.6.16-rc4.ocfs2-staging1/fs/Kconfig linux-2.6.16-rc4.ocfs2-staging2/fs/Kconfig --- linux-2.6.16-rc4.ocfs2-staging1/fs/Kconfig 2006-02-21 11:44:53.000000000 -0500 +++ linux-2.6.16-rc4.ocfs2-staging2/fs/Kconfig 2006-02-21 11:44:53.000000000 -0500 @@ -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 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 --- linux-2.6.16-rc4.ocfs2-staging1/fs/ocfs2/cluster/disk_heartbeat.c 2006-02-21 11:44:46.000000000 -0500 +++ linux-2.6.16-rc4.ocfs2-staging2/fs/ocfs2/cluster/disk_heartbeat.c 2006-02-21 11:44:53.000000000 -0500 @@ -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); - 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 --- linux-2.6.16-rc4.ocfs2-staging1/fs/ocfs2/cluster/disk_heartbeat.h 2006-02-21 11:44:38.000000000 -0500 +++ linux-2.6.16-rc4.ocfs2-staging2/fs/ocfs2/cluster/disk_heartbeat.h 2006-02-21 11:44:53.000000000 -0500 @@ -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 */ 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 --- linux-2.6.16-rc4.ocfs2-staging1/fs/ocfs2/cluster/Makefile 2006-02-21 11:44:53.000000000 -0500 +++ linux-2.6.16-rc4.ocfs2-staging2/fs/ocfs2/cluster/Makefile 2006-02-21 11:44:53.000000000 -0500 @@ -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 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 --- linux-2.6.16-rc4.ocfs2-staging1/fs/ocfs2/cluster/nodemanager.c 2006-02-21 11:44:53.000000000 -0500 +++ linux-2.6.16-rc4.ocfs2-staging2/fs/ocfs2/cluster/nodemanager.c 2006-02-21 11:44:53.000000000 -0500 @@ -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; }