diff options
author | Chuck Lever <cel@netapp.com> | 2006-03-20 13:44:23 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-20 13:44:23 -0500 |
commit | dead28da8e3fb32601d38fb32b7021122e0a3d21 (patch) | |
tree | a1a23e27e08345c86ed0d9812f848470b615eb34 /net | |
parent | cc0175c1dc1de8f6af0eb0631dcc5b999a6fcc42 (diff) |
SUNRPC: eliminate rpc_call()
Clean-up: replace rpc_call() helper with direct call to rpc_call_sync.
This makes NFSv2 and NFSv3 synchronous calls more computationally
efficient, and reduces stack consumption in functions that used to
invoke rpc_call more than once.
Test plan:
Compile kernel with CONFIG_NFS enabled. Connectathon on NFS version 2,
version 3, and version 4 mount points.
Signed-off-by: Chuck Lever <cel@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/pmap_clnt.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/net/sunrpc/pmap_clnt.c b/net/sunrpc/pmap_clnt.c index efa00bd9ff9..d25b054ec92 100644 --- a/net/sunrpc/pmap_clnt.c +++ b/net/sunrpc/pmap_clnt.c | |||
@@ -104,6 +104,11 @@ rpc_getport_external(struct sockaddr_in *sin, __u32 prog, __u32 vers, int prot) | |||
104 | .pm_prot = prot, | 104 | .pm_prot = prot, |
105 | .pm_port = 0 | 105 | .pm_port = 0 |
106 | }; | 106 | }; |
107 | struct rpc_message msg = { | ||
108 | .rpc_proc = &pmap_procedures[PMAP_GETPORT], | ||
109 | .rpc_argp = &map, | ||
110 | .rpc_resp = &map.pm_port, | ||
111 | }; | ||
107 | struct rpc_clnt *pmap_clnt; | 112 | struct rpc_clnt *pmap_clnt; |
108 | char hostname[32]; | 113 | char hostname[32]; |
109 | int status; | 114 | int status; |
@@ -117,7 +122,7 @@ rpc_getport_external(struct sockaddr_in *sin, __u32 prog, __u32 vers, int prot) | |||
117 | return PTR_ERR(pmap_clnt); | 122 | return PTR_ERR(pmap_clnt); |
118 | 123 | ||
119 | /* Setup the call info struct */ | 124 | /* Setup the call info struct */ |
120 | status = rpc_call(pmap_clnt, PMAP_GETPORT, &map, &map.pm_port, 0); | 125 | status = rpc_call_sync(pmap_clnt, &msg, 0); |
121 | 126 | ||
122 | if (status >= 0) { | 127 | if (status >= 0) { |
123 | if (map.pm_port != 0) | 128 | if (map.pm_port != 0) |
@@ -162,16 +167,27 @@ pmap_getport_done(struct rpc_task *task) | |||
162 | int | 167 | int |
163 | rpc_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay) | 168 | rpc_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay) |
164 | { | 169 | { |
165 | struct sockaddr_in sin; | 170 | struct sockaddr_in sin = { |
166 | struct rpc_portmap map; | 171 | .sin_family = AF_INET, |
172 | .sin_addr.s_addr = htonl(INADDR_LOOPBACK), | ||
173 | }; | ||
174 | struct rpc_portmap map = { | ||
175 | .pm_prog = prog, | ||
176 | .pm_vers = vers, | ||
177 | .pm_prot = prot, | ||
178 | .pm_port = port, | ||
179 | }; | ||
180 | struct rpc_message msg = { | ||
181 | .rpc_proc = &pmap_procedures[port ? PMAP_SET : PMAP_UNSET], | ||
182 | .rpc_argp = &map, | ||
183 | .rpc_resp = okay, | ||
184 | }; | ||
167 | struct rpc_clnt *pmap_clnt; | 185 | struct rpc_clnt *pmap_clnt; |
168 | int error = 0; | 186 | int error = 0; |
169 | 187 | ||
170 | dprintk("RPC: registering (%d, %d, %d, %d) with portmapper.\n", | 188 | dprintk("RPC: registering (%d, %d, %d, %d) with portmapper.\n", |
171 | prog, vers, prot, port); | 189 | prog, vers, prot, port); |
172 | 190 | ||
173 | sin.sin_family = AF_INET; | ||
174 | sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); | ||
175 | pmap_clnt = pmap_create("localhost", &sin, IPPROTO_UDP, 1); | 191 | pmap_clnt = pmap_create("localhost", &sin, IPPROTO_UDP, 1); |
176 | if (IS_ERR(pmap_clnt)) { | 192 | if (IS_ERR(pmap_clnt)) { |
177 | error = PTR_ERR(pmap_clnt); | 193 | error = PTR_ERR(pmap_clnt); |
@@ -179,13 +195,7 @@ rpc_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay) | |||
179 | return error; | 195 | return error; |
180 | } | 196 | } |
181 | 197 | ||
182 | map.pm_prog = prog; | 198 | error = rpc_call_sync(pmap_clnt, &msg, 0); |
183 | map.pm_vers = vers; | ||
184 | map.pm_prot = prot; | ||
185 | map.pm_port = port; | ||
186 | |||
187 | error = rpc_call(pmap_clnt, port? PMAP_SET : PMAP_UNSET, | ||
188 | &map, okay, 0); | ||
189 | 199 | ||
190 | if (error < 0) { | 200 | if (error < 0) { |
191 | printk(KERN_WARNING | 201 | printk(KERN_WARNING |