]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.fixes/nfsd-04-sunrpc-cache-avoid-variable-over-loading-in-cache_de.patch
Reenabled linux-xen, added patches for Xen Kernel Version 2.6.27.31,
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.fixes / nfsd-04-sunrpc-cache-avoid-variable-over-loading-in-cache_de.patch
1 Patch-mainline: submitted 04aug2009
2 References: bnc#498708
3 From: NeilBrown <neilb@suse.de>
4 Date: Tue, 4 Aug 2009 15:06:38 +1000
5 Subject: [PATCH 06/12] sunrpc/cache: avoid variable over-loading in cache_defer_req
6
7 In cache_defer_req, 'dreq' is used for two significantly different
8 values that happen to be of the same type.
9
10 This is both confusing, and make it hard to extend the range of one of
11 the values as we will in the next patch.
12 So introduce 'discard' to take one of the values.
13
14 Signed-off-by: NeilBrown <neilb@suse.de>
15
16 ---
17 net/sunrpc/cache.c | 14 +++++++-------
18 1 file changed, 7 insertions(+), 7 deletions(-)
19
20 --- linux-2.6.27-SLE11_BRANCH.orig/net/sunrpc/cache.c
21 +++ linux-2.6.27-SLE11_BRANCH/net/sunrpc/cache.c
22 @@ -562,7 +562,7 @@ static int cache_defer_cnt;
23
24 static int cache_defer_req(struct cache_req *req, struct cache_head *item)
25 {
26 - struct cache_deferred_req *dreq;
27 + struct cache_deferred_req *dreq, *discard;
28 int hash = DFR_HASH(item);
29
30 if (cache_defer_cnt >= DFR_MAX) {
31 @@ -587,20 +587,20 @@ static int cache_defer_req(struct cache_
32 list_add(&dreq->hash, &cache_defer_hash[hash]);
33
34 /* it is in, now maybe clean up */
35 - dreq = NULL;
36 + discard = NULL;
37 if (++cache_defer_cnt > DFR_MAX) {
38 - dreq = list_entry(cache_defer_list.prev,
39 - struct cache_deferred_req, recent);
40 + discard = list_entry(cache_defer_list.prev,
41 + struct cache_deferred_req, recent);
42 - list_del_init(&dreq->recent);
43 - list_del_init(&dreq->hash);
44 + list_del_init(&discard->recent);
45 + list_del_init(&discard->hash);
46 cache_defer_cnt--;
47 }
48 spin_unlock(&cache_defer_lock);
49
50 - if (dreq) {
51 + if (discard)
52 /* there was one too many */
53 - dreq->revisit(dreq, 1);
54 - }
55 + discard->revisit(discard, 1);
56 +
57 if (!test_bit(CACHE_PENDING, &item->flags)) {
58 /* must have just been validated... */
59 cache_revisit_request(item);