diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-06-16 14:18:40 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-10 23:40:30 -0400 |
commit | 188fef11db219f13f32d055ba59985e7d1a349fe (patch) | |
tree | b64754962315934c1fa33fca16eabffeb901425a /net/sunrpc | |
parent | f61534dfd38f895b203e2aadaba04f21a992ca8c (diff) |
SUNRPC: Move rpc_register_client and friends into net/sunrpc/clnt.c
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/clnt.c | 57 | ||||
-rw-r--r-- | net/sunrpc/sched.c | 62 |
2 files changed, 57 insertions, 62 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index fe838e996ee3..4f39ab1b04d6 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -44,6 +44,12 @@ | |||
44 | dprintk("RPC: %5u %s (status %d)\n", t->tk_pid, \ | 44 | dprintk("RPC: %5u %s (status %d)\n", t->tk_pid, \ |
45 | __FUNCTION__, t->tk_status) | 45 | __FUNCTION__, t->tk_status) |
46 | 46 | ||
47 | /* | ||
48 | * All RPC clients are linked into this list | ||
49 | */ | ||
50 | static LIST_HEAD(all_clients); | ||
51 | static DEFINE_SPINLOCK(rpc_client_lock); | ||
52 | |||
47 | static DECLARE_WAIT_QUEUE_HEAD(destroy_wait); | 53 | static DECLARE_WAIT_QUEUE_HEAD(destroy_wait); |
48 | 54 | ||
49 | 55 | ||
@@ -66,6 +72,19 @@ static void call_connect_status(struct rpc_task *task); | |||
66 | static __be32 * call_header(struct rpc_task *task); | 72 | static __be32 * call_header(struct rpc_task *task); |
67 | static __be32 * call_verify(struct rpc_task *task); | 73 | static __be32 * call_verify(struct rpc_task *task); |
68 | 74 | ||
75 | static void rpc_register_client(struct rpc_clnt *clnt) | ||
76 | { | ||
77 | spin_lock(&rpc_client_lock); | ||
78 | list_add(&clnt->cl_clients, &all_clients); | ||
79 | spin_unlock(&rpc_client_lock); | ||
80 | } | ||
81 | |||
82 | static void rpc_unregister_client(struct rpc_clnt *clnt) | ||
83 | { | ||
84 | spin_lock(&rpc_client_lock); | ||
85 | list_del(&clnt->cl_clients); | ||
86 | spin_unlock(&rpc_client_lock); | ||
87 | } | ||
69 | 88 | ||
70 | static int | 89 | static int |
71 | rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name) | 90 | rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name) |
@@ -1410,3 +1429,41 @@ int rpc_ping(struct rpc_clnt *clnt, int flags) | |||
1410 | put_rpccred(msg.rpc_cred); | 1429 | put_rpccred(msg.rpc_cred); |
1411 | return err; | 1430 | return err; |
1412 | } | 1431 | } |
1432 | |||
1433 | #ifdef RPC_DEBUG | ||
1434 | void rpc_show_tasks(void) | ||
1435 | { | ||
1436 | struct rpc_clnt *clnt; | ||
1437 | struct rpc_task *t; | ||
1438 | |||
1439 | spin_lock(&rpc_client_lock); | ||
1440 | if (list_empty(&all_clients)) | ||
1441 | goto out; | ||
1442 | printk("-pid- proc flgs status -client- -prog- --rqstp- -timeout " | ||
1443 | "-rpcwait -action- ---ops--\n"); | ||
1444 | list_for_each_entry(clnt, &all_clients, cl_clients) { | ||
1445 | if (list_empty(&clnt->cl_tasks)) | ||
1446 | continue; | ||
1447 | spin_lock(&clnt->cl_lock); | ||
1448 | list_for_each_entry(t, &clnt->cl_tasks, tk_task) { | ||
1449 | const char *rpc_waitq = "none"; | ||
1450 | |||
1451 | if (RPC_IS_QUEUED(t)) | ||
1452 | rpc_waitq = rpc_qname(t->u.tk_wait.rpc_waitq); | ||
1453 | |||
1454 | printk("%5u %04d %04x %6d %8p %6d %8p %8ld %8s %8p %8p\n", | ||
1455 | t->tk_pid, | ||
1456 | (t->tk_msg.rpc_proc ? t->tk_msg.rpc_proc->p_proc : -1), | ||
1457 | t->tk_flags, t->tk_status, | ||
1458 | t->tk_client, | ||
1459 | (t->tk_client ? t->tk_client->cl_prog : 0), | ||
1460 | t->tk_rqstp, t->tk_timeout, | ||
1461 | rpc_waitq, | ||
1462 | t->tk_action, t->tk_ops); | ||
1463 | } | ||
1464 | spin_unlock(&clnt->cl_lock); | ||
1465 | } | ||
1466 | out: | ||
1467 | spin_unlock(&rpc_client_lock); | ||
1468 | } | ||
1469 | #endif | ||
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 05825154ddd9..c0f8d25caf57 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
@@ -48,11 +48,6 @@ static void rpc_release_task(struct rpc_task *task); | |||
48 | static RPC_WAITQ(delay_queue, "delayq"); | 48 | static RPC_WAITQ(delay_queue, "delayq"); |
49 | 49 | ||
50 | /* | 50 | /* |
51 | * All RPC clients are linked into this list | ||
52 | */ | ||
53 | static LIST_HEAD(all_clients); | ||
54 | |||
55 | /* | ||
56 | * rpciod-related stuff | 51 | * rpciod-related stuff |
57 | */ | 52 | */ |
58 | static DEFINE_MUTEX(rpciod_mutex); | 53 | static DEFINE_MUTEX(rpciod_mutex); |
@@ -60,11 +55,6 @@ static atomic_t rpciod_users = ATOMIC_INIT(0); | |||
60 | struct workqueue_struct *rpciod_workqueue; | 55 | struct workqueue_struct *rpciod_workqueue; |
61 | 56 | ||
62 | /* | 57 | /* |
63 | * Spinlock for other critical sections of code. | ||
64 | */ | ||
65 | static DEFINE_SPINLOCK(rpc_sched_lock); | ||
66 | |||
67 | /* | ||
68 | * Disable the timer for a given RPC task. Should be called with | 58 | * Disable the timer for a given RPC task. Should be called with |
69 | * queue->lock and bh_disabled in order to avoid races within | 59 | * queue->lock and bh_disabled in order to avoid races within |
70 | * rpc_run_timer(). | 60 | * rpc_run_timer(). |
@@ -994,20 +984,6 @@ void rpc_killall_tasks(struct rpc_clnt *clnt) | |||
994 | spin_unlock(&clnt->cl_lock); | 984 | spin_unlock(&clnt->cl_lock); |
995 | } | 985 | } |
996 | 986 | ||
997 | void rpc_register_client(struct rpc_clnt *clnt) | ||
998 | { | ||
999 | spin_lock(&rpc_sched_lock); | ||
1000 | list_add(&clnt->cl_clients, &all_clients); | ||
1001 | spin_unlock(&rpc_sched_lock); | ||
1002 | } | ||
1003 | |||
1004 | void rpc_unregister_client(struct rpc_clnt *clnt) | ||
1005 | { | ||
1006 | spin_lock(&rpc_sched_lock); | ||
1007 | list_del(&clnt->cl_clients); | ||
1008 | spin_unlock(&rpc_sched_lock); | ||
1009 | } | ||
1010 | |||
1011 | /* | 987 | /* |
1012 | * Start up the rpciod process if it's not already running. | 988 | * Start up the rpciod process if it's not already running. |
1013 | */ | 989 | */ |
@@ -1059,44 +1035,6 @@ rpciod_down(void) | |||
1059 | mutex_unlock(&rpciod_mutex); | 1035 | mutex_unlock(&rpciod_mutex); |
1060 | } | 1036 | } |
1061 | 1037 | ||
1062 | #ifdef RPC_DEBUG | ||
1063 | void rpc_show_tasks(void) | ||
1064 | { | ||
1065 | struct rpc_clnt *clnt; | ||
1066 | struct rpc_task *t; | ||
1067 | |||
1068 | spin_lock(&rpc_sched_lock); | ||
1069 | if (list_empty(&all_clients)) | ||
1070 | goto out; | ||
1071 | printk("-pid- proc flgs status -client- -prog- --rqstp- -timeout " | ||
1072 | "-rpcwait -action- ---ops--\n"); | ||
1073 | list_for_each_entry(clnt, &all_clients, cl_clients) { | ||
1074 | if (list_empty(&clnt->cl_tasks)) | ||
1075 | continue; | ||
1076 | spin_lock(&clnt->cl_lock); | ||
1077 | list_for_each_entry(t, &clnt->cl_tasks, tk_task) { | ||
1078 | const char *rpc_waitq = "none"; | ||
1079 | |||
1080 | if (RPC_IS_QUEUED(t)) | ||
1081 | rpc_waitq = rpc_qname(t->u.tk_wait.rpc_waitq); | ||
1082 | |||
1083 | printk("%5u %04d %04x %6d %8p %6d %8p %8ld %8s %8p %8p\n", | ||
1084 | t->tk_pid, | ||
1085 | (t->tk_msg.rpc_proc ? t->tk_msg.rpc_proc->p_proc : -1), | ||
1086 | t->tk_flags, t->tk_status, | ||
1087 | t->tk_client, | ||
1088 | (t->tk_client ? t->tk_client->cl_prog : 0), | ||
1089 | t->tk_rqstp, t->tk_timeout, | ||
1090 | rpc_waitq, | ||
1091 | t->tk_action, t->tk_ops); | ||
1092 | } | ||
1093 | spin_unlock(&clnt->cl_lock); | ||
1094 | } | ||
1095 | out: | ||
1096 | spin_unlock(&rpc_sched_lock); | ||
1097 | } | ||
1098 | #endif | ||
1099 | |||
1100 | void | 1038 | void |
1101 | rpc_destroy_mempool(void) | 1039 | rpc_destroy_mempool(void) |
1102 | { | 1040 | { |