diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2013-02-04 06:02:40 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2013-02-15 10:43:36 -0500 |
commit | 462b8f6bf1d3f5feb7a346394036dbc1df3a8ed5 (patch) | |
tree | 3ff18fadfefa42d972409ab1965e90bdf126d1cb /fs/nfs | |
parent | 483479c26a65e5f0cc95e9324f313bc95c7dc6fd (diff) |
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>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/cache_lib.c | 12 | ||||
-rw-r--r-- | fs/nfs/cache_lib.h | 2 | ||||
-rw-r--r-- | fs/nfs/dns_resolve.c | 6 |
3 files changed, 4 insertions, 16 deletions
diff --git a/fs/nfs/cache_lib.c b/fs/nfs/cache_lib.c index 862a2f16db64..5f7b053720ee 100644 --- a/fs/nfs/cache_lib.c +++ b/fs/nfs/cache_lib.c | |||
@@ -128,10 +128,13 @@ int nfs_cache_register_net(struct net *net, struct cache_detail *cd) | |||
128 | struct super_block *pipefs_sb; | 128 | struct super_block *pipefs_sb; |
129 | int ret = 0; | 129 | int ret = 0; |
130 | 130 | ||
131 | sunrpc_init_cache_detail(cd); | ||
131 | pipefs_sb = rpc_get_sb_net(net); | 132 | pipefs_sb = rpc_get_sb_net(net); |
132 | if (pipefs_sb) { | 133 | if (pipefs_sb) { |
133 | ret = nfs_cache_register_sb(pipefs_sb, cd); | 134 | ret = nfs_cache_register_sb(pipefs_sb, cd); |
134 | rpc_put_sb_net(net); | 135 | rpc_put_sb_net(net); |
136 | if (ret) | ||
137 | sunrpc_destroy_cache_detail(cd); | ||
135 | } | 138 | } |
136 | return ret; | 139 | return ret; |
137 | } | 140 | } |
@@ -151,14 +154,5 @@ void nfs_cache_unregister_net(struct net *net, struct cache_detail *cd) | |||
151 | nfs_cache_unregister_sb(pipefs_sb, cd); | 154 | nfs_cache_unregister_sb(pipefs_sb, cd); |
152 | rpc_put_sb_net(net); | 155 | rpc_put_sb_net(net); |
153 | } | 156 | } |
154 | } | ||
155 | |||
156 | void nfs_cache_init(struct cache_detail *cd) | ||
157 | { | ||
158 | sunrpc_init_cache_detail(cd); | ||
159 | } | ||
160 | |||
161 | void nfs_cache_destroy(struct cache_detail *cd) | ||
162 | { | ||
163 | sunrpc_destroy_cache_detail(cd); | 157 | sunrpc_destroy_cache_detail(cd); |
164 | } | 158 | } |
diff --git a/fs/nfs/cache_lib.h b/fs/nfs/cache_lib.h index 317db95e37f8..4116d2c3f52f 100644 --- a/fs/nfs/cache_lib.h +++ b/fs/nfs/cache_lib.h | |||
@@ -23,8 +23,6 @@ extern struct nfs_cache_defer_req *nfs_cache_defer_req_alloc(void); | |||
23 | extern void nfs_cache_defer_req_put(struct nfs_cache_defer_req *dreq); | 23 | extern void nfs_cache_defer_req_put(struct nfs_cache_defer_req *dreq); |
24 | extern int nfs_cache_wait_for_upcall(struct nfs_cache_defer_req *dreq); | 24 | extern int nfs_cache_wait_for_upcall(struct nfs_cache_defer_req *dreq); |
25 | 25 | ||
26 | extern void nfs_cache_init(struct cache_detail *cd); | ||
27 | extern void nfs_cache_destroy(struct cache_detail *cd); | ||
28 | extern int nfs_cache_register_net(struct net *net, struct cache_detail *cd); | 26 | extern int nfs_cache_register_net(struct net *net, struct cache_detail *cd); |
29 | extern void nfs_cache_unregister_net(struct net *net, struct cache_detail *cd); | 27 | extern void nfs_cache_unregister_net(struct net *net, struct cache_detail *cd); |
30 | extern int nfs_cache_register_sb(struct super_block *sb, | 28 | extern int nfs_cache_register_sb(struct super_block *sb, |
diff --git a/fs/nfs/dns_resolve.c b/fs/nfs/dns_resolve.c index d5ce5f4f0f5f..9cbc98a4159d 100644 --- a/fs/nfs/dns_resolve.c +++ b/fs/nfs/dns_resolve.c | |||
@@ -377,14 +377,12 @@ int nfs_dns_resolver_cache_init(struct net *net) | |||
377 | if (IS_ERR(nn->nfs_dns_resolve)) | 377 | if (IS_ERR(nn->nfs_dns_resolve)) |
378 | return PTR_ERR(nn->nfs_dns_resolve); | 378 | return PTR_ERR(nn->nfs_dns_resolve); |
379 | 379 | ||
380 | nfs_cache_init(nn->nfs_dns_resolve); | ||
381 | err = nfs_cache_register_net(net, nn->nfs_dns_resolve); | 380 | err = nfs_cache_register_net(net, nn->nfs_dns_resolve); |
382 | if (err) | 381 | if (err) |
383 | goto err_reg; | 382 | goto err_reg; |
384 | return 0; | 383 | return 0; |
385 | 384 | ||
386 | err_reg: | 385 | err_reg: |
387 | nfs_cache_destroy(nn->nfs_dns_resolve); | ||
388 | cache_destroy_net(nn->nfs_dns_resolve, net); | 386 | cache_destroy_net(nn->nfs_dns_resolve, net); |
389 | return err; | 387 | return err; |
390 | } | 388 | } |
@@ -392,10 +390,8 @@ err_reg: | |||
392 | void nfs_dns_resolver_cache_destroy(struct net *net) | 390 | void nfs_dns_resolver_cache_destroy(struct net *net) |
393 | { | 391 | { |
394 | struct nfs_net *nn = net_generic(net, nfs_net_id); | 392 | struct nfs_net *nn = net_generic(net, nfs_net_id); |
395 | struct cache_detail *cd = nn->nfs_dns_resolve; | ||
396 | 393 | ||
397 | nfs_cache_unregister_net(net, cd); | 394 | nfs_cache_unregister_net(net, nn->nfs_dns_resolve); |
398 | nfs_cache_destroy(cd); | ||
399 | cache_destroy_net(nn->nfs_dns_resolve, net); | 395 | cache_destroy_net(nn->nfs_dns_resolve, net); |
400 | } | 396 | } |
401 | 397 | ||