Commit 8d9266ff authored by Trond Myklebust's avatar Trond Myklebust

SUNRPC: Initalise the struct xprt upon allocation

Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 43cedbf0
...@@ -1091,38 +1091,9 @@ void xprt_release(struct rpc_task *task) ...@@ -1091,38 +1091,9 @@ void xprt_release(struct rpc_task *task)
xprt_free_bc_request(req); xprt_free_bc_request(req);
} }
/** static void xprt_init(struct rpc_xprt *xprt)
* xprt_create_transport - create an RPC transport
* @args: rpc transport creation arguments
*
*/
struct rpc_xprt *xprt_create_transport(struct xprt_create *args)
{ {
struct rpc_xprt *xprt;
struct rpc_rqst *req; struct rpc_rqst *req;
struct xprt_class *t;
spin_lock(&xprt_list_lock);
list_for_each_entry(t, &xprt_list, list) {
if (t->ident == args->ident) {
spin_unlock(&xprt_list_lock);
goto found;
}
}
spin_unlock(&xprt_list_lock);
printk(KERN_ERR "RPC: transport (%d) not supported\n", args->ident);
return ERR_PTR(-EIO);
found:
xprt = t->setup(args);
if (IS_ERR(xprt)) {
dprintk("RPC: xprt_create_transport: failed, %ld\n",
-PTR_ERR(xprt));
return xprt;
}
if (test_and_set_bit(XPRT_INITIALIZED, &xprt->state))
/* ->setup returned a pre-initialized xprt: */
return xprt;
spin_lock_init(&xprt->transport_lock); spin_lock_init(&xprt->transport_lock);
spin_lock_init(&xprt->reserve_lock); spin_lock_init(&xprt->reserve_lock);
...@@ -1156,6 +1127,42 @@ struct rpc_xprt *xprt_create_transport(struct xprt_create *args) ...@@ -1156,6 +1127,42 @@ struct rpc_xprt *xprt_create_transport(struct xprt_create *args)
xprt_init_xid(xprt); xprt_init_xid(xprt);
}
/**
* xprt_create_transport - create an RPC transport
* @args: rpc transport creation arguments
*
*/
struct rpc_xprt *xprt_create_transport(struct xprt_create *args)
{
struct rpc_xprt *xprt;
struct xprt_class *t;
spin_lock(&xprt_list_lock);
list_for_each_entry(t, &xprt_list, list) {
if (t->ident == args->ident) {
spin_unlock(&xprt_list_lock);
goto found;
}
}
spin_unlock(&xprt_list_lock);
printk(KERN_ERR "RPC: transport (%d) not supported\n", args->ident);
return ERR_PTR(-EIO);
found:
xprt = t->setup(args);
if (IS_ERR(xprt)) {
dprintk("RPC: xprt_create_transport: failed, %ld\n",
-PTR_ERR(xprt));
return xprt;
}
if (test_and_set_bit(XPRT_INITIALIZED, &xprt->state))
/* ->setup returned a pre-initialized xprt: */
return xprt;
xprt_init(xprt);
dprintk("RPC: created transport %p with %u slots\n", xprt, dprintk("RPC: created transport %p with %u slots\n", xprt,
xprt->max_reqs); xprt->max_reqs);
return xprt; return xprt;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment