aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4idmap.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-03-27 04:15:09 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-27 11:44:43 -0500
commitbaab935ff3bdac20c558809da0d8e8f761840219 (patch)
treea22c3189505fe8e7ab3820c988ffd771c0b64fa6 /fs/nfsd/nfs4idmap.c
parentebd0cb1af3be2729cc1f574681dfba01fcf458d9 (diff)
[PATCH] knfsd: Convert sunrpc_cache to use krefs
.. it makes some of the code nicer. 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 'fs/nfsd/nfs4idmap.c')
-rw-r--r--fs/nfsd/nfs4idmap.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
index 75cfbb68b205..4b6aa60dfceb 100644
--- a/fs/nfsd/nfs4idmap.c
+++ b/fs/nfsd/nfs4idmap.c
@@ -96,12 +96,10 @@ ent_init(struct cache_head *cnew, struct cache_head *citm)
96} 96}
97 97
98static void 98static void
99ent_put(struct cache_head *ch, struct cache_detail *cd) 99ent_put(struct kref *ref)
100{ 100{
101 if (cache_put(ch, cd)) { 101 struct ent *map = container_of(ref, struct ent, h.ref);
102 struct ent *map = container_of(ch, struct ent, h); 102 kfree(map);
103 kfree(map);
104 }
105} 103}
106 104
107static struct cache_head * 105static struct cache_head *
@@ -270,7 +268,7 @@ idtoname_parse(struct cache_detail *cd, char *buf, int buflen)
270 if (res == NULL) 268 if (res == NULL)
271 goto out; 269 goto out;
272 270
273 ent_put(&res->h, &idtoname_cache); 271 cache_put(&res->h, &idtoname_cache);
274 272
275 error = 0; 273 error = 0;
276out: 274out:
@@ -433,7 +431,7 @@ nametoid_parse(struct cache_detail *cd, char *buf, int buflen)
433 if (res == NULL) 431 if (res == NULL)
434 goto out; 432 goto out;
435 433
436 ent_put(&res->h, &nametoid_cache); 434 cache_put(&res->h, &nametoid_cache);
437 error = 0; 435 error = 0;
438out: 436out:
439 kfree(buf1); 437 kfree(buf1);
@@ -562,7 +560,7 @@ do_idmap_lookup_nowait(struct ent *(*lookup_fn)(struct ent *),
562 goto out_put; 560 goto out_put;
563 return 0; 561 return 0;
564out_put: 562out_put:
565 ent_put(&(*item)->h, detail); 563 cache_put(&(*item)->h, detail);
566out_err: 564out_err:
567 *item = NULL; 565 *item = NULL;
568 return ret; 566 return ret;
@@ -613,7 +611,7 @@ idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen
613 if (ret) 611 if (ret)
614 return ret; 612 return ret;
615 *id = item->id; 613 *id = item->id;
616 ent_put(&item->h, &nametoid_cache); 614 cache_put(&item->h, &nametoid_cache);
617 return 0; 615 return 0;
618} 616}
619 617
@@ -635,7 +633,7 @@ idmap_id_to_name(struct svc_rqst *rqstp, int type, uid_t id, char *name)
635 ret = strlen(item->name); 633 ret = strlen(item->name);
636 BUG_ON(ret > IDMAP_NAMESZ); 634 BUG_ON(ret > IDMAP_NAMESZ);
637 memcpy(name, item->name, ret); 635 memcpy(name, item->name, ret);
638 ent_put(&item->h, &idtoname_cache); 636 cache_put(&item->h, &idtoname_cache);
639 return ret; 637 return ret;
640} 638}
641 639