aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorStanislav Kinsbursky <skinsbursky@parallels.com>2012-01-19 12:42:21 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-01-31 19:28:14 -0500
commit0a402d5a653ee2b613aaba3092a87b1e964622ce (patch)
tree160a5942e42d7a537859e318837bf475bc8123e0 /net
parent5ecebb7c7fd737cf387a552994df319c063973db (diff)
SUNRPC: cache creation and destruction routines introduced
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> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Acked-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/cache.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index fefe06729f9d..a450b8ac648b 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1664,6 +1664,32 @@ void cache_unregister(struct cache_detail *cd)
1664} 1664}
1665EXPORT_SYMBOL_GPL(cache_unregister); 1665EXPORT_SYMBOL_GPL(cache_unregister);
1666 1666
1667struct cache_detail *cache_create_net(struct cache_detail *tmpl, struct net *net)
1668{
1669 struct cache_detail *cd;
1670
1671 cd = kmemdup(tmpl, sizeof(struct cache_detail), GFP_KERNEL);
1672 if (cd == NULL)
1673 return ERR_PTR(-ENOMEM);
1674
1675 cd->hash_table = kzalloc(cd->hash_size * sizeof(struct cache_head *),
1676 GFP_KERNEL);
1677 if (cd->hash_table == NULL) {
1678 kfree(cd);
1679 return ERR_PTR(-ENOMEM);
1680 }
1681 cd->net = net;
1682 return cd;
1683}
1684EXPORT_SYMBOL_GPL(cache_create_net);
1685
1686void cache_destroy_net(struct cache_detail *cd, struct net *net)
1687{
1688 kfree(cd->hash_table);
1689 kfree(cd);
1690}
1691EXPORT_SYMBOL_GPL(cache_destroy_net);
1692
1667static ssize_t cache_read_pipefs(struct file *filp, char __user *buf, 1693static ssize_t cache_read_pipefs(struct file *filp, char __user *buf,
1668 size_t count, loff_t *ppos) 1694 size_t count, loff_t *ppos)
1669{ 1695{