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>
}
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)
* 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;
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)