Merge tag 'random-6.1-rc1-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-block.git] / net / sunrpc / xprt.c
index 9407007f47aee35b23dbb65b29373a7cffdc92ee..656cec2083718580f9060e9a370e88b95e5c4b4d 100644 (file)
@@ -1788,7 +1788,7 @@ static int xprt_alloc_id(struct rpc_xprt *xprt)
 {
        int id;
 
-       id = ida_simple_get(&rpc_xprt_ids, 0, 0, GFP_KERNEL);
+       id = ida_alloc(&rpc_xprt_ids, GFP_KERNEL);
        if (id < 0)
                return id;
 
@@ -1798,7 +1798,7 @@ static int xprt_alloc_id(struct rpc_xprt *xprt)
 
 static void xprt_free_id(struct rpc_xprt *xprt)
 {
-       ida_simple_remove(&rpc_xprt_ids, xprt->id);
+       ida_free(&rpc_xprt_ids, xprt->id);
 }
 
 struct rpc_xprt *xprt_alloc(struct net *net, size_t size,
@@ -1822,10 +1822,7 @@ struct rpc_xprt *xprt_alloc(struct net *net, size_t size,
                        goto out_free;
                list_add(&req->rq_list, &xprt->free);
        }
-       if (max_alloc > num_prealloc)
-               xprt->max_reqs = max_alloc;
-       else
-               xprt->max_reqs = num_prealloc;
+       xprt->max_reqs = max_t(unsigned int, max_alloc, num_prealloc);
        xprt->min_reqs = num_prealloc;
        xprt->num_reqs = num_prealloc;