From: David Howells <dhowells@redhat.com>
To: torvalds@osdl.org, akpm@osdl.org, steved@redhat.com,
trond.myklebust@fys.uio.no, aviro@redhat.com
Cc: linux-fsdevel@vger.kernel.org, linux-cachefs@redhat.com,
nfsv4@linux-nfs.org, linux-kernel@vger.kernel.org
Subject: [PATCH 03/14] NFS: Abstract out namespace initialisation [try #10]
Date: Fri, 19 May 2006 16:46:50 +0100 [thread overview]
Message-ID: <20060519154650.11791.71116.stgit@warthog.cambridge.redhat.com> (raw)
In-Reply-To: <20060519154640.11791.2928.stgit@warthog.cambridge.redhat.com>
The attached patch abstracts out the namespace initialisation so that temporary
namespaces can be set up elsewhere.
The following changes were made in [try #8]:
(*) init_namespace() has been made out-of-line.
Signed-Off-By: David Howells <dhowells@redhat.com>
---
fs/namespace.c | 28 +++++++++++++++++++++-------
include/linux/namespace.h | 1 +
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index 84a3bec..6d2e8fb 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1790,6 +1790,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;
@@ -1802,13 +1822,7 @@ static void __init init_mount_tree(void)
namespace = kmalloc(sizeof(*namespace), GFP_KERNEL);
if (!namespace)
panic("Can't allocate initial namespace");
- atomic_set(&namespace->count, 1);
- INIT_LIST_HEAD(&namespace->list);
- init_waitqueue_head(&namespace->poll);
- namespace->event = 0;
- list_add(&mnt->mnt_list, &namespace->list);
- namespace->root = mnt;
- mnt->mnt_namespace = namespace;
+ init_namespace(namespace, mnt);
init_task.namespace = namespace;
read_lock(&tasklist_lock);
diff --git a/include/linux/namespace.h b/include/linux/namespace.h
index 3abc8e3..c371a30 100644
--- a/include/linux/namespace.h
+++ b/include/linux/namespace.h
@@ -16,6 +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 *);
+extern void init_namespace(struct namespace *, struct vfsmount *);
static inline void put_namespace(struct namespace *namespace)
{
next prev parent reply other threads:[~2006-05-19 15:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-19 15:46 [PATCH 00/14] Permit filesystem local caching and NFS superblock sharing [try #10] David Howells
2006-05-19 15:46 ` [PATCH 01/14] NFS: Permit filesystem to override root dentry on mount " David Howells
2006-05-30 10:45 ` Al Viro
2006-05-19 15:46 ` [PATCH 02/14] NFS: Permit filesystem to perform statfs with a known root dentry " David Howells
2006-05-19 15:46 ` David Howells [this message]
2006-05-30 10:35 ` [PATCH 03/14] NFS: Abstract out namespace initialisation " Al Viro
2006-05-30 10:51 ` David Howells
2006-05-19 15:46 ` [PATCH 04/14] NFS: Add dentry materialisation op " David Howells
2006-05-19 15:46 ` [PATCH 05/14] NFS: Split fs/nfs/inode.c into inode, superblock and namespace bits " David Howells
2006-05-19 15:46 ` [PATCH 06/14] NFS: Share NFS superblocks per-protocol per-server per-FSID " David Howells
2006-05-19 15:46 ` [PATCH 07/14] FS-Cache: Provide a filesystem-specific sync'able page bit " David Howells
2006-05-19 15:47 ` [PATCH 08/14] FS-Cache: Add notification of page becoming writable to VMA ops " David Howells
2006-05-19 15:47 ` [PATCH 09/14] FS-Cache: Avoid ENFILE checking for kernel-specific open files " David Howells
2006-05-19 15:47 ` [PATCH 10/14] FS-Cache: Generic filesystem caching facility " David Howells
2006-05-19 15:47 ` [PATCH 11/14] FS-Cache: Release page->private in failed readahead " David Howells
2006-05-19 15:47 ` [PATCH 12/14] FS-Cache: Make kAFS use FS-Cache " David Howells
2006-05-19 15:47 ` [PATCH 13/14] FS-Cache: CacheFiles: A cache that backs onto a mounted filesystem " David Howells
2006-05-19 15:47 ` [PATCH 14/14] NFS: Use local caching " David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060519154650.11791.71116.stgit@warthog.cambridge.redhat.com \
--to=dhowells@redhat.com \
--cc=akpm@osdl.org \
--cc=aviro@redhat.com \
--cc=linux-cachefs@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nfsv4@linux-nfs.org \
--cc=steved@redhat.com \
--cc=torvalds@osdl.org \
--cc=trond.myklebust@fys.uio.no \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).