mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 08:02:07 +00:00
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>
This commit is contained in:
parent
b0e1c57ea0
commit
68a23ee94e
@ -1526,24 +1526,30 @@ struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, int
|
|||||||
EXPORT_SYMBOL_GPL(rpc_call_null);
|
EXPORT_SYMBOL_GPL(rpc_call_null);
|
||||||
|
|
||||||
#ifdef RPC_DEBUG
|
#ifdef RPC_DEBUG
|
||||||
|
static void rpc_show_header(void)
|
||||||
|
{
|
||||||
|
printk(KERN_INFO "-pid- proc flgs status -client- -prog- --rqstp- "
|
||||||
|
"-timeout -rpcwait -action- ---ops--\n");
|
||||||
|
}
|
||||||
|
|
||||||
void rpc_show_tasks(void)
|
void rpc_show_tasks(void)
|
||||||
{
|
{
|
||||||
struct rpc_clnt *clnt;
|
struct rpc_clnt *clnt;
|
||||||
struct rpc_task *t;
|
struct rpc_task *t;
|
||||||
|
int header = 0;
|
||||||
|
|
||||||
spin_lock(&rpc_client_lock);
|
spin_lock(&rpc_client_lock);
|
||||||
if (list_empty(&all_clients))
|
|
||||||
goto out;
|
|
||||||
printk("-pid- proc flgs status -client- -prog- --rqstp- -timeout "
|
|
||||||
"-rpcwait -action- ---ops--\n");
|
|
||||||
list_for_each_entry(clnt, &all_clients, cl_clients) {
|
list_for_each_entry(clnt, &all_clients, cl_clients) {
|
||||||
if (list_empty(&clnt->cl_tasks))
|
|
||||||
continue;
|
|
||||||
spin_lock(&clnt->cl_lock);
|
spin_lock(&clnt->cl_lock);
|
||||||
list_for_each_entry(t, &clnt->cl_tasks, tk_task) {
|
list_for_each_entry(t, &clnt->cl_tasks, tk_task) {
|
||||||
const char *rpc_waitq = "none";
|
const char *rpc_waitq = "none";
|
||||||
int proc;
|
int proc;
|
||||||
|
|
||||||
|
if (!header) {
|
||||||
|
rpc_show_header();
|
||||||
|
header++;
|
||||||
|
}
|
||||||
|
|
||||||
if (t->tk_msg.rpc_proc)
|
if (t->tk_msg.rpc_proc)
|
||||||
proc = t->tk_msg.rpc_proc->p_proc;
|
proc = t->tk_msg.rpc_proc->p_proc;
|
||||||
else
|
else
|
||||||
@ -1563,7 +1569,6 @@ void rpc_show_tasks(void)
|
|||||||
}
|
}
|
||||||
spin_unlock(&clnt->cl_lock);
|
spin_unlock(&clnt->cl_lock);
|
||||||
}
|
}
|
||||||
out:
|
|
||||||
spin_unlock(&rpc_client_lock);
|
spin_unlock(&rpc_client_lock);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user