diff options
Diffstat (limited to 'net/sunrpc/xprt.c')
-rw-r--r-- | net/sunrpc/xprt.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 970fb00f388c..26cbe219388b 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -962,6 +962,28 @@ static void xprt_free_slot(struct rpc_xprt *xprt, struct rpc_rqst *req) | |||
962 | spin_unlock(&xprt->reserve_lock); | 962 | spin_unlock(&xprt->reserve_lock); |
963 | } | 963 | } |
964 | 964 | ||
965 | struct rpc_xprt *xprt_alloc(int size, int max_req) | ||
966 | { | ||
967 | struct rpc_xprt *xprt; | ||
968 | |||
969 | xprt = kzalloc(size, GFP_KERNEL); | ||
970 | if (xprt == NULL) | ||
971 | goto out; | ||
972 | |||
973 | xprt->max_reqs = max_req; | ||
974 | xprt->slot = kcalloc(max_req, sizeof(struct rpc_rqst), GFP_KERNEL); | ||
975 | if (xprt->slot == NULL) | ||
976 | goto out_free; | ||
977 | |||
978 | return xprt; | ||
979 | |||
980 | out_free: | ||
981 | kfree(xprt); | ||
982 | out: | ||
983 | return NULL; | ||
984 | } | ||
985 | EXPORT_SYMBOL_GPL(xprt_alloc); | ||
986 | |||
965 | /** | 987 | /** |
966 | * xprt_reserve - allocate an RPC request slot | 988 | * xprt_reserve - allocate an RPC request slot |
967 | * @task: RPC task requesting a slot allocation | 989 | * @task: RPC task requesting a slot allocation |