Skip to content

Commit

Permalink
NFS: Clean up nfs4_find_state_owners_locked()
Browse files Browse the repository at this point in the history
There's no longer a need to check the so_server field in the state
owner, because nowadays the RB tree we search for state owners
contains owners for that only server.

Make nfs4_find_state_owners_locked() use the same tree searching logic
as nfs4_insert_state_owner_locked().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Chuck Lever authored and Trond Myklebust committed Jan 5, 2012
1 parent bf118a3 commit 414adf1
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions fs/nfs/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,31 +377,22 @@ nfs4_find_state_owner_locked(struct nfs_server *server, struct rpc_cred *cred)
{
struct rb_node **p = &server->state_owners.rb_node,
*parent = NULL;
struct nfs4_state_owner *sp, *res = NULL;
struct nfs4_state_owner *sp;

while (*p != NULL) {
parent = *p;
sp = rb_entry(parent, struct nfs4_state_owner, so_server_node);

if (server < sp->so_server) {
p = &parent->rb_left;
continue;
}
if (server > sp->so_server) {
p = &parent->rb_right;
continue;
}
if (cred < sp->so_cred)
p = &parent->rb_left;
else if (cred > sp->so_cred)
p = &parent->rb_right;
else {
atomic_inc(&sp->so_count);
res = sp;
break;
return sp;
}
}
return res;
return NULL;
}

static struct nfs4_state_owner *
Expand Down

0 comments on commit 414adf1

Please sign in to comment.