diff options
author | NeilBrown <neilb@suse.de> | 2009-09-09 16:32:54 +1000 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-09-18 17:01:12 -0400 |
commit | cd68c374ea9ce202ae7c6346777d10078e243d49 (patch) | |
tree | 0aa206d2605c57c6944f7461c6eb1576a9d1f987 | |
parent | 67e7328f1577230ef3a1430c1a7e5c07978c6e51 (diff) | |
download | linux-cd68c374ea9ce202ae7c6346777d10078e243d49.tar.gz linux-cd68c374ea9ce202ae7c6346777d10078e243d49.tar.bz2 linux-cd68c374ea9ce202ae7c6346777d10078e243d49.zip |
sunrpc/cache: avoid variable over-loading in cache_defer_req
In cache_defer_req, 'dreq' is used for two significantly different
values that happen to be of the same type.
This is both confusing, and makes it hard to extend the range of one of
the values as we will in the next patch.
So introduce 'discard' to take one of the values.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
-rw-r--r-- | net/sunrpc/cache.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 4a32a30a03eb..d6eee291a0e2 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -500,7 +500,7 @@ static int cache_defer_cnt; static int cache_defer_req(struct cache_req *req, struct cache_head *item) { - struct cache_deferred_req *dreq; + struct cache_deferred_req *dreq, *discard; int hash = DFR_HASH(item); if (cache_defer_cnt >= DFR_MAX) { @@ -525,20 +525,20 @@ static int cache_defer_req(struct cache_req *req, struct cache_head *item) list_add(&dreq->hash, &cache_defer_hash[hash]); /* it is in, now maybe clean up */ - dreq = NULL; + discard = NULL; if (++cache_defer_cnt > DFR_MAX) { - dreq = list_entry(cache_defer_list.prev, - struct cache_deferred_req, recent); - list_del_init(&dreq->recent); - list_del_init(&dreq->hash); + discard = list_entry(cache_defer_list.prev, + struct cache_deferred_req, recent); + list_del_init(&discard->recent); + list_del_init(&discard->hash); cache_defer_cnt--; } spin_unlock(&cache_defer_lock); - if (dreq) { + if (discard) /* there was one too many */ - dreq->revisit(dreq, 1); - } + discard->revisit(discard, 1); + if (!test_bit(CACHE_PENDING, &item->flags)) { /* must have just been validated... */ cache_revisit_request(item); |