aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-09-09 16:32:54 +1000
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-09-11 17:03:27 -0400
commit9e4c6379a62d94d3362b12c7a00f2105df6d7eeb (patch)
tree457b1b5c1a28752d4fa878b2d4b1ed0517f0c78f
parent4cfc7e6019caa3e97d2a81c48c8d575d7b38d751 (diff)
sunrpc/cache: change cache_defer_req to return -ve error, not boolean.
As "cache_defer_req" does not sound like a predicate, having it return a boolean value can be confusing. It is more consistent to return 0 for success and negative for error. Exactly what error code to return is not important as we don't differentiate between reasons why the request wasn't deferred, we only care about whether it was deferred or not. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
-rw-r--r--net/sunrpc/cache.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index ade8a7e99cd..1a50dfe6dc6 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -255,7 +255,7 @@ int cache_check(struct cache_detail *detail,
}
if (rv == -EAGAIN) {
- if (cache_defer_req(rqstp, h) == 0) {
+ if (cache_defer_req(rqstp, h) < 0) {
/* Request is not deferred */
rv = cache_is_valid(detail, h);
if (rv == -EAGAIN)
@@ -511,11 +511,11 @@ static int cache_defer_req(struct cache_req *req, struct cache_head *item)
* or continue and drop the oldest below
*/
if (net_random()&1)
- return 0;
+ return -ENOMEM;
}
dreq = req->defer(req);
if (dreq == NULL)
- return 0;
+ return -ENOMEM;
dreq->item = item;
@@ -545,9 +545,9 @@ static int cache_defer_req(struct cache_req *req, struct cache_head *item)
if (!test_bit(CACHE_PENDING, &item->flags)) {
/* must have just been validated... */
cache_revisit_request(item);
- return 0;
+ return -EAGAIN;
}
- return 1;
+ return 0;
}
static void cache_revisit_request(struct cache_head *item)