[Linux-cachefs] [PATCH] NFS: Make namespace initialisation out of line

David Howells dhowells at redhat.com
Wed Mar 8 21:14:23 UTC 2006


The attached patch makes the abstracted-out namespace initialisation out of
line.

Signed-Off-By: David Howells <dhowells at redhat.com>
---
warthog>diffstat -p1 /tmp/initns.diff 
 fs/namespace.c            |   20 ++++++++++++++++++++
 include/linux/namespace.h |   16 +---------------
 2 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index 6f13481..3466a11 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1714,6 +1714,26 @@ out3:
 	goto out2;
 }
 
+/*
+ * initialise a namespace, rooting it at the given specified mountpoint if one
+ * is given
+ */
+void init_namespace(struct namespace *namespace, struct vfsmount *mnt)
+{
+	atomic_set(&namespace->count, 1);
+	INIT_LIST_HEAD(&namespace->list);
+	init_waitqueue_head(&namespace->poll);
+	namespace->event = 0;
+	namespace->root = mnt;
+
+	if (mnt) {
+		list_add(&mnt->mnt_list, &namespace->list);
+		mnt->mnt_namespace = namespace;
+	}
+}
+
+EXPORT_SYMBOL_GPL(init_namespace);
+
 static void __init init_mount_tree(void)
 {
 	struct vfsmount *mnt;
diff --git a/include/linux/namespace.h b/include/linux/namespace.h
index ea6fd62..c371a30 100644
--- a/include/linux/namespace.h
+++ b/include/linux/namespace.h
@@ -16,21 +16,7 @@ struct namespace {
 extern int copy_namespace(int, struct task_struct *);
 extern void __put_namespace(struct namespace *namespace);
 extern struct namespace *dup_namespace(struct task_struct *, struct fs_struct *);
-
-static inline void init_namespace(struct namespace *namespace,
-				  struct vfsmount *mnt)
-{
-	atomic_set(&namespace->count, 1);
-	INIT_LIST_HEAD(&namespace->list);
-	init_waitqueue_head(&namespace->poll);
-	namespace->event = 0;
-	namespace->root = mnt;
-
-	if (mnt) {
-		list_add(&mnt->mnt_list, &namespace->list);
-		mnt->mnt_namespace = namespace;
-	}
-}
+extern void init_namespace(struct namespace *, struct vfsmount *);
 
 static inline void put_namespace(struct namespace *namespace)
 {




More information about the Linux-cachefs mailing list