Skip to contentSkip to conversation

ocfs2: add the ability to switch between heartbeat group modes

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

lore
Share & tools
lore
#0 lore raw

PATCH 12/14 ocfs2: add the ability to switch between heartbeat group modes

This patch allows the user to switch heartbeat modes by writing the desired mode into /sys/o2cb/heartbeat_mode.

The mode cannot be switched when another is in use. This means that <configfs>/cluster/ must be empty.

 fs/ocfs2/cluster/Makefile      |    2 
 fs/ocfs2/cluster/heartbeat.h   |    3 +
 fs/ocfs2/cluster/nodemanager.c |    8 ++
 fs/ocfs2/cluster/sys.c         |  121 +++++++++++++++++++++++++++++++++++++++++
 fs/ocfs2/cluster/sys.h         |   33 +++++++++++
 5 files changed, 166 insertions(+), 1 deletion(-)
fs/ocfs2/cluster/heartbeat.h +3 -0
diff -ruNpX ../dontdiff linux-2.6.16-rc4.ocfs2-staging1/fs/ocfs2/cluster/heartbeat.h linux-2.6.16-rc4.ocfs2-staging2/fs/ocfs2/cluster/heartbeat.h
@@ -109,6 +109,9 @@ int o2hb_check_node_heartbeating_from_ca
 int o2hb_check_local_node_heartbeating(const char *resource);
 int o2hb_check_local_node_heartbeating_from_callback(const char *resource);
 
+const char *o2hb_heartbeat_mode(void);
+int o2hb_set_heartbeat_mode(const char *type, size_t count);
+
 struct o2hb_heartbeat_resource *o2hb_heartbeat_resource_get_by_name(const char * name);
 
 static inline struct o2hb_heartbeat_group *to_o2hb_heartbeat_group(struct config_group *group)
fs/ocfs2/cluster/Makefile +1 -1
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
@@ -1,7 +1,7 @@
 obj-$(CONFIG_OCFS2_FS) += ocfs2_nodemanager.o ocfs2_disk_heartbeat.o
 
 ocfs2_nodemanager-objs := nodemanager.o heartbeat.o tcp.o net_proc.o \
-	masklog.o ver.o
+	masklog.o ver.o sys.o
 
 ocfs2_disk_heartbeat-objs := disk_heartbeat.o quorum.o
 
fs/ocfs2/cluster/nodemanager.c +8 -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
@@ -32,6 +32,7 @@
 #include "heartbeat.h"
 #include "masklog.h"
 #include "ver.h"
+#include "sys.h"
 
 /* for now we operate under the assertion that there can be only one
  * cluster active at a time.  Changing this will require trickling
@@ -740,6 +741,7 @@ static void __exit exit_o2nm(void)
 
 	/* XXX sync with hb callbacks and shut down hb? */
 	o2net_unregister_hb_callbacks();
+	o2cb_sys_shutdown();
 	configfs_unregister_subsystem(&o2nm_cluster_group.cs_subsys);
 	o2nm_remove_proc(o2nm_proc);
 	mlog_remove_proc(o2nm_proc);
@@ -881,9 +883,15 @@ static int __init init_o2nm(void)
 		goto out_mlog;
 
 	ret = o2nm_init_proc(o2nm_proc);
+	if (ret)
+		goto out_proc;
+
+	ret = o2cb_sys_init();
 	if (ret == 0)
 		goto out;
 
+	o2nm_remove_proc(o2nm_proc);
+out_proc:
 	o2net_proc_exit(o2nm_proc);
 out_mlog:
 	mlog_remove_proc(o2nm_proc);
fs/ocfs2/cluster/sys.c +121 -0

121 lines not on this page · raw message

fs/ocfs2/cluster/sys.h +33 -0
diff -ruNpX ../dontdiff linux-2.6.16-rc4.ocfs2-staging1/fs/ocfs2/cluster/sys.h linux-2.6.16-rc4.ocfs2-staging2/fs/ocfs2/cluster/sys.h
@@ -0,0 +1,33 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * sys.h
+ *
+ * Function prototypes for o2cb sysfs interface
+ *
+ * Copyright (C) 2005 Oracle.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation,
+ * version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ *
+ */
+
+#ifndef O2CLUSTER_SYS_H
+#define O2CLUSTER_SYS_H
+
+void o2cb_sys_shutdown(void);
+int o2cb_sys_init(void);
+
+#endif /* O2CLUSTER_SYS_H */