From: Stanislav Kinsbursky <skinsbursky@parallels.com>
To: Trond.Myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org, xemul@parallels.com, neilb@suse.de,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
jbottomley@parallels.com, bfields@fieldses.org,
davem@davemloft.net, devel@openvz.org
Subject: [PATCH v2 1/5] SUNRPC: cache creation and destruction routines introduced
Date: Thu, 19 Jan 2012 21:42:21 +0400 [thread overview]
Message-ID: <20120119174221.23767.91209.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20120119173823.23767.91876.stgit@localhost6.localdomain6>
This patch prepares infrastructure for network namespace aware cache detail
allocation.
One note about adding network namespace link to cache structure. It's going to
be used later in NFS DNS cache parsing routine (nfs_dns_parse for rpc_pton()
call).
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
---
include/linux/sunrpc/cache.h | 4 ++++
net/sunrpc/cache.c | 26 ++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 590a8ab..259381c 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -117,6 +117,7 @@ struct cache_detail {
struct cache_detail_procfs procfs;
struct cache_detail_pipefs pipefs;
} u;
+ struct net *net;
};
@@ -202,6 +203,9 @@ extern int cache_register_net(struct cache_detail *cd, struct net *net);
extern void cache_unregister(struct cache_detail *cd);
extern void cache_unregister_net(struct cache_detail *cd, struct net *net);
+extern struct cache_detail *cache_create_net(struct cache_detail *tmpl, struct net *net);
+extern void cache_destroy_net(struct cache_detail *cd, struct net *net);
+
extern void sunrpc_init_cache_detail(struct cache_detail *cd);
extern void sunrpc_destroy_cache_detail(struct cache_detail *cd);
extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *,
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index f128154..9ef5926 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1662,6 +1662,32 @@ void cache_unregister(struct cache_detail *cd)
}
EXPORT_SYMBOL_GPL(cache_unregister);
+struct cache_detail *cache_create_net(struct cache_detail *tmpl, struct net *net)
+{
+ struct cache_detail *cd;
+
+ cd = kmemdup(tmpl, sizeof(struct cache_detail), GFP_KERNEL);
+ if (cd == NULL)
+ return ERR_PTR(-ENOMEM);
+
+ cd->hash_table = kzalloc(cd->hash_size * sizeof(struct cache_head *),
+ GFP_KERNEL);
+ if (cd->hash_table == NULL) {
+ kfree(cd);
+ return ERR_PTR(-ENOMEM);
+ }
+ cd->net = net;
+ return cd;
+}
+EXPORT_SYMBOL_GPL(cache_create_net);
+
+void cache_destroy_net(struct cache_detail *cd, struct net *net)
+{
+ kfree(cd->hash_table);
+ kfree(cd);
+}
+EXPORT_SYMBOL_GPL(cache_destroy_net);
+
static ssize_t cache_read_pipefs(struct file *filp, char __user *buf,
size_t count, loff_t *ppos)
{
next prev parent reply other threads:[~2012-01-19 17:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-19 17:42 [PATCH v2 0/5] SUNRPC: make caches network namespace aware Stanislav Kinsbursky
2012-01-19 17:42 ` Stanislav Kinsbursky [this message]
2012-01-19 17:42 ` [PATCH v2 2/5] SUNRPC: create unix gid cache per network namespace Stanislav Kinsbursky
[not found] ` <20120119174229.23767.23.stgit-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
2012-01-19 22:31 ` J. Bruce Fields
2012-01-19 17:42 ` [PATCH v2 3/5] SUNRPC: create GSS auth " Stanislav Kinsbursky
2012-01-19 17:42 ` [PATCH v2 4/5] SUNRPC: ip map cache per network namespace cleanup Stanislav Kinsbursky
2012-01-19 17:42 ` [PATCH v2 5/5] SUNRPC: generic cache register routines removed Stanislav Kinsbursky
2012-01-20 11:09 ` [PATCH v2 0/5] SUNRPC: make caches network namespace aware Stanislav Kinsbursky
[not found] ` <4F194B7F.4030002-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-01-20 14:29 ` bfields-uC3wQj2KruNg9hUCZPvPmw
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=20120119174221.23767.91209.stgit@localhost6.localdomain6 \
--to=skinsbursky@parallels.com \
--cc=Trond.Myklebust@netapp.com \
--cc=bfields@fieldses.org \
--cc=davem@davemloft.net \
--cc=devel@openvz.org \
--cc=jbottomley@parallels.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=netdev@vger.kernel.org \
--cc=xemul@parallels.com \
/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).