From: Christoph Hellwig <hch@infradead.org>
To: linux-nfs@vger.kernel.org, viro@zeniv.linux.org.uk
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH 01/11] sunrpc: allocate pipefs inodes using kmalloc
Date: Sun, 01 Dec 2013 05:14:42 -0800 [thread overview]
Message-ID: <20131201132009.815675002@bombadil.infradead.org> (raw)
In-Reply-To: 20131201131441.790963326@bombadil.infradead.org
There's not a lot of them, and not needing our own slab makes
initialization ordering a whole lot simpler.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
net/sunrpc/rpc_pipe.c | 39 +++++++--------------------------------
1 file changed, 7 insertions(+), 32 deletions(-)
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index bf04b30..395eb5f 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -40,8 +40,6 @@
static struct file_system_type rpc_pipe_fs_type;
-static struct kmem_cache *rpc_inode_cachep __read_mostly;
-
#define RPC_UPCALL_TIMEOUT (30*HZ)
static BLOCKING_NOTIFIER_HEAD(rpc_pipefs_notifier_list);
@@ -193,24 +191,21 @@ rpc_close_pipes(struct inode *inode)
static struct inode *
rpc_alloc_inode(struct super_block *sb)
{
- struct rpc_inode *rpci;
- rpci = (struct rpc_inode *)kmem_cache_alloc(rpc_inode_cachep, GFP_KERNEL);
+ struct rpc_inode *rpci = kmalloc(sizeof(struct rpc_inode), GFP_KERNEL);
if (!rpci)
return NULL;
- return &rpci->vfs_inode;
-}
-static void
-rpc_i_callback(struct rcu_head *head)
-{
- struct inode *inode = container_of(head, struct inode, i_rcu);
- kmem_cache_free(rpc_inode_cachep, RPC_I(inode));
+ inode_init_once(&rpci->vfs_inode);
+ rpci->private = NULL;
+ rpci->pipe = NULL;
+ init_waitqueue_head(&rpci->waitq);
+ return &rpci->vfs_inode;
}
static void
rpc_destroy_inode(struct inode *inode)
{
- call_rcu(&inode->i_rcu, rpc_i_callback);
+ kfree_rcu(inode, i_rcu);
}
static int
@@ -1327,28 +1322,10 @@ static struct file_system_type rpc_pipe_fs_type = {
MODULE_ALIAS_FS("rpc_pipefs");
MODULE_ALIAS("rpc_pipefs");
-static void
-init_once(void *foo)
-{
- struct rpc_inode *rpci = (struct rpc_inode *) foo;
-
- inode_init_once(&rpci->vfs_inode);
- rpci->private = NULL;
- rpci->pipe = NULL;
- init_waitqueue_head(&rpci->waitq);
-}
-
int register_rpc_pipefs(void)
{
int err;
- rpc_inode_cachep = kmem_cache_create("rpc_inode_cache",
- sizeof(struct rpc_inode),
- 0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
- SLAB_MEM_SPREAD),
- init_once);
- if (!rpc_inode_cachep)
- return -ENOMEM;
err = rpc_clients_notifier_register();
if (err)
goto err_notifier;
@@ -1360,13 +1337,11 @@ int register_rpc_pipefs(void)
err_register:
rpc_clients_notifier_unregister();
err_notifier:
- kmem_cache_destroy(rpc_inode_cachep);
return err;
}
void unregister_rpc_pipefs(void)
{
rpc_clients_notifier_unregister();
- kmem_cache_destroy(rpc_inode_cachep);
unregister_filesystem(&rpc_pipe_fs_type);
}
--
1.7.10.4
next prev parent reply other threads:[~2013-12-01 13:20 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-01 13:14 [PATCH 00/11] [RFC] repair net namespace damage to rpc_pipefs Christoph Hellwig
2013-12-01 13:14 ` Christoph Hellwig [this message]
2013-12-01 14:26 ` [PATCH 01/11] sunrpc: allocate pipefs inodes using kmalloc Jeff Layton
2013-12-01 13:14 ` [PATCH 02/11] rpc_pipefs: always mount on net namespace initialization Christoph Hellwig
2013-12-01 15:24 ` Jeff Layton
2013-12-01 13:14 ` [PATCH 03/11] sunrpc: remove the rpc_clients_block notifier Christoph Hellwig
2013-12-01 15:25 ` Jeff Layton
2013-12-01 13:14 ` [PATCH 04/11] sunrpc: no need to have a lock or superblock for rpc_unlink Christoph Hellwig
2013-12-01 13:14 ` [PATCH 05/11] sunprc: add sensible pipe creation and removal helpers Christoph Hellwig
2013-12-01 13:14 ` [PATCH 06/11] sunrpc: clean up rpc_pipefs client dir creation Christoph Hellwig
2013-12-01 13:14 ` [PATCH 07/11] sunrpc: make rpc_mkdir_populate net-namespace aware Christoph Hellwig
2013-12-01 13:14 ` [PATCH 08/11] sunrpc: rpc_get_sb_net, die, die, die Christoph Hellwig
2013-12-01 13:14 ` [PATCH 09/11] nfs: convert idmapper to rpc_mkpipe_clnt Christoph Hellwig
2013-12-01 13:14 ` [PATCH 10/11] auth_gss: convert " Christoph Hellwig
2013-12-01 13:14 ` [PATCH 11/11] sunrpc: rpc_pipefs cleanup Christoph Hellwig
2013-12-01 14:36 ` [PATCH 00/11] [RFC] repair net namespace damage to rpc_pipefs Jeff Layton
2013-12-01 15:44 ` Jeff Layton
2013-12-01 15:57 ` Jeff Layton
2013-12-01 18:13 ` Al Viro
2013-12-02 8:12 ` Christoph Hellwig
2013-12-02 13:44 ` Trond Myklebust
2013-12-02 14:24 ` Stanislav Kinsbursky
2013-12-02 15:36 ` Christoph Hellwig
2013-12-02 15:58 ` Trond Myklebust
2013-12-03 7:24 ` Stanislav Kinsbursky
2013-12-02 15:34 ` Christoph Hellwig
2013-12-02 16:00 ` Trond Myklebust
2013-12-02 16:27 ` Christoph Hellwig
2013-12-02 16:46 ` Trond Myklebust
2013-12-02 16:33 ` Jeff Layton
2013-12-02 16:37 ` J. Bruce Fields
2013-12-02 16:45 ` Jeff Layton
2013-12-02 15:57 ` Al Viro
2013-12-02 16:04 ` Trond Myklebust
2013-12-03 2:11 ` [RFC] alloc_pid() breakage Al Viro
2013-12-02 7:23 ` [PATCH 00/11] [RFC] repair net namespace damage to rpc_pipefs Stanislav Kinsbursky
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=20131201132009.815675002@bombadil.infradead.org \
--to=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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).