aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/clnt.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-06-14 16:40:32 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-10 23:40:29 -0400
commit4c402b40970382ded616eadd544fd63feb76cc79 (patch)
treeddff43479ae51f0ba5af566b09e0188563aab17b /net/sunrpc/clnt.c
parent8ad7c892e18ff8e6df422eb48ca0f73268ffd632 (diff)
SUNRPC: Remove rpc_clnt->cl_count
The kref now does most of what cl_count + cl_user used to do. The only remaining role for cl_count is to tell us if we are in a 'shutdown' phase. We can provide that information using a single bit field instead of a full atomic counter. Also rename rpc_destroy_client() to rpc_close_client(), which reflects better what its role is these days. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r--net/sunrpc/clnt.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 613c10e4ac31..be5524d20822 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -121,7 +121,6 @@ static struct rpc_clnt * rpc_new_client(struct rpc_xprt *xprt, char *servname, s
121 clnt = kzalloc(sizeof(*clnt), GFP_KERNEL); 121 clnt = kzalloc(sizeof(*clnt), GFP_KERNEL);
122 if (!clnt) 122 if (!clnt)
123 goto out_err; 123 goto out_err;
124 atomic_set(&clnt->cl_count, 1);
125 clnt->cl_parent = clnt; 124 clnt->cl_parent = clnt;
126 125
127 clnt->cl_server = clnt->cl_inline_name; 126 clnt->cl_server = clnt->cl_inline_name;
@@ -270,7 +269,6 @@ rpc_clone_client(struct rpc_clnt *clnt)
270 new = kmemdup(clnt, sizeof(*new), GFP_KERNEL); 269 new = kmemdup(clnt, sizeof(*new), GFP_KERNEL);
271 if (!new) 270 if (!new)
272 goto out_no_clnt; 271 goto out_no_clnt;
273 atomic_set(&new->cl_count, 1);
274 new->cl_metrics = rpc_alloc_iostats(clnt); 272 new->cl_metrics = rpc_alloc_iostats(clnt);
275 if (new->cl_metrics == NULL) 273 if (new->cl_metrics == NULL)
276 goto out_no_stats; 274 goto out_no_stats;
@@ -303,8 +301,7 @@ out_no_clnt:
303 * Properly shut down an RPC client, terminating all outstanding 301 * Properly shut down an RPC client, terminating all outstanding
304 * requests. 302 * requests.
305 */ 303 */
306int 304void rpc_shutdown_client(struct rpc_clnt *clnt)
307rpc_shutdown_client(struct rpc_clnt *clnt)
308{ 305{
309 dprintk("RPC: shutting down %s client for %s\n", 306 dprintk("RPC: shutting down %s client for %s\n",
310 clnt->cl_protname, clnt->cl_server); 307 clnt->cl_protname, clnt->cl_server);
@@ -315,7 +312,7 @@ rpc_shutdown_client(struct rpc_clnt *clnt)
315 list_empty(&clnt->cl_tasks), 1*HZ); 312 list_empty(&clnt->cl_tasks), 1*HZ);
316 } 313 }
317 314
318 return rpc_destroy_client(clnt); 315 rpc_release_client(clnt);
319} 316}
320 317
321/* 318/*
@@ -363,18 +360,6 @@ rpc_release_client(struct rpc_clnt *clnt)
363 kref_put(&clnt->cl_kref, rpc_free_client); 360 kref_put(&clnt->cl_kref, rpc_free_client);
364} 361}
365 362
366/*
367 * Delete an RPC client
368 */
369int
370rpc_destroy_client(struct rpc_clnt *clnt)
371{
372 if (!atomic_dec_and_test(&clnt->cl_count))
373 return 1;
374 kref_put(&clnt->cl_kref, rpc_free_client);
375 return 0;
376}
377
378/** 363/**
379 * rpc_bind_new_program - bind a new RPC program to an existing client 364 * rpc_bind_new_program - bind a new RPC program to an existing client
380 * @old - old rpc_client 365 * @old - old rpc_client