]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.fixes/nfsd-01-sunrpc-cache-simplify-cache_fresh_locked-and-cache_f.patch
8d93b3cb0cac2c58009b75b414cfe3150895fabf
[ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.fixes / nfsd-01-sunrpc-cache-simplify-cache_fresh_locked-and-cache_f.patch
1 Patch-mainline: submitted 4aug09
2 References: bnc#498708
3 From: NeilBrown <neilb@suse.de>
4 Date: Tue, 4 Aug 2009 15:06:37 +1000
5 Subject: [PATCH 03/12] sunrpc/cache: simplify cache_fresh_locked and cache_fresh_unlocked.
6
7 The extra call to cache_revisit_request in cache_fresh_unlocked is not
8 needed, as should have been fairly clear at the time of
9 commit 4013edea9a0b6cdcb1fdf5d4011e47e068fd6efb
10
11 If there are requests to be revisited, then we can be sure that
12 CACHE_PENDING is set, so the second call is sufficient.
13
14 So remove the first call.
15 Then remove the 'new' parameter,
16 then remove the return value for cache_fresh_locked which is only used
17 to provide the value for 'new'.
18
19 Signed-off-by: NeilBrown <neilb@suse.de>
20
21 ---
22 net/sunrpc/cache.c | 23 ++++++++++-------------
23 1 file changed, 10 insertions(+), 13 deletions(-)
24
25 --- linux-2.6.27-SLE11_BRANCH.orig/net/sunrpc/cache.c
26 +++ linux-2.6.27-SLE11_BRANCH/net/sunrpc/cache.c
27 @@ -103,18 +103,16 @@ EXPORT_SYMBOL(sunrpc_cache_lookup);
28
29 static void queue_loose(struct cache_detail *detail, struct cache_head *ch);
30
31 -static int cache_fresh_locked(struct cache_head *head, time_t expiry)
32 +static void cache_fresh_locked(struct cache_head *head, time_t expiry)
33 {
34 head->expiry_time = expiry;
35 head->last_refresh = get_seconds();
36 - return !test_and_set_bit(CACHE_VALID, &head->flags);
37 + set_bit(CACHE_VALID, &head->flags);
38 }
39
40 static void cache_fresh_unlocked(struct cache_head *head,
41 - struct cache_detail *detail, int new)
42 + struct cache_detail *detail)
43 {
44 - if (new)
45 - cache_revisit_request(head);
46 if (test_and_clear_bit(CACHE_PENDING, &head->flags)) {
47 cache_revisit_request(head);
48 queue_loose(detail, head);
49 @@ -130,7 +128,6 @@ struct cache_head *sunrpc_cache_update(s
50 */
51 struct cache_head **head;
52 struct cache_head *tmp;
53 - int is_new;
54
55 if (!test_bit(CACHE_VALID, &old->flags)) {
56 write_lock(&detail->hash_lock);
57 @@ -139,9 +136,9 @@ struct cache_head *sunrpc_cache_update(s
58 set_bit(CACHE_NEGATIVE, &old->flags);
59 else
60 detail->update(old, new);
61 - is_new = cache_fresh_locked(old, new->expiry_time);
62 + cache_fresh_locked(old, new->expiry_time);
63 write_unlock(&detail->hash_lock);
64 - cache_fresh_unlocked(old, detail, is_new);
65 + cache_fresh_unlocked(old, detail);
66 return old;
67 }
68 write_unlock(&detail->hash_lock);
69 @@ -165,11 +162,11 @@ struct cache_head *sunrpc_cache_update(s
70 *head = tmp;
71 detail->entries++;
72 cache_get(tmp);
73 - is_new = cache_fresh_locked(tmp, new->expiry_time);
74 + cache_fresh_locked(tmp, new->expiry_time);
75 cache_fresh_locked(old, 0);
76 write_unlock(&detail->hash_lock);
77 - cache_fresh_unlocked(tmp, detail, is_new);
78 - cache_fresh_unlocked(old, detail, 0);
79 + cache_fresh_unlocked(tmp, detail);
80 + cache_fresh_unlocked(old, detail);
81 cache_put(old, detail);
82 return tmp;
83 }
84 @@ -223,8 +220,8 @@ int cache_check(struct cache_detail *det
85 clear_bit(CACHE_PENDING, &h->flags);
86 if (rv == -EAGAIN) {
87 set_bit(CACHE_NEGATIVE, &h->flags);
88 - cache_fresh_unlocked(h, detail,
89 - cache_fresh_locked(h, get_seconds()+CACHE_NEW_EXPIRY));
90 + cache_fresh_locked(h, get_seconds()+CACHE_NEW_EXPIRY);
91 + cache_fresh_unlocked(h, detail);
92 rv = -ENOENT;
93 }
94 break;