Commit 724e2df9 authored by Bo Liu's avatar Bo Liu Committed by Anna Schumaker

NFSv4: Directly use ida_alloc()/free()

Use ida_alloc()/ida_free() instead of
ida_simple_get()/ida_simple_remove().
The latter is deprecated and more verbose.
Signed-off-by: default avatarBo Liu <liubo03@inspur.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 9947e57b
...@@ -497,8 +497,7 @@ nfs4_alloc_state_owner(struct nfs_server *server, ...@@ -497,8 +497,7 @@ nfs4_alloc_state_owner(struct nfs_server *server,
sp = kzalloc(sizeof(*sp), gfp_flags); sp = kzalloc(sizeof(*sp), gfp_flags);
if (!sp) if (!sp)
return NULL; return NULL;
sp->so_seqid.owner_id = ida_simple_get(&server->openowner_id, 0, 0, sp->so_seqid.owner_id = ida_alloc(&server->openowner_id, gfp_flags);
gfp_flags);
if (sp->so_seqid.owner_id < 0) { if (sp->so_seqid.owner_id < 0) {
kfree(sp); kfree(sp);
return NULL; return NULL;
...@@ -534,7 +533,7 @@ static void nfs4_free_state_owner(struct nfs4_state_owner *sp) ...@@ -534,7 +533,7 @@ static void nfs4_free_state_owner(struct nfs4_state_owner *sp)
{ {
nfs4_destroy_seqid_counter(&sp->so_seqid); nfs4_destroy_seqid_counter(&sp->so_seqid);
put_cred(sp->so_cred); put_cred(sp->so_cred);
ida_simple_remove(&sp->so_server->openowner_id, sp->so_seqid.owner_id); ida_free(&sp->so_server->openowner_id, sp->so_seqid.owner_id);
kfree(sp); kfree(sp);
} }
...@@ -877,8 +876,7 @@ static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, f ...@@ -877,8 +876,7 @@ static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, f
refcount_set(&lsp->ls_count, 1); refcount_set(&lsp->ls_count, 1);
lsp->ls_state = state; lsp->ls_state = state;
lsp->ls_owner = fl_owner; lsp->ls_owner = fl_owner;
lsp->ls_seqid.owner_id = ida_simple_get(&server->lockowner_id, lsp->ls_seqid.owner_id = ida_alloc(&server->lockowner_id, GFP_KERNEL_ACCOUNT);
0, 0, GFP_KERNEL_ACCOUNT);
if (lsp->ls_seqid.owner_id < 0) if (lsp->ls_seqid.owner_id < 0)
goto out_free; goto out_free;
INIT_LIST_HEAD(&lsp->ls_locks); INIT_LIST_HEAD(&lsp->ls_locks);
...@@ -890,7 +888,7 @@ static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, f ...@@ -890,7 +888,7 @@ static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, f
void nfs4_free_lock_state(struct nfs_server *server, struct nfs4_lock_state *lsp) void nfs4_free_lock_state(struct nfs_server *server, struct nfs4_lock_state *lsp)
{ {
ida_simple_remove(&server->lockowner_id, lsp->ls_seqid.owner_id); ida_free(&server->lockowner_id, lsp->ls_seqid.owner_id);
nfs4_destroy_seqid_counter(&lsp->ls_seqid); nfs4_destroy_seqid_counter(&lsp->ls_seqid);
kfree(lsp); kfree(lsp);
} }
......
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