aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2010-05-07 13:34:27 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-05-14 15:09:32 -0400
commitbbc72cea58f671665b6362be0d4e391813ac0eee (patch)
treee70a35d3bc05ece4a532514893fec151aee2bd46
parent9bc4e3ca46e4eb9cb434de4175c6041d00bbdca3 (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>
-rw-r--r--include/linux/sunrpc/xprt.h1
-rw-r--r--net/sunrpc/xprt.c13
-rw-r--r--net/sunrpc/xprtsock.c1
3 files changed, 4 insertions, 11 deletions
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 8263f7aefedf..04fc342d9840 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -293,7 +293,6 @@ void xprt_set_retrans_timeout_rtt(struct rpc_task *task);
293void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); 293void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status);
294void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action); 294void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action);
295void xprt_write_space(struct rpc_xprt *xprt); 295void xprt_write_space(struct rpc_xprt *xprt);
296void xprt_update_rtt(struct rpc_task *task);
297void xprt_adjust_cwnd(struct rpc_task *task, int result); 296void xprt_adjust_cwnd(struct rpc_task *task, int result);
298struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid); 297struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid);
299void xprt_complete_rqst(struct rpc_task *task, int copied); 298void xprt_complete_rqst(struct rpc_task *task, int copied);
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)
774} 774}
775EXPORT_SYMBOL_GPL(xprt_lookup_rqst); 775EXPORT_SYMBOL_GPL(xprt_lookup_rqst);
776 776
777/** 777static void xprt_update_rtt(struct rpc_task *task)
778 * xprt_update_rtt - update an RPC client's RTT state after receiving a reply
779 * @task: RPC request that recently completed
780 *
781 */
782void xprt_update_rtt(struct rpc_task *task)
783{ 778{
784 struct rpc_rqst *req = task->tk_rqstp; 779 struct rpc_rqst *req = task->tk_rqstp;
785 struct rpc_rtt *rtt = task->tk_client->cl_rtt; 780 struct rpc_rtt *rtt = task->tk_client->cl_rtt;
@@ -787,12 +782,10 @@ void xprt_update_rtt(struct rpc_task *task)
787 782
788 if (timer) { 783 if (timer) {
789 if (req->rq_ntrans == 1) 784 if (req->rq_ntrans == 1)
790 rpc_update_rtt(rtt, timer, 785 rpc_update_rtt(rtt, timer, task->tk_rtt);
791 (long)jiffies - req->rq_xtime);
792 rpc_set_timeo(rtt, timer, req->rq_ntrans - 1); 786 rpc_set_timeo(rtt, timer, req->rq_ntrans - 1);
793 } 787 }
794} 788}
795EXPORT_SYMBOL_GPL(xprt_update_rtt);
796 789
797/** 790/**
798 * xprt_complete_rqst - called when reply processing is complete 791 * xprt_complete_rqst - called when reply processing is complete
@@ -811,6 +804,8 @@ void xprt_complete_rqst(struct rpc_task *task, int copied)
811 804
812 xprt->stat.recvs++; 805 xprt->stat.recvs++;
813 task->tk_rtt = (long)jiffies - req->rq_xtime; 806 task->tk_rtt = (long)jiffies - req->rq_xtime;
807 if (xprt->ops->timer != NULL)
808 xprt_update_rtt(task);
814 809
815 list_del_init(&req->rq_list); 810 list_del_init(&req->rq_list);
816 req->rq_private_buf.len = copied; 811 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)
844 dst_confirm(skb_dst(skb)); 844 dst_confirm(skb_dst(skb));
845 845
846 xprt_adjust_cwnd(task, copied); 846 xprt_adjust_cwnd(task, copied);
847 xprt_update_rtt(task);
848 xprt_complete_rqst(task, copied); 847 xprt_complete_rqst(task, copied);
849 848
850 out_unlock: 849 out_unlock: