Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2881ae74e68ecfe3b32a90936e5d93a9ba598c3a
Commit:     2881ae74e68ecfe3b32a90936e5d93a9ba598c3a
Parent:     698b6d088e8a5d907596c689d5ae9109611c5b59
Author:     Trond Myklebust <[EMAIL PROTECTED]>
AuthorDate: Thu Dec 20 16:03:54 2007 -0500
Committer:  Trond Myklebust <[EMAIL PROTECTED]>
CommitDate: Wed Jan 30 02:05:58 2008 -0500

    SUNRPC: Clean up the transport timeout initialisation
    
    Signed-off-by: Trond Myklebust <[EMAIL PROTECTED]>
---
 include/linux/sunrpc/xprt.h     |    5 -----
 net/sunrpc/xprt.c               |   17 -----------------
 net/sunrpc/xprtrdma/transport.c |    7 ++++++-
 net/sunrpc/xprtsock.c           |   29 +++++++++++++++++++++--------
 4 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 2554cd2..a00d4a4 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -203,11 +203,6 @@ struct xprt_class {
 };
 
 /*
- * Transport operations used by ULPs
- */
-void                   xprt_set_timeout(struct rpc_timeout *to, unsigned int 
retr, unsigned long incr);
-
-/*
  * Generic internal transport functions
  */
 struct rpc_xprt                *xprt_create_transport(struct xprt_create 
*args);
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 7520c66..2bc9956 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -978,23 +978,6 @@ void xprt_release(struct rpc_task *task)
 }
 
 /**
- * xprt_set_timeout - set constant RPC timeout
- * @to: RPC timeout parameters to set up
- * @retr: number of retries
- * @incr: amount of increase after each retry
- *
- */
-void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long 
incr)
-{
-       to->to_initval   =
-       to->to_increment = incr;
-       to->to_maxval    = to->to_initval + (incr * retr);
-       to->to_retries   = retr;
-       to->to_exponential = 0;
-}
-EXPORT_SYMBOL_GPL(xprt_set_timeout);
-
-/**
  * xprt_create_transport - create an RPC transport
  * @args: rpc transport creation arguments
  *
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index 73033d8..39f1001 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -289,6 +289,11 @@ xprt_rdma_destroy(struct rpc_xprt *xprt)
        module_put(THIS_MODULE);
 }
 
+static const struct rpc_timeout xprt_rdma_default_timeout = {
+       .to_initval = 60 * HZ,
+       .to_maxval = 60 * HZ,
+};
+
 /**
  * xprt_setup_rdma - Set up transport to use RDMA
  *
@@ -327,7 +332,7 @@ xprt_setup_rdma(struct xprt_create *args)
        }
 
        /* 60 second timeout, no retries */
-       xprt_set_timeout(&xprt->timeout, 0, 60UL * HZ);
+       memcpy(&xprt->timeout, &xprt_rdma_default_timeout, 
sizeof(xprt->timeout));
        xprt->bind_timeout = (60U * HZ);
        xprt->connect_timeout = (60U * HZ);
        xprt->reestablish_timeout = (5U * HZ);
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index a4cfdc5..d7b07ac 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1895,6 +1895,13 @@ static struct rpc_xprt *xs_setup_xprt(struct xprt_create 
*args,
        return xprt;
 }
 
+static const struct rpc_timeout xs_udp_default_timeout = {
+       .to_initval = 5 * HZ,
+       .to_maxval = 30 * HZ,
+       .to_increment = 5 * HZ,
+       .to_retries = 5,
+};
+
 /**
  * xs_setup_udp - Set up transport to use a UDP socket
  * @args: rpc transport creation arguments
@@ -1905,6 +1912,7 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create 
*args)
        struct sockaddr *addr = args->dstaddr;
        struct rpc_xprt *xprt;
        struct sock_xprt *transport;
+       const struct rpc_timeout *timeo = &xs_udp_default_timeout;
 
        xprt = xs_setup_xprt(args, xprt_udp_slot_table_entries);
        if (IS_ERR(xprt))
@@ -1923,10 +1931,9 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create 
*args)
 
        xprt->ops = &xs_udp_ops;
 
-       if (args->timeout)
-               xprt->timeout = *args->timeout;
-       else
-               xprt_set_timeout(&xprt->timeout, 5, 5 * HZ);
+       if (args->timeout != NULL)
+               timeo = args->timeout;
+       memcpy(&xprt->timeout, timeo, sizeof(xprt->timeout));
 
        switch (addr->sa_family) {
        case AF_INET:
@@ -1961,6 +1968,12 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create 
*args)
        return ERR_PTR(-EINVAL);
 }
 
+static const struct rpc_timeout xs_tcp_default_timeout = {
+       .to_initval = 60 * HZ,
+       .to_maxval = 60 * HZ,
+       .to_retries = 2,
+};
+
 /**
  * xs_setup_tcp - Set up transport to use a TCP socket
  * @args: rpc transport creation arguments
@@ -1971,6 +1984,7 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create 
*args)
        struct sockaddr *addr = args->dstaddr;
        struct rpc_xprt *xprt;
        struct sock_xprt *transport;
+       const struct rpc_timeout *timeo = &xs_tcp_default_timeout;
 
        xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries);
        if (IS_ERR(xprt))
@@ -1988,10 +2002,9 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create 
*args)
 
        xprt->ops = &xs_tcp_ops;
 
-       if (args->timeout)
-               xprt->timeout = *args->timeout;
-       else
-               xprt_set_timeout(&xprt->timeout, 2, 60 * HZ);
+       if (args->timeout != NULL)
+               timeo = args->timeout;
+       memcpy(&xprt->timeout, timeo, sizeof(xprt->timeout));
 
        switch (addr->sa_family) {
        case AF_INET:
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to