diff options
author | Chuck Lever <cel@citi.umich.edu> | 2005-08-11 16:25:47 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-09-23 12:38:26 -0400 |
commit | 55aa4f58aa43dc9a51fb80010630d94b96053a2e (patch) | |
tree | 7b3d79bdc15c76c25d8a53437b9e4173ebc68f24 /net/sunrpc/xprt.c | |
parent | 44fbac2288dfed6f1963ac00bf922c3bcd779cd1 (diff) |
[PATCH] RPC: client-side transport switch cleanup
Clean-up: change some comments to reflect the realities of the new RPC
transport switch mechanism. Get rid of unused xprt_receive() prototype.
Also, organize function prototypes in xprt.h by usage and scope.
Test-plan:
Compile kernel with CONFIG_NFS enabled.
Version: Thu, 11 Aug 2005 16:07:21 -0400
Signed-off-by: Chuck Lever <cel@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/xprt.c')
-rw-r--r-- | net/sunrpc/xprt.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 2f9cd468b953..247fa1ec870c 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -10,12 +10,12 @@ | |||
10 | * one is available. Otherwise, it sleeps on the backlog queue | 10 | * one is available. Otherwise, it sleeps on the backlog queue |
11 | * (xprt_reserve). | 11 | * (xprt_reserve). |
12 | * - Next, the caller puts together the RPC message, stuffs it into | 12 | * - Next, the caller puts together the RPC message, stuffs it into |
13 | * the request struct, and calls xprt_call(). | 13 | * the request struct, and calls xprt_transmit(). |
14 | * - xprt_call transmits the message and installs the caller on the | 14 | * - xprt_transmit sends the message and installs the caller on the |
15 | * socket's wait list. At the same time, it installs a timer that | 15 | * transport's wait list. At the same time, it installs a timer that |
16 | * is run after the packet's timeout has expired. | 16 | * is run after the packet's timeout has expired. |
17 | * - When a packet arrives, the data_ready handler walks the list of | 17 | * - When a packet arrives, the data_ready handler walks the list of |
18 | * pending requests for that socket. If a matching XID is found, the | 18 | * pending requests for that transport. If a matching XID is found, the |
19 | * caller is woken up, and the timer removed. | 19 | * caller is woken up, and the timer removed. |
20 | * - When no reply arrives within the timeout interval, the timer is | 20 | * - When no reply arrives within the timeout interval, the timer is |
21 | * fired by the kernel and runs xprt_timer(). It either adjusts the | 21 | * fired by the kernel and runs xprt_timer(). It either adjusts the |
@@ -32,6 +32,8 @@ | |||
32 | * tasks that rely on callbacks. | 32 | * tasks that rely on callbacks. |
33 | * | 33 | * |
34 | * Copyright (C) 1995-1997, Olaf Kirch <okir@monad.swb.de> | 34 | * Copyright (C) 1995-1997, Olaf Kirch <okir@monad.swb.de> |
35 | * | ||
36 | * Transport switch API copyright (C) 2005, Chuck Lever <cel@netapp.com> | ||
35 | */ | 37 | */ |
36 | 38 | ||
37 | #include <linux/module.h> | 39 | #include <linux/module.h> |
@@ -52,8 +54,6 @@ | |||
52 | # define RPCDBG_FACILITY RPCDBG_XPRT | 54 | # define RPCDBG_FACILITY RPCDBG_XPRT |
53 | #endif | 55 | #endif |
54 | 56 | ||
55 | #define XPRT_MAX_BACKOFF (8) | ||
56 | |||
57 | /* | 57 | /* |
58 | * Local functions | 58 | * Local functions |
59 | */ | 59 | */ |
@@ -65,9 +65,9 @@ static int __xprt_get_cong(struct rpc_xprt *, struct rpc_task *); | |||
65 | static int xprt_clear_backlog(struct rpc_xprt *xprt); | 65 | static int xprt_clear_backlog(struct rpc_xprt *xprt); |
66 | 66 | ||
67 | /* | 67 | /* |
68 | * Serialize write access to sockets, in order to prevent different | 68 | * Serialize write access to transports, in order to prevent different |
69 | * requests from interfering with each other. | 69 | * requests from interfering with each other. |
70 | * Also prevents TCP socket connects from colliding with writes. | 70 | * Also prevents transport connects from colliding with writes. |
71 | */ | 71 | */ |
72 | static int | 72 | static int |
73 | __xprt_lock_write(struct rpc_xprt *xprt, struct rpc_task *task) | 73 | __xprt_lock_write(struct rpc_xprt *xprt, struct rpc_task *task) |
@@ -91,7 +91,7 @@ __xprt_lock_write(struct rpc_xprt *xprt, struct rpc_task *task) | |||
91 | clear_bit(XPRT_LOCKED, &xprt->state); | 91 | clear_bit(XPRT_LOCKED, &xprt->state); |
92 | smp_mb__after_clear_bit(); | 92 | smp_mb__after_clear_bit(); |
93 | out_sleep: | 93 | out_sleep: |
94 | dprintk("RPC: %4d failed to lock socket %p\n", task->tk_pid, xprt); | 94 | dprintk("RPC: %4d failed to lock transport %p\n", task->tk_pid, xprt); |
95 | task->tk_timeout = 0; | 95 | task->tk_timeout = 0; |
96 | task->tk_status = -EAGAIN; | 96 | task->tk_status = -EAGAIN; |
97 | if (req && req->rq_ntrans) | 97 | if (req && req->rq_ntrans) |
@@ -144,7 +144,7 @@ out_unlock: | |||
144 | } | 144 | } |
145 | 145 | ||
146 | /* | 146 | /* |
147 | * Releases the socket for use by other requests. | 147 | * Releases the transport for use by other requests. |
148 | */ | 148 | */ |
149 | static void | 149 | static void |
150 | __xprt_release_write(struct rpc_xprt *xprt, struct rpc_task *task) | 150 | __xprt_release_write(struct rpc_xprt *xprt, struct rpc_task *task) |
@@ -294,8 +294,7 @@ int xprt_adjust_timeout(struct rpc_rqst *req) | |||
294 | return status; | 294 | return status; |
295 | } | 295 | } |
296 | 296 | ||
297 | static void | 297 | static void xprt_autoclose(void *args) |
298 | xprt_socket_autoclose(void *args) | ||
299 | { | 298 | { |
300 | struct rpc_xprt *xprt = (struct rpc_xprt *)args; | 299 | struct rpc_xprt *xprt = (struct rpc_xprt *)args; |
301 | 300 | ||
@@ -329,7 +328,6 @@ xprt_init_autodisconnect(unsigned long data) | |||
329 | if (test_and_set_bit(XPRT_LOCKED, &xprt->state)) | 328 | if (test_and_set_bit(XPRT_LOCKED, &xprt->state)) |
330 | goto out_abort; | 329 | goto out_abort; |
331 | spin_unlock(&xprt->transport_lock); | 330 | spin_unlock(&xprt->transport_lock); |
332 | /* Let keventd close the socket */ | ||
333 | if (xprt_connecting(xprt)) | 331 | if (xprt_connecting(xprt)) |
334 | xprt_release_write(xprt, NULL); | 332 | xprt_release_write(xprt, NULL); |
335 | else | 333 | else |
@@ -770,7 +768,7 @@ static struct rpc_xprt *xprt_setup(int proto, struct sockaddr_in *ap, struct rpc | |||
770 | 768 | ||
771 | INIT_LIST_HEAD(&xprt->free); | 769 | INIT_LIST_HEAD(&xprt->free); |
772 | INIT_LIST_HEAD(&xprt->recv); | 770 | INIT_LIST_HEAD(&xprt->recv); |
773 | INIT_WORK(&xprt->task_cleanup, xprt_socket_autoclose, xprt); | 771 | INIT_WORK(&xprt->task_cleanup, xprt_autoclose, xprt); |
774 | init_timer(&xprt->timer); | 772 | init_timer(&xprt->timer); |
775 | xprt->timer.function = xprt_init_autodisconnect; | 773 | xprt->timer.function = xprt_init_autodisconnect; |
776 | xprt->timer.data = (unsigned long) xprt; | 774 | xprt->timer.data = (unsigned long) xprt; |