aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorStanislav Kinsbursky <skinsbursky@parallels.com>2012-03-28 11:09:50 -0400
committerJ. Bruce Fields <bfields@redhat.com>2012-04-11 17:55:05 -0400
commitc89172e36e3d3972f9f3fa107c1f3e666f1e05cf (patch)
tree29ad59f5e834176a1ca7ac0494a3119c9e6f6356 /fs
parent83e0ed700d4d2cad2f555ae536fafd531f55b6d0 (diff)
nfsd: pass pointer to expkey cache down to stack wherever possible.
This cache will be per-net soon. And it's easier to get the pointer to desired per-net instance only once and then pass it down instead of discovering it in every place were required. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/export.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 9fe7156f504d..84723bc37c59 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -71,9 +71,9 @@ static int expkey_upcall(struct cache_detail *cd, struct cache_head *h)
71 return sunrpc_cache_pipe_upcall(cd, h, expkey_request); 71 return sunrpc_cache_pipe_upcall(cd, h, expkey_request);
72} 72}
73 73
74static struct svc_expkey *svc_expkey_update(struct svc_expkey *new, struct svc_expkey *old); 74static struct svc_expkey *svc_expkey_update(struct cache_detail *cd, struct svc_expkey *new,
75static struct svc_expkey *svc_expkey_lookup(struct svc_expkey *); 75 struct svc_expkey *old);
76static struct cache_detail svc_expkey_cache; 76static struct svc_expkey *svc_expkey_lookup(struct cache_detail *cd, struct svc_expkey *);
77 77
78static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen) 78static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
79{ 79{
@@ -131,7 +131,7 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
131 key.ek_fsidtype = fsidtype; 131 key.ek_fsidtype = fsidtype;
132 memcpy(key.ek_fsid, buf, len); 132 memcpy(key.ek_fsid, buf, len);
133 133
134 ek = svc_expkey_lookup(&key); 134 ek = svc_expkey_lookup(cd, &key);
135 err = -ENOMEM; 135 err = -ENOMEM;
136 if (!ek) 136 if (!ek)
137 goto out; 137 goto out;
@@ -145,7 +145,7 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
145 err = 0; 145 err = 0;
146 if (len == 0) { 146 if (len == 0) {
147 set_bit(CACHE_NEGATIVE, &key.h.flags); 147 set_bit(CACHE_NEGATIVE, &key.h.flags);
148 ek = svc_expkey_update(&key, ek); 148 ek = svc_expkey_update(cd, &key, ek);
149 if (!ek) 149 if (!ek)
150 err = -ENOMEM; 150 err = -ENOMEM;
151 } else { 151 } else {
@@ -155,7 +155,7 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
155 155
156 dprintk("Found the path %s\n", buf); 156 dprintk("Found the path %s\n", buf);
157 157
158 ek = svc_expkey_update(&key, ek); 158 ek = svc_expkey_update(cd, &key, ek);
159 if (!ek) 159 if (!ek)
160 err = -ENOMEM; 160 err = -ENOMEM;
161 path_put(&key.ek_path); 161 path_put(&key.ek_path);
@@ -268,13 +268,12 @@ svc_expkey_hash(struct svc_expkey *item)
268} 268}
269 269
270static struct svc_expkey * 270static struct svc_expkey *
271svc_expkey_lookup(struct svc_expkey *item) 271svc_expkey_lookup(struct cache_detail *cd, struct svc_expkey *item)
272{ 272{
273 struct cache_head *ch; 273 struct cache_head *ch;
274 int hash = svc_expkey_hash(item); 274 int hash = svc_expkey_hash(item);
275 275
276 ch = sunrpc_cache_lookup(&svc_expkey_cache, &item->h, 276 ch = sunrpc_cache_lookup(cd, &item->h, hash);
277 hash);
278 if (ch) 277 if (ch)
279 return container_of(ch, struct svc_expkey, h); 278 return container_of(ch, struct svc_expkey, h);
280 else 279 else
@@ -282,13 +281,13 @@ svc_expkey_lookup(struct svc_expkey *item)
282} 281}
283 282
284static struct svc_expkey * 283static struct svc_expkey *
285svc_expkey_update(struct svc_expkey *new, struct svc_expkey *old) 284svc_expkey_update(struct cache_detail *cd, struct svc_expkey *new,
285 struct svc_expkey *old)
286{ 286{
287 struct cache_head *ch; 287 struct cache_head *ch;
288 int hash = svc_expkey_hash(new); 288 int hash = svc_expkey_hash(new);
289 289
290 ch = sunrpc_cache_update(&svc_expkey_cache, &new->h, 290 ch = sunrpc_cache_update(cd, &new->h, &old->h, hash);
291 &old->h, hash);
292 if (ch) 291 if (ch)
293 return container_of(ch, struct svc_expkey, h); 292 return container_of(ch, struct svc_expkey, h);
294 else 293 else
@@ -763,7 +762,8 @@ svc_export_update(struct svc_export *new, struct svc_export *old)
763 762
764 763
765static struct svc_expkey * 764static struct svc_expkey *
766exp_find_key(svc_client *clp, int fsid_type, u32 *fsidv, struct cache_req *reqp) 765exp_find_key(struct cache_detail *cd, svc_client *clp, int fsid_type,
766 u32 *fsidv, struct cache_req *reqp)
767{ 767{
768 struct svc_expkey key, *ek; 768 struct svc_expkey key, *ek;
769 int err; 769 int err;
@@ -775,10 +775,10 @@ exp_find_key(svc_client *clp, int fsid_type, u32 *fsidv, struct cache_req *reqp)
775 key.ek_fsidtype = fsid_type; 775 key.ek_fsidtype = fsid_type;
776 memcpy(key.ek_fsid, fsidv, key_len(fsid_type)); 776 memcpy(key.ek_fsid, fsidv, key_len(fsid_type));
777 777
778 ek = svc_expkey_lookup(&key); 778 ek = svc_expkey_lookup(cd, &key);
779 if (ek == NULL) 779 if (ek == NULL)
780 return ERR_PTR(-ENOMEM); 780 return ERR_PTR(-ENOMEM);
781 err = cache_check(&svc_expkey_cache, &ek->h, reqp); 781 err = cache_check(cd, &ek->h, reqp);
782 if (err) 782 if (err)
783 return ERR_PTR(err); 783 return ERR_PTR(err);
784 return ek; 784 return ek;
@@ -879,7 +879,7 @@ static struct svc_export *exp_find(struct auth_domain *clp, int fsid_type,
879 u32 *fsidv, struct cache_req *reqp) 879 u32 *fsidv, struct cache_req *reqp)
880{ 880{
881 struct svc_export *exp; 881 struct svc_export *exp;
882 struct svc_expkey *ek = exp_find_key(clp, fsid_type, fsidv, reqp); 882 struct svc_expkey *ek = exp_find_key(&svc_expkey_cache, clp, fsid_type, fsidv, reqp);
883 if (IS_ERR(ek)) 883 if (IS_ERR(ek))
884 return ERR_CAST(ek); 884 return ERR_CAST(ek);
885 885