diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2010-05-07 13:34:27 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-05-14 15:09:32 -0400 |
commit | bbc72cea58f671665b6362be0d4e391813ac0eee (patch) | |
tree | e70a35d3bc05ece4a532514893fec151aee2bd46 /net/sunrpc | |
parent | 9bc4e3ca46e4eb9cb434de4175c6041d00bbdca3 (diff) |
SUNRPC: RPC metrics and RTT estimator should use same RTT value
Compute an RPC request's RTT once, and use that value both for reporting
RPC metrics, and for adjusting the RTT context used by the RPC client's RTT
estimator algorithm.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/xprt.c | 13 | ||||
-rw-r--r-- | net/sunrpc/xprtsock.c | 1 |
2 files changed, 4 insertions, 10 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 6c9997ef386a..698c62712294 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -774,12 +774,7 @@ struct rpc_rqst *xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid) } EXPORT_SYMBOL_GPL(xprt_lookup_rqst); -/** - * xprt_update_rtt - update an RPC client's RTT state after receiving a reply - * @task: RPC request that recently completed - * - */ -void xprt_update_rtt(struct rpc_task *task) +static void xprt_update_rtt(struct rpc_task *task) { struct rpc_rqst *req = task->tk_rqstp; struct rpc_rtt *rtt = task->tk_client->cl_rtt; @@ -787,12 +782,10 @@ void xprt_update_rtt(struct rpc_task *task) if (timer) { if (req->rq_ntrans == 1) - rpc_update_rtt(rtt, timer, - (long)jiffies - req->rq_xtime); + rpc_update_rtt(rtt, timer, task->tk_rtt); rpc_set_timeo(rtt, timer, req->rq_ntrans - 1); } } -EXPORT_SYMBOL_GPL(xprt_update_rtt); /** * xprt_complete_rqst - called when reply processing is complete @@ -811,6 +804,8 @@ void xprt_complete_rqst(struct rpc_task *task, int copied) xprt->stat.recvs++; task->tk_rtt = (long)jiffies - req->rq_xtime; + if (xprt->ops->timer != NULL) + xprt_update_rtt(task); list_del_init(&req->rq_list); req->rq_private_buf.len = copied; diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 790a8f31b0bb..3d1dcdf2aef1 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -844,7 +844,6 @@ static void xs_udp_data_ready(struct sock *sk, int len) dst_confirm(skb_dst(skb)); xprt_adjust_cwnd(task, copied); - xprt_update_rtt(task); xprt_complete_rqst(task, copied); out_unlock: |