Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nfsd: fi_delegees doesn't need to be an atomic_t

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>

authored by

Jeff Layton and committed by
J. Bruce Fields
67db1034 49a068f8

+5 -5
+4 -4
fs/nfsd/nfs4state.c
··· 688 688 struct file *filp = NULL; 689 689 690 690 spin_lock(&fp->fi_lock); 691 - if (fp->fi_deleg_file && atomic_dec_and_test(&fp->fi_delegees)) 691 + if (fp->fi_deleg_file && --fp->fi_delegees == 0) 692 692 swap(filp, fp->fi_deleg_file); 693 693 spin_unlock(&fp->fi_lock); 694 694 ··· 3855 3855 /* Race breaker */ 3856 3856 if (fp->fi_deleg_file) { 3857 3857 status = 0; 3858 - atomic_inc(&fp->fi_delegees); 3858 + ++fp->fi_delegees; 3859 3859 hash_delegation_locked(dp, fp); 3860 3860 goto out_unlock; 3861 3861 } 3862 3862 fp->fi_deleg_file = filp; 3863 - atomic_set(&fp->fi_delegees, 1); 3863 + fp->fi_delegees = 1; 3864 3864 hash_delegation_locked(dp, fp); 3865 3865 spin_unlock(&fp->fi_lock); 3866 3866 spin_unlock(&state_lock); ··· 3901 3901 status = -EAGAIN; 3902 3902 goto out_unlock; 3903 3903 } 3904 - atomic_inc(&fp->fi_delegees); 3904 + ++fp->fi_delegees; 3905 3905 hash_delegation_locked(dp, fp); 3906 3906 status = 0; 3907 3907 out_unlock:
+1 -1
fs/nfsd/state.h
··· 493 493 atomic_t fi_access[2]; 494 494 u32 fi_share_deny; 495 495 struct file *fi_deleg_file; 496 - atomic_t fi_delegees; 496 + int fi_delegees; 497 497 struct knfsd_fh fi_fhandle; 498 498 bool fi_had_conflict; 499 499 };