diff options
author | Jeff Layton <jlayton@redhat.com> | 2013-04-29 19:21:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 21:28:41 -0400 |
commit | 398c33aaa4edb05339fed3720847ea6a06987ff1 (patch) | |
tree | 65aff9cfacaca7731535ab9e1d4d2037cbd36ba5 /fs | |
parent | f2d9db877fdfe37b54428880429cf01f68718aad (diff) |
nfsd: convert nfs4_alloc_stid() to use idr_alloc_cyclic()
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/nfs4state.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 2e27430b9070..417c84877742 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -234,7 +234,6 @@ static struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct | |||
234 | kmem_cache *slab) | 234 | kmem_cache *slab) |
235 | { | 235 | { |
236 | struct idr *stateids = &cl->cl_stateids; | 236 | struct idr *stateids = &cl->cl_stateids; |
237 | static int min_stateid = 0; | ||
238 | struct nfs4_stid *stid; | 237 | struct nfs4_stid *stid; |
239 | int new_id; | 238 | int new_id; |
240 | 239 | ||
@@ -242,7 +241,7 @@ kmem_cache *slab) | |||
242 | if (!stid) | 241 | if (!stid) |
243 | return NULL; | 242 | return NULL; |
244 | 243 | ||
245 | new_id = idr_alloc(stateids, stid, min_stateid, 0, GFP_KERNEL); | 244 | new_id = idr_alloc_cyclic(stateids, stid, 0, 0, GFP_KERNEL); |
246 | if (new_id < 0) | 245 | if (new_id < 0) |
247 | goto out_free; | 246 | goto out_free; |
248 | stid->sc_client = cl; | 247 | stid->sc_client = cl; |
@@ -261,10 +260,6 @@ kmem_cache *slab) | |||
261 | * amount of time until an id is reused, by ensuring they always | 260 | * amount of time until an id is reused, by ensuring they always |
262 | * "increase" (mod INT_MAX): | 261 | * "increase" (mod INT_MAX): |
263 | */ | 262 | */ |
264 | |||
265 | min_stateid = new_id+1; | ||
266 | if (min_stateid == INT_MAX) | ||
267 | min_stateid = 0; | ||
268 | return stid; | 263 | return stid; |
269 | out_free: | 264 | out_free: |
270 | kfree(stid); | 265 | kfree(stid); |