All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: trond.myklebust@netapp.com, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 4/8] SUNRPC: Don't display the rpc_show_tasks header if there are no tasks
Date: Mon, 19 May 2008 12:19:43 -0400	[thread overview]
Message-ID: <20080519161943.GI7622@fieldses.org> (raw)
In-Reply-To: <20080518021636.8366.81782.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>

On Sat, May 17, 2008 at 10:16:36PM -0400, Chuck Lever wrote:
> 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.

That second list_empty() check is just before a spin_lock(); I wonder if
it was intended to avoid having to acquire a lot of spinlocks on
inactive clients?  Wouldn't have thought that was a worthwhile
optimization, but I don't know.

--b.

> 
> 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>
> ---
> 
>  net/sunrpc/clnt.c |   19 ++++++++++++-------
>  1 files changed, 12 insertions(+), 7 deletions(-)
> 
> 
> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
> index 5aa32fa..1a12236 100644
> --- a/net/sunrpc/clnt.c
> +++ b/net/sunrpc/clnt.c
> @@ -1517,24 +1517,30 @@ struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, int
>  EXPORT_SYMBOL_GPL(rpc_call_null);
>  
>  #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)
>  {
>  	struct rpc_clnt *clnt;
>  	struct rpc_task *t;
> +	int header = 0;
>  
>  	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) {
> -		if (list_empty(&clnt->cl_tasks))
> -			continue;
>  		spin_lock(&clnt->cl_lock);
>  		list_for_each_entry(t, &clnt->cl_tasks, tk_task) {
>  			const char *rpc_waitq = "none";
>  			int proc;
>  
> +			if (!header) {
> +				rpc_show_header();
> +				header++;
> +			}
> +
>  			if (t->tk_msg.rpc_proc)
>  				proc = t->tk_msg.rpc_proc->p_proc;
>  			else
> @@ -1554,7 +1560,6 @@ void rpc_show_tasks(void)
>  		}
>  		spin_unlock(&clnt->cl_lock);
>  	}
> -out:
>  	spin_unlock(&rpc_client_lock);
>  }
>  #endif
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2008-05-19 16:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-18  2:16 [PATCH 0/8] First set of 2.6.27 patches Chuck Lever
     [not found] ` <20080518021241.8366.12464.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-05-18  2:16   ` [PATCH 1/8] NFS: Update help text for CONFIG_NFS_FS Chuck Lever
     [not found]     ` <20080518021614.8366.39102.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-05-19 16:15       ` J. Bruce Fields
2008-05-19 16:24       ` J. Bruce Fields
2008-05-19 16:44         ` Chuck Lever
2008-05-19 17:09       ` Talpey, Thomas
     [not found]         ` <RTPCLUEXC1-PRDXzzAg00000113-rtwIt2gI0FxT+ZUat5FNkAK/GNPrWCqfQQ4Iyu8u01E@public.gmane.org>
2008-05-19 17:21           ` Chuck Lever
2008-05-19 18:10             ` Talpey, Thomas
2008-05-18  2:16   ` [PATCH 2/8] SUNRPC: Use RPC procedure name in call_start Chuck Lever
2008-05-18  2:16   ` [PATCH 3/8] SUNRPC: Use RPC procedure name in call_verify Chuck Lever
2008-05-18  2:16   ` [PATCH 4/8] SUNRPC: Don't display the rpc_show_tasks header if there are no tasks Chuck Lever
     [not found]     ` <20080518021636.8366.81782.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-05-19 16:19       ` J. Bruce Fields [this message]
2008-05-18  2:16   ` [PATCH 5/8] SUNRPC: Refactor rpc_show_tasks Chuck Lever
2008-05-18  2:16   ` [PATCH 6/8] SUNRPC: Add second output line for each RPC task in rpc_show_tasks Chuck Lever
     [not found]     ` <20080518021650.8366.96474.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-05-19 16:21       ` J. Bruce Fields
2008-05-19 16:31       ` Trond Myklebust
2008-05-19 16:41         ` Chuck Lever
2008-05-19 16:44           ` Trond Myklebust
2008-05-19 17:11             ` Chuck Lever
2008-05-18  2:16   ` [PATCH 7/8] SUNRPC: Rename "call_" functions that are no longer FSM states Chuck Lever
2008-05-18  2:17   ` [PATCH 8/8] SUNRPC: Display symbolic function addresses in rpc_show_tasks Chuck Lever
  -- strict thread matches above, loose matches on Subject: below --
2008-05-20 20:29 [PATCH 0/8] Initial set of 2.6.27 patches, take 2 Chuck Lever
     [not found] ` <20080520202108.3851.7464.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-05-20 20:29   ` [PATCH 4/8] SUNRPC: Don't display the rpc_show_tasks header if there are no tasks Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080519161943.GI7622@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@netapp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.