diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-06-14 16:40:32 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-10 23:40:29 -0400 |
commit | 4c402b40970382ded616eadd544fd63feb76cc79 (patch) | |
tree | ddff43479ae51f0ba5af566b09e0188563aab17b | |
parent | 8ad7c892e18ff8e6df422eb48ca0f73268ffd632 (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>
-rw-r--r-- | include/linux/sunrpc/clnt.h | 4 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 19 | ||||
-rw-r--r-- | net/sunrpc/rpcb_clnt.c | 2 | ||||
-rw-r--r-- | net/sunrpc/sunrpc_syms.c | 1 |
4 files changed, 4 insertions, 22 deletions
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index fe7ea65ed0ae..cf03494c36e7 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -25,7 +25,6 @@ struct rpc_inode; | |||
25 | */ | 25 | */ |
26 | struct rpc_clnt { | 26 | struct rpc_clnt { |
27 | struct kref cl_kref; /* Number of references */ | 27 | struct kref cl_kref; /* Number of references */ |
28 | atomic_t cl_count; /* Number of clones */ | ||
29 | struct list_head cl_clients; /* Global list of clients */ | 28 | struct list_head cl_clients; /* Global list of clients */ |
30 | struct list_head cl_tasks; /* List of tasks */ | 29 | struct list_head cl_tasks; /* List of tasks */ |
31 | spinlock_t cl_lock; /* spinlock */ | 30 | spinlock_t cl_lock; /* spinlock */ |
@@ -119,8 +118,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args); | |||
119 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, | 118 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, |
120 | struct rpc_program *, int); | 119 | struct rpc_program *, int); |
121 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); | 120 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); |
122 | int rpc_shutdown_client(struct rpc_clnt *); | 121 | void rpc_shutdown_client(struct rpc_clnt *); |
123 | int rpc_destroy_client(struct rpc_clnt *); | ||
124 | void rpc_release_client(struct rpc_clnt *); | 122 | void rpc_release_client(struct rpc_clnt *); |
125 | void rpc_register_client(struct rpc_clnt *); | 123 | void rpc_register_client(struct rpc_clnt *); |
126 | void rpc_unregister_client(struct rpc_clnt *); | 124 | void rpc_unregister_client(struct rpc_clnt *); |
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 | */ |
306 | int | 304 | void rpc_shutdown_client(struct rpc_clnt *clnt) |
307 | rpc_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 | */ | ||
369 | int | ||
370 | rpc_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 |
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index 00853a326499..cf7db59cdcde 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
@@ -380,7 +380,7 @@ void rpcb_getport(struct rpc_task *task) | |||
380 | } | 380 | } |
381 | 381 | ||
382 | child = rpc_run_task(rpcb_clnt, RPC_TASK_ASYNC, &rpcb_getport_ops, map); | 382 | child = rpc_run_task(rpcb_clnt, RPC_TASK_ASYNC, &rpcb_getport_ops, map); |
383 | rpc_destroy_client(rpcb_clnt); | 383 | rpc_release_client(rpcb_clnt); |
384 | if (IS_ERR(child)) { | 384 | if (IS_ERR(child)) { |
385 | status = -EIO; | 385 | status = -EIO; |
386 | dprintk("RPC: %5u rpcb_getport rpc_run_task failed\n", | 386 | dprintk("RPC: %5u rpcb_getport rpc_run_task failed\n", |
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c index c46d31ca307b..02e83e15fef5 100644 --- a/net/sunrpc/sunrpc_syms.c +++ b/net/sunrpc/sunrpc_syms.c | |||
@@ -35,7 +35,6 @@ EXPORT_SYMBOL(rpc_wake_up_status); | |||
35 | /* RPC client functions */ | 35 | /* RPC client functions */ |
36 | EXPORT_SYMBOL(rpc_clone_client); | 36 | EXPORT_SYMBOL(rpc_clone_client); |
37 | EXPORT_SYMBOL(rpc_bind_new_program); | 37 | EXPORT_SYMBOL(rpc_bind_new_program); |
38 | EXPORT_SYMBOL(rpc_destroy_client); | ||
39 | EXPORT_SYMBOL(rpc_shutdown_client); | 38 | EXPORT_SYMBOL(rpc_shutdown_client); |
40 | EXPORT_SYMBOL(rpc_killall_tasks); | 39 | EXPORT_SYMBOL(rpc_killall_tasks); |
41 | EXPORT_SYMBOL(rpc_call_sync); | 40 | EXPORT_SYMBOL(rpc_call_sync); |