NFS: simplify and clean cache library
This is a cleanup patch.
Such helpers like nfs_cache_init() and nfs_cache_destroy() are redundant,
because they are just a wrappers around sunrpc_init_cache_detail() and
sunrpc_destroy_cache_detail() respectively.
So let's remove them completely and move corresponding logic to
nfs_cache_register_net() and nfs_cache_unregister_net() respectively (since
they are called together anyway).
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
diff --git a/fs/nfs/dns_resolve.c b/fs/nfs/dns_resolve.c
index d5ce5f4..9cbc98a 100644
--- a/fs/nfs/dns_resolve.c
+++ b/fs/nfs/dns_resolve.c
@@ -377,14 +377,12 @@
if (IS_ERR(nn->nfs_dns_resolve))
return PTR_ERR(nn->nfs_dns_resolve);
- nfs_cache_init(nn->nfs_dns_resolve);
err = nfs_cache_register_net(net, nn->nfs_dns_resolve);
if (err)
goto err_reg;
return 0;
err_reg:
- nfs_cache_destroy(nn->nfs_dns_resolve);
cache_destroy_net(nn->nfs_dns_resolve, net);
return err;
}
@@ -392,10 +390,8 @@
void nfs_dns_resolver_cache_destroy(struct net *net)
{
struct nfs_net *nn = net_generic(net, nfs_net_id);
- struct cache_detail *cd = nn->nfs_dns_resolve;
- nfs_cache_unregister_net(net, cd);
- nfs_cache_destroy(cd);
+ nfs_cache_unregister_net(net, nn->nfs_dns_resolve);
cache_destroy_net(nn->nfs_dns_resolve, net);
}