[pnfs] [PATCH 2/3] pnfs-gfs2: add interface to specify DSes on the MDS
David M. Richter
richterd at citi.umich.edu
Thu Jun 5 11:47:16 EDT 2008
Add a temporary /proc interface (/proc/sys/fs/gfs2/pnfs_ds_list) into which
the (comma-separated) IP addresses of DSes can be echoed. At some point
this will be removed or reworked.
Signed-off-by: David M. Richter <richterd at citi.umich.edu>
Signed-off-by: Frank Filz <ffilzlnx at us.ibm.com>
---
fs/gfs2/gfs2.h | 6 +++++
fs/gfs2/main.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+), 0 deletions(-)
diff --git a/fs/gfs2/gfs2.h b/fs/gfs2/gfs2.h
index 3bb11c0..8669d7e 100644
--- a/fs/gfs2/gfs2.h
+++ b/fs/gfs2/gfs2.h
@@ -27,5 +27,11 @@ enum {
#define GFS2_FAST_NAME_SIZE 8
+#if defined(CONFIG_PNFSD)
+/* XXX: revisit; surely there's a better place for this? */
+#define XXX_PNFS_DS_LISTSZ 256
+extern char pnfs_ds_list[XXX_PNFS_DS_LISTSZ];
+#endif /* CONFIG_PNFSD */
+
#endif /* __GFS2_DOT_H__ */
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c
index 9c7765c..caebe75 100644
--- a/fs/gfs2/main.c
+++ b/fs/gfs2/main.c
@@ -24,6 +24,70 @@
#include "util.h"
#include "glock.h"
+/*
+ * XXX: the /proc interface for specifying pNFS DSes and possibly other
+ * stuff in the future. this should be pruned, replaced, or moved.
+ */
+#if defined(CONFIG_PNFSD)
+#include <linux/fs.h>
+#include <linux/sysctl.h>
+
+char pnfs_ds_list[XXX_PNFS_DS_LISTSZ];
+
+static struct ctl_table_header *gfs2_sysctl_table;
+
+static ctl_table gfs2_sysctls[] = {
+ {
+ .ctl_name = CTL_UNNUMBERED,
+ .procname = "pnfs_ds_list",
+ .data = &pnfs_ds_list,
+ .maxlen = XXX_PNFS_DS_LISTSZ,
+ .mode = 0644,
+ .proc_handler = &proc_dostring,
+ .strategy = &sysctl_string,
+ },
+ { .ctl_name = 0 }
+};
+
+static ctl_table gfs2_sysctl_dir[] = {
+ {
+ .ctl_name = CTL_UNNUMBERED,
+ .procname = "gfs2",
+ .mode = 0555,
+ .child = gfs2_sysctls,
+ },
+ { .ctl_name = 0 }
+};
+
+static ctl_table gfs2_sysctl_root[] = {
+ {
+ .ctl_name = CTL_FS,
+ .procname = "fs",
+ .mode = 0555,
+ .child = gfs2_sysctl_dir,
+ },
+ { .ctl_name = 0 }
+};
+
+static int gfs2_register_sysctl(void)
+{
+ gfs2_sysctl_table = register_sysctl_table(gfs2_sysctl_root);
+ if (gfs2_sysctl_table == NULL)
+ return -ENOMEM;
+ return 0;
+}
+
+static void gfs2_unregister_sysctl(void)
+{
+ unregister_sysctl_table(gfs2_sysctl_table);
+ gfs2_sysctl_table = NULL;
+}
+
+#else /* !CONFIG_PNFSD */
+#define gfs2_register_sysctl() 0
+#define gfs2_unregister_sysctl() do { } while (0)
+#endif /* CONFIG_PNFSD */
+
static void gfs2_init_inode_once(struct kmem_cache *cachep, void *foo)
{
struct gfs2_inode *ip = foo;
@@ -97,6 +161,10 @@ static int __init init_gfs2_fs(void)
if (error)
goto fail_unregister;
+ error = gfs2_register_sysctl();
+ if (error)
+ goto fail_unregister;
+
gfs2_register_debugfs();
printk("GFS2 (built %s %s) installed\n", __DATE__, __TIME__);
@@ -130,6 +198,7 @@ static void __exit exit_gfs2_fs(void)
{
gfs2_glock_exit();
gfs2_unregister_debugfs();
+ gfs2_unregister_sysctl();
unregister_filesystem(&gfs2_fs_type);
unregister_filesystem(&gfs2meta_fs_type);
--
1.5.3
More information about the pNFS
mailing list