[23/27] SUNRPC: Move RPC retransmission stat counter to xprt_transmit()
diff mbox series

Message ID 20180903152936.24325-24-trond.myklebust@hammerspace.com
State New
Headers show
Series
  • Convert RPC client transmission to a queued model
Related show

Commit Message

Trond Myklebust Sept. 3, 2018, 3:29 p.m. UTC
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 net/sunrpc/clnt.c | 6 ------
 net/sunrpc/xprt.c | 4 ++++
 2 files changed, 4 insertions(+), 6 deletions(-)

Comments

Chuck Lever Sept. 3, 2018, 5:31 p.m. UTC | #1
Do you also need to move req->rq_ntrans++ ?


> On Sep 3, 2018, at 11:29 AM, Trond Myklebust <trondmy@gmail.com> wrote:
> 
> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
> ---
> net/sunrpc/clnt.c | 6 ------
> net/sunrpc/xprt.c | 4 ++++
> 2 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
> index 585a82dfaf4d..fb40d1e9f636 100644
> --- a/net/sunrpc/clnt.c
> +++ b/net/sunrpc/clnt.c
> @@ -1967,8 +1967,6 @@ call_connect_status(struct rpc_task *task)
> static void
> call_transmit(struct rpc_task *task)
> {
> -	int is_retrans = RPC_WAS_SENT(task);
> -
> 	dprint_status(task);
> 
> 	task->tk_action = call_transmit_status;
> @@ -1979,10 +1977,6 @@ call_transmit(struct rpc_task *task)
> 	if (!xprt_prepare_transmit(task))
> 		return;
> 	xprt_transmit(task);
> -	if (task->tk_status < 0)
> -		return;
> -	if (is_retrans)
> -		task->tk_client->cl_stats->rpcretrans++;
> }
> 
> /*
> diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
> index 95d15d4017f7..b85e2c4fa115 100644
> --- a/net/sunrpc/xprt.c
> +++ b/net/sunrpc/xprt.c
> @@ -1126,6 +1126,7 @@ void xprt_transmit(struct rpc_task *task)
> 	struct rpc_rqst	*req = task->tk_rqstp;
> 	struct rpc_xprt	*xprt = req->rq_xprt;
> 	unsigned int connect_cookie;
> +	int is_retrans = RPC_WAS_SENT(task);
> 	int status;
> 
> 	dprintk("RPC: %5u xprt_transmit(%u)\n", task->tk_pid, req->rq_slen);
> @@ -1148,6 +1149,9 @@ void xprt_transmit(struct rpc_task *task)
> 		return;
> 	}
> 
> +	if (is_retrans)
> +		task->tk_client->cl_stats->rpcretrans++;
> +
> 	xprt_inject_disconnect(xprt);
> 
> 	dprintk("RPC: %5u xmit complete\n", task->tk_pid);
> -- 
> 2.17.1
> 

--
Chuck Lever
chucklever@gmail.com
Trond Myklebust Sept. 3, 2018, 5:49 p.m. UTC | #2
On Mon, 2018-09-03 at 13:31 -0400, Chuck Lever wrote:
> Do you also need to move req->rq_ntrans++ ?

Good point. Right now, it is in completely the wrong place.

> 
> > On Sep 3, 2018, at 11:29 AM, Trond Myklebust <trondmy@gmail.com>
> > wrote:
> > 
> > Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
> > ---
> > net/sunrpc/clnt.c | 6 ------
> > net/sunrpc/xprt.c | 4 ++++
> > 2 files changed, 4 insertions(+), 6 deletions(-)
> > 
> > diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
> > index 585a82dfaf4d..fb40d1e9f636 100644
> > --- a/net/sunrpc/clnt.c
> > +++ b/net/sunrpc/clnt.c
> > @@ -1967,8 +1967,6 @@ call_connect_status(struct rpc_task *task)
> > static void
> > call_transmit(struct rpc_task *task)
> > {
> > -	int is_retrans = RPC_WAS_SENT(task);
> > -
> > 	dprint_status(task);
> > 
> > 	task->tk_action = call_transmit_status;
> > @@ -1979,10 +1977,6 @@ call_transmit(struct rpc_task *task)
> > 	if (!xprt_prepare_transmit(task))
> > 		return;
> > 	xprt_transmit(task);
> > -	if (task->tk_status < 0)
> > -		return;
> > -	if (is_retrans)
> > -		task->tk_client->cl_stats->rpcretrans++;
> > }
> > 
> > /*
> > diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
> > index 95d15d4017f7..b85e2c4fa115 100644
> > --- a/net/sunrpc/xprt.c
> > +++ b/net/sunrpc/xprt.c
> > @@ -1126,6 +1126,7 @@ void xprt_transmit(struct rpc_task *task)
> > 	struct rpc_rqst	*req = task->tk_rqstp;
> > 	struct rpc_xprt	*xprt = req->rq_xprt;
> > 	unsigned int connect_cookie;
> > +	int is_retrans = RPC_WAS_SENT(task);
> > 	int status;
> > 
> > 	dprintk("RPC: %5u xprt_transmit(%u)\n", task->tk_pid, req-
> > >rq_slen);
> > @@ -1148,6 +1149,9 @@ void xprt_transmit(struct rpc_task *task)
> > 		return;
> > 	}
> > 
> > +	if (is_retrans)
> > +		task->tk_client->cl_stats->rpcretrans++;
> > +
> > 	xprt_inject_disconnect(xprt);
> > 
> > 	dprintk("RPC: %5u xmit complete\n", task->tk_pid);
> > -- 
> > 2.17.1
> > 
> 
> --
> Chuck Lever
> chucklever@gmail.com
> 
> 
>

Patch
diff mbox series

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 585a82dfaf4d..fb40d1e9f636 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1967,8 +1967,6 @@  call_connect_status(struct rpc_task *task)
 static void
 call_transmit(struct rpc_task *task)
 {
-	int is_retrans = RPC_WAS_SENT(task);
-
 	dprint_status(task);
 
 	task->tk_action = call_transmit_status;
@@ -1979,10 +1977,6 @@  call_transmit(struct rpc_task *task)
 	if (!xprt_prepare_transmit(task))
 		return;
 	xprt_transmit(task);
-	if (task->tk_status < 0)
-		return;
-	if (is_retrans)
-		task->tk_client->cl_stats->rpcretrans++;
 }
 
 /*
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 95d15d4017f7..b85e2c4fa115 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -1126,6 +1126,7 @@  void xprt_transmit(struct rpc_task *task)
 	struct rpc_rqst	*req = task->tk_rqstp;
 	struct rpc_xprt	*xprt = req->rq_xprt;
 	unsigned int connect_cookie;
+	int is_retrans = RPC_WAS_SENT(task);
 	int status;
 
 	dprintk("RPC: %5u xprt_transmit(%u)\n", task->tk_pid, req->rq_slen);
@@ -1148,6 +1149,9 @@  void xprt_transmit(struct rpc_task *task)
 		return;
 	}
 
+	if (is_retrans)
+		task->tk_client->cl_stats->rpcretrans++;
+
 	xprt_inject_disconnect(xprt);
 
 	dprintk("RPC: %5u xmit complete\n", task->tk_pid);