nfsd: Minor cleanup of find_stateid
authorKrishna Kumar <krkumar2@in.ibm.com>
Mon, 20 Oct 2008 06:14:28 +0000 (11:44 +0530)
committerJ. Bruce Fields <bfields@citi.umich.edu>
Tue, 6 Jan 2009 16:53:45 +0000 (11:53 -0500)
Minor cleanup/rewrite of find_stateid. Compile tested.

Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
fs/nfsd/nfs4state.c

index 13e0e074dbb8154aa4cc49a45405478efe929cb7..06b89df922187fdb33d9bf64a3784ade8e53b512 100644 (file)
@@ -2435,13 +2435,13 @@ static struct list_head lockstateid_hashtbl[STATEID_HASH_SIZE];
 static struct nfs4_stateid *
 find_stateid(stateid_t *stid, int flags)
 {
-       struct nfs4_stateid *local = NULL;
+       struct nfs4_stateid *local;
        u32 st_id = stid->si_stateownerid;
        u32 f_id = stid->si_fileid;
        unsigned int hashval;
 
        dprintk("NFSD: find_stateid flags 0x%x\n",flags);
-       if ((flags & LOCK_STATE) || (flags & RD_STATE) || (flags & WR_STATE)) {
+       if (flags & (LOCK_STATE | RD_STATE | WR_STATE)) {
                hashval = stateid_hashval(st_id, f_id);
                list_for_each_entry(local, &lockstateid_hashtbl[hashval], st_hash) {
                        if ((local->st_stateid.si_stateownerid == st_id) &&
@@ -2449,7 +2449,8 @@ find_stateid(stateid_t *stid, int flags)
                                return local;
                }
        } 
-       if ((flags & OPEN_STATE) || (flags & RD_STATE) || (flags & WR_STATE)) {
+
+       if (flags & (OPEN_STATE | RD_STATE | WR_STATE)) {
                hashval = stateid_hashval(st_id, f_id);
                list_for_each_entry(local, &stateid_hashtbl[hashval], st_hash) {
                        if ((local->st_stateid.si_stateownerid == st_id) &&