[Ocfs2-commits] smushran commits r2150 - in trunk/fs/ocfs2: . cluster

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Apr 19 13:41:34 CDT 2005


Author: smushran
Signed-off-by: mfasheh
Date: 2005-04-19 13:41:33 -0500 (Tue, 19 Apr 2005)
New Revision: 2150

Modified:
   trunk/fs/ocfs2/cluster/nodemanager.c
   trunk/fs/ocfs2/cluster/nodemanager.h
   trunk/fs/ocfs2/heartbeat.c
   trunk/fs/ocfs2/heartbeat.h
   trunk/fs/ocfs2/super.c
Log:
hb_ctl_path in sysfs now created in nodemanager instead of ocfs2
Signed-off-by: mfasheh

Modified: trunk/fs/ocfs2/cluster/nodemanager.c
===================================================================
--- trunk/fs/ocfs2/cluster/nodemanager.c	2005-04-19 04:57:53 UTC (rev 2149)
+++ trunk/fs/ocfs2/cluster/nodemanager.c	2005-04-19 18:41:33 UTC (rev 2150)
@@ -83,6 +83,65 @@
 #define nmprintk0(x)           printk("(nm:%d) " x, current->pid)
 #endif
 
+static char ocfs2_hb_ctl_path[PATH_MAX] = "/sbin/ocfs2_hb_ctl";
+
+static ctl_table ocfs2_nm_table[] = {
+	{
+		.ctl_name	= 1,
+		.procname	= "hb_ctl_path",
+		.data		= ocfs2_hb_ctl_path,
+		.maxlen		= PATH_MAX,
+		.mode		= 0644,
+		.proc_handler	= &proc_dostring,
+		.strategy	= &sysctl_string,
+	},
+	{ .ctl_name = 0 }
+};
+
+static ctl_table ocfs2_mod_table[] = {
+	{
+		.ctl_name	= KERN_OCFS2_NM,
+		.procname	= "nm",
+		.data		= NULL,
+		.maxlen		= 0,
+		.mode		= 0555,
+		.child		= ocfs2_nm_table
+	},
+	{ .ctl_name = 0} 
+};
+
+static ctl_table ocfs2_kern_table[] = {
+	{
+		.ctl_name	= KERN_OCFS2,
+		.procname	= "ocfs2",
+		.data		= NULL,
+		.maxlen		= 0,
+		.mode		= 0555,
+		.child		= ocfs2_mod_table
+	},
+	{ .ctl_name = 0} 
+};
+
+static ctl_table ocfs2_root_table[] = {
+	{
+		.ctl_name	= CTL_FS,
+		.procname	= "fs",
+		.data		= NULL,
+		.maxlen		= 0,
+		.mode		= 0555,
+		.child		= ocfs2_kern_table
+	},
+	{ .ctl_name = 0 }
+};
+
+static struct ctl_table_header *ocfs2_table_header = NULL;
+
+const char *nm_get_hb_ctl_path(void)
+{
+	return ocfs2_hb_ctl_path;
+}
+EXPORT_SYMBOL(nm_get_hb_ctl_path);
+
 struct nm_cluster {
 	struct config_group	cl_group;
 	unsigned		cl_has_local:1;
@@ -709,6 +768,10 @@
 static void __exit exit_nm(void)
 {
 	nmprintk("unloading nm module\n");
+
+	if (ocfs2_table_header)
+		unregister_sysctl_table(ocfs2_table_header);
+
 	/* XXX sync with hb callbacks and shut down hb? */
 	net_unregister_hb_callbacks();
 	configfs_unregister_subsystem(&nm_cluster_group.cs_subsys);
@@ -716,10 +779,16 @@
 
 static int __init init_nm(void)
 {
-	int ret;
+	int ret = -1;
 
 	cluster_print_version();
 
+	ocfs2_table_header = register_sysctl_table(ocfs2_root_table, 0);
+	if (!ocfs2_table_header) {
+		printk(KERN_ERR "nodemanager: unable to register sysctl\n");
+		goto bail;
+	}
+
 	hb_init();
 	ret = net_register_hb_callbacks();
 	if (!ret) {
@@ -732,6 +801,10 @@
 		}
 	}
 
+bail:
+	if (ret && ocfs2_table_header)
+		unregister_sysctl_table(ocfs2_table_header);
+
 	return ret;
 }
 

Modified: trunk/fs/ocfs2/cluster/nodemanager.h
===================================================================
--- trunk/fs/ocfs2/cluster/nodemanager.h	2005-04-19 04:57:53 UTC (rev 2149)
+++ trunk/fs/ocfs2/cluster/nodemanager.h	2005-04-19 18:41:33 UTC (rev 2150)
@@ -33,6 +33,11 @@
 #include "configfs.h"
 #include <linux/idr.h>
 
+#define KERN_OCFS2		988
+#define KERN_OCFS2_NM		1
+
+const char *nm_get_hb_ctl_path(void);
+
 struct nm_node {
 	spinlock_t		nd_lock;
 	struct config_item	nd_item; 

Modified: trunk/fs/ocfs2/heartbeat.c
===================================================================
--- trunk/fs/ocfs2/heartbeat.c	2005-04-19 04:57:53 UTC (rev 2149)
+++ trunk/fs/ocfs2/heartbeat.c	2005-04-19 18:41:33 UTC (rev 2150)
@@ -52,8 +52,6 @@
 #define OCFS2_HB_NODE_DOWN_PRI     (0x0000002)
 #define OCFS2_HB_NODE_UP_PRI	   OCFS2_HB_NODE_DOWN_PRI
 
-char ocfs2_hb_ctl_path[PATH_MAX] = "/sbin/ocfs2_hb_ctl";
-
 static inline void __ocfs_node_map_set_bit(ocfs_node_map *map,
 					   int bit);
 static inline void __ocfs_node_map_clear_bit(ocfs_node_map *map,
@@ -154,7 +152,7 @@
 		return;
 	}
 
-	argv[0] = ocfs2_hb_ctl_path;
+	argv[0] = nm_get_hb_ctl_path();
 	argv[1] = "-K";
 	argv[2] = "-u";
 	argv[3] = osb->uuid_str;

Modified: trunk/fs/ocfs2/heartbeat.h
===================================================================
--- trunk/fs/ocfs2/heartbeat.h	2005-04-19 04:57:53 UTC (rev 2149)
+++ trunk/fs/ocfs2/heartbeat.h	2005-04-19 18:41:33 UTC (rev 2150)
@@ -26,8 +26,6 @@
 #ifndef OCFS2_HEARTBEAT_H
 #define OCFS2_HEARTBEAT_H
 
-extern char ocfs2_hb_ctl_path[PATH_MAX];
-
 void ocfs2_init_node_maps(ocfs_super *osb);
 
 int ocfs2_register_hb_callbacks(ocfs_super *osb);

Modified: trunk/fs/ocfs2/super.c
===================================================================
--- trunk/fs/ocfs2/super.c	2005-04-19 04:57:53 UTC (rev 2149)
+++ trunk/fs/ocfs2/super.c	2005-04-19 18:41:33 UTC (rev 2150)
@@ -87,10 +87,9 @@
 u64 debug_mask = 0;
 #endif
 
-#define KERN_OCFS 988 
 static ctl_table ocfs_dbg_table[] = {
 	{
-		.ctl_name	= 1,
+		.ctl_name	= KERN_OCFS2_NM + 1,
 		.procname	= "debug_level",
 		.data		= &debug_level,
 		.maxlen		= sizeof(u32),
@@ -100,7 +99,7 @@
 		.strategy	= &sysctl_intvec,
 	},
 	{
-		.ctl_name	= 2,
+		.ctl_name	= KERN_OCFS2_NM + 2,
 		.procname	= "debug_context",
 		.data		= &debug_context,
 		.maxlen		= sizeof(u32),
@@ -110,7 +109,7 @@
 		.strategy	= &sysctl_intvec
 	},
 	{
-		.ctl_name	= 3,
+		.ctl_name	= KERN_OCFS2_NM + 3,
 		.procname	= "debug_exclude",
 		.data		= &debug_exclude,
 		.maxlen		= sizeof(u32),
@@ -119,21 +118,12 @@
 		.proc_handler	= &proc_dointvec,
 		.strategy	= &sysctl_intvec
 	},
-	{
-		.ctl_name	= 4,
-		.procname	= "hb_ctl_path",
-		.data		= ocfs2_hb_ctl_path,
-		.maxlen		= PATH_MAX,
-		.mode		= 0644,
-		.proc_handler	= &proc_dostring,
-		.strategy	= &sysctl_string,
-	},
 	{ .ctl_name = 0 }
 };
 
 static ctl_table ocfs_kern_table[] = {
 	{
-		.ctl_name	= KERN_OCFS,
+		.ctl_name	= KERN_OCFS2,
 		.procname	= "ocfs2",
 		.data		= NULL,
 		.maxlen		= 0,



More information about the Ocfs2-commits mailing list