aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/clnt.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2008-05-21 17:09:33 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-07-09 12:08:56 -0400
commit38e886e0c18975543938519254fc9bf0829c75a3 (patch)
tree310aa1aa78833bc0ef8836c0bfceb3a7823e6c31 /net/sunrpc/clnt.c
parent68a23ee94e3a06819f5a39d64f2e1f3131bab12d (diff)
SUNRPC: Refactor rpc_show_tasks
Clean up: move the logic that displays each task to its own function. This removes indentation and makes future changes easier. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r--net/sunrpc/clnt.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 7dda32851adb..7964a98c90e5 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1532,40 +1532,42 @@ static void rpc_show_header(void)
1532 "-timeout -rpcwait -action- ---ops--\n"); 1532 "-timeout -rpcwait -action- ---ops--\n");
1533} 1533}
1534 1534
1535static void rpc_show_task(const struct rpc_clnt *clnt,
1536 const struct rpc_task *task)
1537{
1538 const char *rpc_waitq = "none";
1539 int proc = -1;
1540
1541 if (task->tk_msg.rpc_proc)
1542 proc = task->tk_msg.rpc_proc->p_proc;
1543
1544 if (RPC_IS_QUEUED(task))
1545 rpc_waitq = rpc_qname(task->tk_waitqueue);
1546
1547 printk(KERN_INFO "%5u %04d %04x %6d %8p %6d %8p %8ld %8s %8p %8p\n",
1548 task->tk_pid, proc,
1549 task->tk_flags, task->tk_status,
1550 clnt, clnt->cl_prog,
1551 task->tk_rqstp, task->tk_timeout,
1552 rpc_waitq,
1553 task->tk_action, task->tk_ops);
1554}
1555
1535void rpc_show_tasks(void) 1556void rpc_show_tasks(void)
1536{ 1557{
1537 struct rpc_clnt *clnt; 1558 struct rpc_clnt *clnt;
1538 struct rpc_task *t; 1559 struct rpc_task *task;
1539 int header = 0; 1560 int header = 0;
1540 1561
1541 spin_lock(&rpc_client_lock); 1562 spin_lock(&rpc_client_lock);
1542 list_for_each_entry(clnt, &all_clients, cl_clients) { 1563 list_for_each_entry(clnt, &all_clients, cl_clients) {
1543 spin_lock(&clnt->cl_lock); 1564 spin_lock(&clnt->cl_lock);
1544 list_for_each_entry(t, &clnt->cl_tasks, tk_task) { 1565 list_for_each_entry(task, &clnt->cl_tasks, tk_task) {
1545 const char *rpc_waitq = "none";
1546 int proc;
1547
1548 if (!header) { 1566 if (!header) {
1549 rpc_show_header(); 1567 rpc_show_header();
1550 header++; 1568 header++;
1551 } 1569 }
1552 1570 rpc_show_task(clnt, task);
1553 if (t->tk_msg.rpc_proc)
1554 proc = t->tk_msg.rpc_proc->p_proc;
1555 else
1556 proc = -1;
1557
1558 if (RPC_IS_QUEUED(t))
1559 rpc_waitq = rpc_qname(t->tk_waitqueue);
1560
1561 printk("%5u %04d %04x %6d %8p %6d %8p %8ld %8s %8p %8p\n",
1562 t->tk_pid, proc,
1563 t->tk_flags, t->tk_status,
1564 t->tk_client,
1565 (t->tk_client ? t->tk_client->cl_prog : 0),
1566 t->tk_rqstp, t->tk_timeout,
1567 rpc_waitq,
1568 t->tk_action, t->tk_ops);
1569 } 1571 }
1570 spin_unlock(&clnt->cl_lock); 1572 spin_unlock(&clnt->cl_lock);
1571 } 1573 }