Commit 398c33aa authored by Jeff Layton's avatar Jeff Layton Committed by Linus Torvalds

nfsd: convert nfs4_alloc_stid() to use idr_alloc_cyclic()

Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Acked-by: default avatar"J. Bruce Fields" <bfields@fieldses.org>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f2d9db87
...@@ -234,7 +234,6 @@ static struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct ...@@ -234,7 +234,6 @@ static struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct
kmem_cache *slab) kmem_cache *slab)
{ {
struct idr *stateids = &cl->cl_stateids; struct idr *stateids = &cl->cl_stateids;
static int min_stateid = 0;
struct nfs4_stid *stid; struct nfs4_stid *stid;
int new_id; int new_id;
...@@ -242,7 +241,7 @@ kmem_cache *slab) ...@@ -242,7 +241,7 @@ kmem_cache *slab)
if (!stid) if (!stid)
return NULL; return NULL;
new_id = idr_alloc(stateids, stid, min_stateid, 0, GFP_KERNEL); new_id = idr_alloc_cyclic(stateids, stid, 0, 0, GFP_KERNEL);
if (new_id < 0) if (new_id < 0)
goto out_free; goto out_free;
stid->sc_client = cl; stid->sc_client = cl;
...@@ -261,10 +260,6 @@ kmem_cache *slab) ...@@ -261,10 +260,6 @@ kmem_cache *slab)
* amount of time until an id is reused, by ensuring they always * amount of time until an id is reused, by ensuring they always
* "increase" (mod INT_MAX): * "increase" (mod INT_MAX):
*/ */
min_stateid = new_id+1;
if (min_stateid == INT_MAX)
min_stateid = 0;
return stid; return stid;
out_free: out_free:
kfree(stid); kfree(stid);
......
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