nfsd: fi_delegees doesn't need to be an atomic_t
authorJeff Layton <jlayton@primarydata.com>
Sat, 13 Dec 2014 14:11:40 +0000 (09:11 -0500)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 7 Jan 2015 19:05:35 +0000 (14:05 -0500)
fi_delegees is always handled under the fi_lock, so there's no need to
use an atomic_t for this field.

Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4state.c
fs/nfsd/state.h

index c06a1ba80d73e5fd2cd6c68f61210e8be9518993..277f8b8529d6f5fb69112d6eb580e48b4ac95a15 100644 (file)
@@ -688,7 +688,7 @@ static void nfs4_put_deleg_lease(struct nfs4_file *fp)
        struct file *filp = NULL;
 
        spin_lock(&fp->fi_lock);
-       if (fp->fi_deleg_file && atomic_dec_and_test(&fp->fi_delegees))
+       if (fp->fi_deleg_file && --fp->fi_delegees == 0)
                swap(filp, fp->fi_deleg_file);
        spin_unlock(&fp->fi_lock);
 
@@ -3855,12 +3855,12 @@ static int nfs4_setlease(struct nfs4_delegation *dp)
        /* Race breaker */
        if (fp->fi_deleg_file) {
                status = 0;
-               atomic_inc(&fp->fi_delegees);
+               ++fp->fi_delegees;
                hash_delegation_locked(dp, fp);
                goto out_unlock;
        }
        fp->fi_deleg_file = filp;
-       atomic_set(&fp->fi_delegees, 1);
+       fp->fi_delegees = 1;
        hash_delegation_locked(dp, fp);
        spin_unlock(&fp->fi_lock);
        spin_unlock(&state_lock);
@@ -3901,7 +3901,7 @@ nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh,
                status = -EAGAIN;
                goto out_unlock;
        }
-       atomic_inc(&fp->fi_delegees);
+       ++fp->fi_delegees;
        hash_delegation_locked(dp, fp);
        status = 0;
 out_unlock:
index 9d3be371240a582b79e28677c33ae8e9fc00b24e..dab6553ceea1e898c0cb351732453cd65f2c4c13 100644 (file)
@@ -493,7 +493,7 @@ struct nfs4_file {
        atomic_t                fi_access[2];
        u32                     fi_share_deny;
        struct file             *fi_deleg_file;
-       atomic_t                fi_delegees;
+       int                     fi_delegees;
        struct knfsd_fh         fi_fhandle;
        bool                    fi_had_conflict;
 };