Skip to content

Commit

Permalink
nfsd: convert nfs4_alloc_stid() to use idr_alloc_cyclic()
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Jeff Layton authored and Linus Torvalds committed Apr 30, 2013
1 parent f2d9db8 commit 398c33a
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,14 @@ static struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct
kmem_cache *slab)
{
struct idr *stateids = &cl->cl_stateids;
static int min_stateid = 0;
struct nfs4_stid *stid;
int new_id;

stid = kmem_cache_alloc(slab, GFP_KERNEL);
if (!stid)
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)
goto out_free;
stid->sc_client = cl;
Expand All @@ -261,10 +260,6 @@ kmem_cache *slab)
* amount of time until an id is reused, by ensuring they always
* "increase" (mod INT_MAX):
*/

min_stateid = new_id+1;
if (min_stateid == INT_MAX)
min_stateid = 0;
return stid;
out_free:
kfree(stid);
Expand Down

0 comments on commit 398c33a

Please sign in to comment.