linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch]xprt: remove redundant checks
@ 2011-03-16  6:45 j223yang
       [not found] ` <20110316064509.GA1498-I6MVnP1QzuRPSEYXltEZZrDks+cytr/Z@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: j223yang @ 2011-03-16  6:45 UTC (permalink / raw)
  To: linux-nfs; +Cc: linux-kernel

'req' is already dereferenced in 
'struct rpc_xprt *xprt = req->rq_xprt;',
but check again later in the function.
The patch removes these redundant checks.

Signed-off-by: Jinqiu Yang <crindy646@gmail.com>
---
 xprt.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/net/sunrpt/xprt.c b/net/sunrpt/xprt.c
--- a/net/sunrpc/xprt.c	2011-03-16 00:10:08.764164573 -0400
+++ b/net/sunrpt/xprt.c	2011-03-16 02:33:38.559164414 -0400
@@ -202,10 +202,8 @@ int xprt_reserve_xprt(struct rpc_task *t
 		goto out_sleep;
 	}
 	xprt->snd_task = task;
-	if (req) {
-		req->rq_bytes_sent = 0;
-		req->rq_ntrans++;
-	}
+	req->rq_bytes_sent = 0;
+	req->rq_ntrans++;
 	return 1;
 
 out_sleep:
@@ -213,7 +211,7 @@ out_sleep:
 			task->tk_pid, xprt);
 	task->tk_timeout = 0;
 	task->tk_status = -EAGAIN;
-	if (req && req->rq_ntrans)
+	if (req->rq_ntrans)
 		rpc_sleep_on(&xprt->resend, task, NULL);
 	else
 		rpc_sleep_on(&xprt->sending, task, NULL);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch]xprt: remove redundant checks
       [not found] ` <20110316064509.GA1498-I6MVnP1QzuRPSEYXltEZZrDks+cytr/Z@public.gmane.org>
@ 2011-03-16 14:25   ` Trond Myklebust
  0 siblings, 0 replies; 2+ messages in thread
From: Trond Myklebust @ 2011-03-16 14:25 UTC (permalink / raw)
  To: j223yang-I6MVnP1QzuRPSEYXltEZZrDks+cytr/Z; +Cc: linux-nfs, linux-kernel

On Wed, 2011-03-16 at 02:45 -0400, j223yang-I6MVnP1QzuRPSEYXltEZZrDks+cytr/Z@public.gmane.org wrote:
> 'req' is already dereferenced in 
> 'struct rpc_xprt *xprt = req->rq_xprt;',
> but check again later in the function.
> The patch removes these redundant checks.
> 
> Signed-off-by: Jinqiu Yang <crindy646@gmail.com>
> ---
>  xprt.c |    8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/net/sunrpt/xprt.c b/net/sunrpt/xprt.c
> --- a/net/sunrpc/xprt.c	2011-03-16 00:10:08.764164573 -0400
> +++ b/net/sunrpt/xprt.c	2011-03-16 02:33:38.559164414 -0400
> @@ -202,10 +202,8 @@ int xprt_reserve_xprt(struct rpc_task *t
>  		goto out_sleep;
>  	}
>  	xprt->snd_task = task;
> -	if (req) {
> -		req->rq_bytes_sent = 0;
> -		req->rq_ntrans++;
> -	}
> +	req->rq_bytes_sent = 0;
> +	req->rq_ntrans++;
>  	return 1;
>  
>  out_sleep:
> @@ -213,7 +211,7 @@ out_sleep:
>  			task->tk_pid, xprt);
>  	task->tk_timeout = 0;
>  	task->tk_status = -EAGAIN;
> -	if (req && req->rq_ntrans)
> +	if (req->rq_ntrans)
>  		rpc_sleep_on(&xprt->resend, task, NULL);
>  	else
>  		rpc_sleep_on(&xprt->sending, task, NULL);
> --
> 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

You already sent hunk 1 in a different patch, and I've already applied
that to the nfs-for-2.6.39 branch. Could you therefore please resend
this patch with just the second hunk.

Cheers
  Trond


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-16 14:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-16  6:45 [patch]xprt: remove redundant checks j223yang
     [not found] ` <20110316064509.GA1498-I6MVnP1QzuRPSEYXltEZZrDks+cytr/Z@public.gmane.org>
2011-03-16 14:25   ` Trond Myklebust

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).