aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2008-05-21 17:09:26 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-07-09 12:08:55 -0400
commit68a23ee94e3a06819f5a39d64f2e1f3131bab12d (patch)
tree47b9e954ccbd2ead56307f64516da91298153b9a
parentb0e1c57ea00302c3ac541ffd37e7db07d13cd674 (diff)
SUNRPC: Don't display the rpc_show_tasks header if there are no tasks
Clean up: don't display the rpc_show_tasks column header unless there is at least one task to display. As far as I can tell, it is safe to let the list_for_each_entry macro decide that each list is empty. scripts/checkpatch.pl also wants a KERN_FOO at the start of any newly added printk() calls, so this and subsequent patches will also add KERN_INFO. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--net/sunrpc/clnt.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index ab8038db8ef8..7dda32851adb 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1526,24 +1526,30 @@ struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, int
1526EXPORT_SYMBOL_GPL(rpc_call_null); 1526EXPORT_SYMBOL_GPL(rpc_call_null);
1527 1527
1528#ifdef RPC_DEBUG 1528#ifdef RPC_DEBUG
1529static void rpc_show_header(void)
1530{
1531 printk(KERN_INFO "-pid- proc flgs status -client- -prog- --rqstp- "
1532 "-timeout -rpcwait -action- ---ops--\n");
1533}
1534
1529void rpc_show_tasks(void) 1535void rpc_show_tasks(void)
1530{ 1536{
1531 struct rpc_clnt *clnt; 1537 struct rpc_clnt *clnt;
1532 struct rpc_task *t; 1538 struct rpc_task *t;
1539 int header = 0;
1533 1540
1534 spin_lock(&rpc_client_lock); 1541 spin_lock(&rpc_client_lock);
1535 if (list_empty(&all_clients))
1536 goto out;
1537 printk("-pid- proc flgs status -client- -prog- --rqstp- -timeout "
1538 "-rpcwait -action- ---ops--\n");
1539 list_for_each_entry(clnt, &all_clients, cl_clients) { 1542 list_for_each_entry(clnt, &all_clients, cl_clients) {
1540 if (list_empty(&clnt->cl_tasks))
1541 continue;
1542 spin_lock(&clnt->cl_lock); 1543 spin_lock(&clnt->cl_lock);
1543 list_for_each_entry(t, &clnt->cl_tasks, tk_task) { 1544 list_for_each_entry(t, &clnt->cl_tasks, tk_task) {
1544 const char *rpc_waitq = "none"; 1545 const char *rpc_waitq = "none";
1545 int proc; 1546 int proc;
1546 1547
1548 if (!header) {
1549 rpc_show_header();
1550 header++;
1551 }
1552
1547 if (t->tk_msg.rpc_proc) 1553 if (t->tk_msg.rpc_proc)
1548 proc = t->tk_msg.rpc_proc->p_proc; 1554 proc = t->tk_msg.rpc_proc->p_proc;
1549 else 1555 else
@@ -1563,7 +1569,6 @@ void rpc_show_tasks(void)
1563 } 1569 }
1564 spin_unlock(&clnt->cl_lock); 1570 spin_unlock(&clnt->cl_lock);
1565 } 1571 }
1566out:
1567 spin_unlock(&rpc_client_lock); 1572 spin_unlock(&rpc_client_lock);
1568} 1573}
1569#endif 1574#endif