sunrpc: Factor out rpc_xprt allocation
Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
committed by
J. Bruce Fields
parent
2b44f1ba40
commit
bd1722d431
@@ -2273,23 +2273,14 @@ static struct rpc_xprt *xs_setup_xprt(struct xprt_create *args,
|
||||
return ERR_PTR(-EBADF);
|
||||
}
|
||||
|
||||
new = kzalloc(sizeof(*new), GFP_KERNEL);
|
||||
if (new == NULL) {
|
||||
xprt = xprt_alloc(sizeof(*new), slot_table_size);
|
||||
if (xprt == NULL) {
|
||||
dprintk("RPC: xs_setup_xprt: couldn't allocate "
|
||||
"rpc_xprt\n");
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
xprt = &new->xprt;
|
||||
|
||||
xprt->max_reqs = slot_table_size;
|
||||
xprt->slot = kcalloc(xprt->max_reqs, sizeof(struct rpc_rqst), GFP_KERNEL);
|
||||
if (xprt->slot == NULL) {
|
||||
kfree(xprt);
|
||||
dprintk("RPC: xs_setup_xprt: couldn't allocate slot "
|
||||
"table\n");
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
new = container_of(xprt, struct sock_xprt, xprt);
|
||||
memcpy(&xprt->addr, args->dstaddr, args->addrlen);
|
||||
xprt->addrlen = args->addrlen;
|
||||
if (args->srcaddr)
|
||||
|
Reference in New Issue
Block a user