diff options
author | NeilBrown <neilb@suse.de> | 2006-03-27 04:15:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-27 11:44:41 -0500 |
commit | 7d317f2c9f1e9dcf4f632fa98f91d1d4a36c4cae (patch) | |
tree | 7794c88facd3943a7496f7d41c2b7eb24a5d0be0 /include/linux | |
parent | eab7e2e647c348b418e8715ecaca0177e1b473c7 (diff) |
[PATCH] knfsd: Get rid of 'inplace' sunrpc caches
These were an unnecessary wart. Also only have one 'DefineSimpleCache..'
instead of two.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/sunrpc/cache.h | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h index c4e3ea7cf154..405ac14e509a 100644 --- a/include/linux/sunrpc/cache.h +++ b/include/linux/sunrpc/cache.h | |||
@@ -133,14 +133,11 @@ struct cache_deferred_req { | |||
133 | * If "set" == 0 : | 133 | * If "set" == 0 : |
134 | * If an entry is found, it is returned | 134 | * If an entry is found, it is returned |
135 | * If no entry is found, a new non-VALID entry is created. | 135 | * If no entry is found, a new non-VALID entry is created. |
136 | * If "set" == 1 and INPLACE == 0 : | 136 | * If "set" == 1 : |
137 | * If no entry is found a new one is inserted with data from "template" | 137 | * If no entry is found a new one is inserted with data from "template" |
138 | * If a non-CACHE_VALID entry is found, it is updated from template using UPDATE | 138 | * If a non-CACHE_VALID entry is found, it is updated from template using UPDATE |
139 | * If a CACHE_VALID entry is found, a new entry is swapped in with data | 139 | * If a CACHE_VALID entry is found, a new entry is swapped in with data |
140 | * from "template" | 140 | * from "template" |
141 | * If set == 1, and INPLACE == 1 : | ||
142 | * As above, except that if a CACHE_VALID entry is found, we UPDATE in place | ||
143 | * instead of swapping in a new entry. | ||
144 | * | 141 | * |
145 | * If the passed handle has the CACHE_NEGATIVE flag set, then UPDATE is not | 142 | * If the passed handle has the CACHE_NEGATIVE flag set, then UPDATE is not |
146 | * run but insteead CACHE_NEGATIVE is set in any new item. | 143 | * run but insteead CACHE_NEGATIVE is set in any new item. |
@@ -159,13 +156,8 @@ struct cache_deferred_req { | |||
159 | * TEST tests if "tmp" matches "item" | 156 | * TEST tests if "tmp" matches "item" |
160 | * INIT copies key information from "item" to "new" | 157 | * INIT copies key information from "item" to "new" |
161 | * UPDATE copies content information from "item" to "tmp" | 158 | * UPDATE copies content information from "item" to "tmp" |
162 | * INPLACE is true if updates can happen inplace rather than allocating a new structure | ||
163 | * | ||
164 | * WARNING: any substantial changes to this must be reflected in | ||
165 | * net/sunrpc/svcauth.c(auth_domain_lookup) | ||
166 | * which is a similar routine that is open-coded. | ||
167 | */ | 159 | */ |
168 | #define DefineCacheLookup(RTN,MEMBER,FNAME,ARGS,SETUP,DETAIL,HASHFN,TEST,INIT,UPDATE,INPLACE) \ | 160 | #define DefineCacheLookup(RTN,MEMBER,FNAME,ARGS,SETUP,DETAIL,HASHFN,TEST,INIT,UPDATE) \ |
169 | RTN *FNAME ARGS \ | 161 | RTN *FNAME ARGS \ |
170 | { \ | 162 | { \ |
171 | RTN *tmp, *new=NULL; \ | 163 | RTN *tmp, *new=NULL; \ |
@@ -179,13 +171,13 @@ RTN *FNAME ARGS \ | |||
179 | tmp = container_of(*hp, RTN, MEMBER); \ | 171 | tmp = container_of(*hp, RTN, MEMBER); \ |
180 | if (TEST) { /* found a match */ \ | 172 | if (TEST) { /* found a match */ \ |
181 | \ | 173 | \ |
182 | if (set && !INPLACE && test_bit(CACHE_VALID, &tmp->MEMBER.flags) && !new) \ | 174 | if (set && test_bit(CACHE_VALID, &tmp->MEMBER.flags) && !new) \ |
183 | break; \ | 175 | break; \ |
184 | \ | 176 | \ |
185 | if (new) \ | 177 | if (new) \ |
186 | {INIT;} \ | 178 | {INIT;} \ |
187 | if (set) { \ | 179 | if (set) { \ |
188 | if (!INPLACE && test_bit(CACHE_VALID, &tmp->MEMBER.flags))\ | 180 | if (test_bit(CACHE_VALID, &tmp->MEMBER.flags))\ |
189 | { /* need to swap in new */ \ | 181 | { /* need to swap in new */ \ |
190 | RTN *t2; \ | 182 | RTN *t2; \ |
191 | \ | 183 | \ |
@@ -206,7 +198,7 @@ RTN *FNAME ARGS \ | |||
206 | else read_unlock(&(DETAIL)->hash_lock); \ | 198 | else read_unlock(&(DETAIL)->hash_lock); \ |
207 | if (set) \ | 199 | if (set) \ |
208 | cache_fresh(DETAIL, &tmp->MEMBER, item->MEMBER.expiry_time); \ | 200 | cache_fresh(DETAIL, &tmp->MEMBER, item->MEMBER.expiry_time); \ |
209 | if (set && !INPLACE && new) cache_fresh(DETAIL, &new->MEMBER, 0); \ | 201 | if (set && new) cache_fresh(DETAIL, &new->MEMBER, 0); \ |
210 | if (new) (DETAIL)->cache_put(&new->MEMBER, DETAIL); \ | 202 | if (new) (DETAIL)->cache_put(&new->MEMBER, DETAIL); \ |
211 | return tmp; \ | 203 | return tmp; \ |
212 | } \ | 204 | } \ |
@@ -239,10 +231,12 @@ RTN *FNAME ARGS \ | |||
239 | return NULL; \ | 231 | return NULL; \ |
240 | } | 232 | } |
241 | 233 | ||
242 | #define DefineSimpleCacheLookup(STRUCT,INPLACE) \ | 234 | #define DefineSimpleCacheLookup(STRUCT, FUNC) \ |
243 | DefineCacheLookup(struct STRUCT, h, STRUCT##_lookup, (struct STRUCT *item, int set), /*no setup */, \ | 235 | DefineCacheLookup(struct STRUCT, h, FUNC##_lookup, \ |
244 | & STRUCT##_cache, STRUCT##_hash(item), STRUCT##_match(item, tmp),\ | 236 | (struct STRUCT *item, int set), /*no setup */, \ |
245 | STRUCT##_init(new, item), STRUCT##_update(tmp, item),INPLACE) | 237 | & FUNC##_cache, FUNC##_hash(item), FUNC##_match(item, tmp), \ |
238 | STRUCT##_init(new, item), STRUCT##_update(tmp, item)) | ||
239 | |||
246 | 240 | ||
247 | #define cache_for_each(pos, detail, index, member) \ | 241 | #define cache_for_each(pos, detail, index, member) \ |
248 | for (({read_lock(&(detail)->hash_lock); index = (detail)->hash_size;}) ; \ | 242 | for (({read_lock(&(detail)->hash_lock); index = (detail)->hash_size;}) ; \ |