summaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprt.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2011-07-17 16:01:09 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-07-17 16:01:09 -0400
commit8d9266ffe4332afc5ac9de401ef6f825b3798585 (patch)
treed0fbf4678a4751c3780bb8b805049cbc9afc7ec7 /net/sunrpc/xprt.c
parent43cedbf0e8dfb9c5610eb7985d5f21263e313802 (diff)
SUNRPC: Initalise the struct xprt upon allocation
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/xprt.c')
-rw-r--r--net/sunrpc/xprt.c67
1 files changed, 37 insertions, 30 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index ccd583a46ff..efb8dc5ab81 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -1091,38 +1091,9 @@ void xprt_release(struct rpc_task *task)
xprt_free_bc_request(req);
}
-/**
- * xprt_create_transport - create an RPC transport
- * @args: rpc transport creation arguments
- *
- */
-struct rpc_xprt *xprt_create_transport(struct xprt_create *args)
+static void xprt_init(struct rpc_xprt *xprt)
{
- struct rpc_xprt *xprt;
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->reserve_lock);
@@ -1156,6 +1127,42 @@ found:
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,
xprt->max_reqs);
return xprt;