aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-12-20 16:03:55 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-01-30 02:05:59 -0500
commitba7392bb37cb12781890f45d7ddee1618e33a036 (patch)
tree4c9a6cb3b22cae407f810c214275ab107ee3fc77 /net/sunrpc
parent2881ae74e68ecfe3b32a90936e5d93a9ba598c3a (diff)
SUNRPC: Add support for per-client timeout values
In order to be able to support setting the timeo and retrans parameters on a per-mountpoint basis, we move the rpc_timeout structure into the rpc_clnt. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/clnt.c12
-rw-r--r--net/sunrpc/xprt.c11
-rw-r--r--net/sunrpc/xprtrdma/transport.c2
-rw-r--r--net/sunrpc/xprtsock.c11
4 files changed, 18 insertions, 18 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 6a6b96e8dcb2..a3c00da9ce21 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -188,8 +188,15 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, stru
188 if (!xprt_bound(clnt->cl_xprt)) 188 if (!xprt_bound(clnt->cl_xprt))
189 clnt->cl_autobind = 1; 189 clnt->cl_autobind = 1;
190 190
191 clnt->cl_timeout = xprt->timeout;
192 if (args->timeout != NULL) {
193 memcpy(&clnt->cl_timeout_default, args->timeout,
194 sizeof(clnt->cl_timeout_default));
195 clnt->cl_timeout = &clnt->cl_timeout_default;
196 }
197
191 clnt->cl_rtt = &clnt->cl_rtt_default; 198 clnt->cl_rtt = &clnt->cl_rtt_default;
192 rpc_init_rtt(&clnt->cl_rtt_default, xprt->timeout.to_initval); 199 rpc_init_rtt(&clnt->cl_rtt_default, clnt->cl_timeout->to_initval);
193 200
194 kref_init(&clnt->cl_kref); 201 kref_init(&clnt->cl_kref);
195 202
@@ -251,7 +258,6 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
251 .srcaddr = args->saddress, 258 .srcaddr = args->saddress,
252 .dstaddr = args->address, 259 .dstaddr = args->address,
253 .addrlen = args->addrsize, 260 .addrlen = args->addrsize,
254 .timeout = args->timeout
255 }; 261 };
256 char servername[48]; 262 char servername[48];
257 263
@@ -348,7 +354,7 @@ rpc_clone_client(struct rpc_clnt *clnt)
348 new->cl_autobind = 0; 354 new->cl_autobind = 0;
349 INIT_LIST_HEAD(&new->cl_tasks); 355 INIT_LIST_HEAD(&new->cl_tasks);
350 spin_lock_init(&new->cl_lock); 356 spin_lock_init(&new->cl_lock);
351 rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval); 357 rpc_init_rtt(&new->cl_rtt_default, clnt->cl_timeout->to_initval);
352 new->cl_metrics = rpc_alloc_iostats(clnt); 358 new->cl_metrics = rpc_alloc_iostats(clnt);
353 if (new->cl_metrics == NULL) 359 if (new->cl_metrics == NULL)
354 goto out_no_stats; 360 goto out_no_stats;
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 2bc99569c586..cfcade906a56 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -501,9 +501,10 @@ EXPORT_SYMBOL_GPL(xprt_set_retrans_timeout_def);
501void xprt_set_retrans_timeout_rtt(struct rpc_task *task) 501void xprt_set_retrans_timeout_rtt(struct rpc_task *task)
502{ 502{
503 int timer = task->tk_msg.rpc_proc->p_timer; 503 int timer = task->tk_msg.rpc_proc->p_timer;
504 struct rpc_rtt *rtt = task->tk_client->cl_rtt; 504 struct rpc_clnt *clnt = task->tk_client;
505 struct rpc_rtt *rtt = clnt->cl_rtt;
505 struct rpc_rqst *req = task->tk_rqstp; 506 struct rpc_rqst *req = task->tk_rqstp;
506 unsigned long max_timeout = req->rq_xprt->timeout.to_maxval; 507 unsigned long max_timeout = clnt->cl_timeout->to_maxval;
507 508
508 task->tk_timeout = rpc_calc_rto(rtt, timer); 509 task->tk_timeout = rpc_calc_rto(rtt, timer);
509 task->tk_timeout <<= rpc_ntimeo(rtt, timer) + req->rq_retries; 510 task->tk_timeout <<= rpc_ntimeo(rtt, timer) + req->rq_retries;
@@ -514,7 +515,7 @@ EXPORT_SYMBOL_GPL(xprt_set_retrans_timeout_rtt);
514 515
515static void xprt_reset_majortimeo(struct rpc_rqst *req) 516static void xprt_reset_majortimeo(struct rpc_rqst *req)
516{ 517{
517 struct rpc_timeout *to = &req->rq_xprt->timeout; 518 const struct rpc_timeout *to = req->rq_task->tk_client->cl_timeout;
518 519
519 req->rq_majortimeo = req->rq_timeout; 520 req->rq_majortimeo = req->rq_timeout;
520 if (to->to_exponential) 521 if (to->to_exponential)
@@ -534,7 +535,7 @@ static void xprt_reset_majortimeo(struct rpc_rqst *req)
534int xprt_adjust_timeout(struct rpc_rqst *req) 535int xprt_adjust_timeout(struct rpc_rqst *req)
535{ 536{
536 struct rpc_xprt *xprt = req->rq_xprt; 537 struct rpc_xprt *xprt = req->rq_xprt;
537 struct rpc_timeout *to = &xprt->timeout; 538 const struct rpc_timeout *to = req->rq_task->tk_client->cl_timeout;
538 int status = 0; 539 int status = 0;
539 540
540 if (time_before(jiffies, req->rq_majortimeo)) { 541 if (time_before(jiffies, req->rq_majortimeo)) {
@@ -928,7 +929,7 @@ static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt)
928{ 929{
929 struct rpc_rqst *req = task->tk_rqstp; 930 struct rpc_rqst *req = task->tk_rqstp;
930 931
931 req->rq_timeout = xprt->timeout.to_initval; 932 req->rq_timeout = task->tk_client->cl_timeout->to_initval;
932 req->rq_task = task; 933 req->rq_task = task;
933 req->rq_xprt = xprt; 934 req->rq_xprt = xprt;
934 req->rq_buffer = NULL; 935 req->rq_buffer = NULL;
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index 39f10016c86b..d1389afc8342 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -332,7 +332,7 @@ xprt_setup_rdma(struct xprt_create *args)
332 } 332 }
333 333
334 /* 60 second timeout, no retries */ 334 /* 60 second timeout, no retries */
335 memcpy(&xprt->timeout, &xprt_rdma_default_timeout, sizeof(xprt->timeout)); 335 xprt->timeout = &xprt_rdma_default_timeout;
336 xprt->bind_timeout = (60U * HZ); 336 xprt->bind_timeout = (60U * HZ);
337 xprt->connect_timeout = (60U * HZ); 337 xprt->connect_timeout = (60U * HZ);
338 xprt->reestablish_timeout = (5U * HZ); 338 xprt->reestablish_timeout = (5U * HZ);
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index d7b07ac5b710..6ba329d339a2 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1912,7 +1912,6 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create *args)
1912 struct sockaddr *addr = args->dstaddr; 1912 struct sockaddr *addr = args->dstaddr;
1913 struct rpc_xprt *xprt; 1913 struct rpc_xprt *xprt;
1914 struct sock_xprt *transport; 1914 struct sock_xprt *transport;
1915 const struct rpc_timeout *timeo = &xs_udp_default_timeout;
1916 1915
1917 xprt = xs_setup_xprt(args, xprt_udp_slot_table_entries); 1916 xprt = xs_setup_xprt(args, xprt_udp_slot_table_entries);
1918 if (IS_ERR(xprt)) 1917 if (IS_ERR(xprt))
@@ -1931,9 +1930,7 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create *args)
1931 1930
1932 xprt->ops = &xs_udp_ops; 1931 xprt->ops = &xs_udp_ops;
1933 1932
1934 if (args->timeout != NULL) 1933 xprt->timeout = &xs_udp_default_timeout;
1935 timeo = args->timeout;
1936 memcpy(&xprt->timeout, timeo, sizeof(xprt->timeout));
1937 1934
1938 switch (addr->sa_family) { 1935 switch (addr->sa_family) {
1939 case AF_INET: 1936 case AF_INET:
@@ -1984,7 +1981,6 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args)
1984 struct sockaddr *addr = args->dstaddr; 1981 struct sockaddr *addr = args->dstaddr;
1985 struct rpc_xprt *xprt; 1982 struct rpc_xprt *xprt;
1986 struct sock_xprt *transport; 1983 struct sock_xprt *transport;
1987 const struct rpc_timeout *timeo = &xs_tcp_default_timeout;
1988 1984
1989 xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries); 1985 xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries);
1990 if (IS_ERR(xprt)) 1986 if (IS_ERR(xprt))
@@ -2001,10 +1997,7 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args)
2001 xprt->idle_timeout = XS_IDLE_DISC_TO; 1997 xprt->idle_timeout = XS_IDLE_DISC_TO;
2002 1998
2003 xprt->ops = &xs_tcp_ops; 1999 xprt->ops = &xs_tcp_ops;
2004 2000 xprt->timeout = &xs_tcp_default_timeout;
2005 if (args->timeout != NULL)
2006 timeo = args->timeout;
2007 memcpy(&xprt->timeout, timeo, sizeof(xprt->timeout));
2008 2001
2009 switch (addr->sa_family) { 2002 switch (addr->sa_family) {
2010 case AF_INET: 2003 case AF_INET: