aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/svcauth_unix.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 /net/sunrpc/svcauth_unix.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 'net/sunrpc/svcauth_unix.c')
-rw-r--r--net/sunrpc/svcauth_unix.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index 7e38621a20b7..11020c0b7db5 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -84,15 +84,15 @@ struct ip_map {
84}; 84};
85static struct cache_head *ip_table[IP_HASHMAX]; 85static struct cache_head *ip_table[IP_HASHMAX];
86 86
87static void ip_map_put(struct cache_head *item, struct cache_detail *cd) 87static void ip_map_put(struct kref *kref)
88{ 88{
89 struct cache_head *item = container_of(kref, struct cache_head, ref);
89 struct ip_map *im = container_of(item, struct ip_map,h); 90 struct ip_map *im = container_of(item, struct ip_map,h);
90 if (cache_put(item, cd)) { 91
91 if (test_bit(CACHE_VALID, &item->flags) && 92 if (test_bit(CACHE_VALID, &item->flags) &&
92 !test_bit(CACHE_NEGATIVE, &item->flags)) 93 !test_bit(CACHE_NEGATIVE, &item->flags))
93 auth_domain_put(&im->m_client->h); 94 auth_domain_put(&im->m_client->h);
94 kfree(im); 95 kfree(im);
95 }
96} 96}
97 97
98#if IP_HASHBITS == 8 98#if IP_HASHBITS == 8
@@ -315,7 +315,7 @@ static int ip_map_update(struct ip_map *ipm, struct unix_domain *udom, time_t ex
315 hash_ip((unsigned long)ipm->m_addr.s_addr)); 315 hash_ip((unsigned long)ipm->m_addr.s_addr));
316 if (!ch) 316 if (!ch)
317 return -ENOMEM; 317 return -ENOMEM;
318 ip_map_put(ch, &ip_map_cache); 318 cache_put(ch, &ip_map_cache);
319 return 0; 319 return 0;
320} 320}
321 321
@@ -369,7 +369,7 @@ struct auth_domain *auth_unix_lookup(struct in_addr addr)
369 rv = &ipm->m_client->h; 369 rv = &ipm->m_client->h;
370 kref_get(&rv->ref); 370 kref_get(&rv->ref);
371 } 371 }
372 ip_map_put(&ipm->h, &ip_map_cache); 372 cache_put(&ipm->h, &ip_map_cache);
373 return rv; 373 return rv;
374} 374}
375 375
@@ -403,7 +403,7 @@ svcauth_unix_set_client(struct svc_rqst *rqstp)
403 case 0: 403 case 0:
404 rqstp->rq_client = &ipm->m_client->h; 404 rqstp->rq_client = &ipm->m_client->h;
405 kref_get(&rqstp->rq_client->ref); 405 kref_get(&rqstp->rq_client->ref);
406 ip_map_put(&ipm->h, &ip_map_cache); 406 cache_put(&ipm->h, &ip_map_cache);
407 break; 407 break;
408 } 408 }
409 return SVC_OK; 409 return SVC_OK;