diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2013-02-04 06:02:50 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2013-02-15 10:43:46 -0500 |
commit | 2d4383383b0b04ca380b67aa2d7397d0b399dcbf (patch) | |
tree | f9e8bddc466c2c8dfdcf039aca4d53752e524fb9 /net/sunrpc/cache.c | |
parent | 73fb847a44224d5708550e4be7baba9da75e00af (diff) |
SUNRPC: rework cache upcall logic
For most of SUNRPC caches (except NFS DNS cache) cache_detail->cache_upcall is
redundant since all that it's implementations are doing is calling
sunrpc_cache_pipe_upcall() with proper function address argument.
Cache request function address is now stored on cache_detail structure and
thus all the code can be simplified.
Now, for those cache details, which doesn't have cache_upcall callback (the
only one, which still has is nfs_dns_resolve_template)
sunrpc_cache_pipe_upcall will be called instead.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc/cache.c')
-rw-r--r-- | net/sunrpc/cache.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 9f8470353362..51853d8ed0bc 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -196,9 +196,9 @@ EXPORT_SYMBOL_GPL(sunrpc_cache_update); | |||
196 | 196 | ||
197 | static int cache_make_upcall(struct cache_detail *cd, struct cache_head *h) | 197 | static int cache_make_upcall(struct cache_detail *cd, struct cache_head *h) |
198 | { | 198 | { |
199 | if (!cd->cache_upcall) | 199 | if (cd->cache_upcall) |
200 | return -EINVAL; | 200 | return cd->cache_upcall(cd, h); |
201 | return cd->cache_upcall(cd, h); | 201 | return sunrpc_cache_pipe_upcall(cd, h, cd->cache_request); |
202 | } | 202 | } |
203 | 203 | ||
204 | static inline int cache_is_valid(struct cache_detail *detail, struct cache_head *h) | 204 | static inline int cache_is_valid(struct cache_detail *detail, struct cache_head *h) |
@@ -1152,6 +1152,9 @@ int sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h, | |||
1152 | char *bp; | 1152 | char *bp; |
1153 | int len; | 1153 | int len; |
1154 | 1154 | ||
1155 | if (!detail->cache_request) | ||
1156 | return -EINVAL; | ||
1157 | |||
1155 | if (!cache_listeners_exist(detail)) { | 1158 | if (!cache_listeners_exist(detail)) { |
1156 | warn_no_listener(detail); | 1159 | warn_no_listener(detail); |
1157 | return -EINVAL; | 1160 | return -EINVAL; |
@@ -1605,7 +1608,7 @@ static int create_cache_proc_entries(struct cache_detail *cd, struct net *net) | |||
1605 | if (p == NULL) | 1608 | if (p == NULL) |
1606 | goto out_nomem; | 1609 | goto out_nomem; |
1607 | 1610 | ||
1608 | if (cd->cache_upcall || cd->cache_parse) { | 1611 | if (cd->cache_request || cd->cache_parse) { |
1609 | p = proc_create_data("channel", S_IFREG|S_IRUSR|S_IWUSR, | 1612 | p = proc_create_data("channel", S_IFREG|S_IRUSR|S_IWUSR, |
1610 | cd->u.procfs.proc_ent, | 1613 | cd->u.procfs.proc_ent, |
1611 | &cache_file_operations_procfs, cd); | 1614 | &cache_file_operations_procfs, cd); |