aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@parallels.com>2010-09-29 08:02:43 -0400
committerJ. Bruce Fields <bfields@redhat.com>2010-10-01 17:18:52 -0400
commitbd1722d4316e42a12fe6337ebe34d7e1e2c088b2 (patch)
tree358d45aaf5fb08a177fd6fbe5dcf8872160c30fc /net/sunrpc/xprtsock.c
parent2b44f1ba40914777f4b1075254ba97663d4e2574 (diff)
sunrpc: Factor out rpc_xprt allocation
Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index b6309db56226..a7a763821b88 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -2273,23 +2273,14 @@ static struct rpc_xprt *xs_setup_xprt(struct xprt_create *args,
2273 return ERR_PTR(-EBADF); 2273 return ERR_PTR(-EBADF);
2274 } 2274 }
2275 2275
2276 new = kzalloc(sizeof(*new), GFP_KERNEL); 2276 xprt = xprt_alloc(sizeof(*new), slot_table_size);
2277 if (new == NULL) { 2277 if (xprt == NULL) {
2278 dprintk("RPC: xs_setup_xprt: couldn't allocate " 2278 dprintk("RPC: xs_setup_xprt: couldn't allocate "
2279 "rpc_xprt\n"); 2279 "rpc_xprt\n");
2280 return ERR_PTR(-ENOMEM); 2280 return ERR_PTR(-ENOMEM);
2281 } 2281 }
2282 xprt = &new->xprt;
2283
2284 xprt->max_reqs = slot_table_size;
2285 xprt->slot = kcalloc(xprt->max_reqs, sizeof(struct rpc_rqst), GFP_KERNEL);
2286 if (xprt->slot == NULL) {
2287 kfree(xprt);
2288 dprintk("RPC: xs_setup_xprt: couldn't allocate slot "
2289 "table\n");
2290 return ERR_PTR(-ENOMEM);
2291 }
2292 2282
2283 new = container_of(xprt, struct sock_xprt, xprt);
2293 memcpy(&xprt->addr, args->dstaddr, args->addrlen); 2284 memcpy(&xprt->addr, args->dstaddr, args->addrlen);
2294 xprt->addrlen = args->addrlen; 2285 xprt->addrlen = args->addrlen;
2295 if (args->srcaddr) 2286 if (args->srcaddr)