summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorNikitas Angelinas <nikitas.angelinas@gmail.com>2019-11-03 01:44:54 -0800
committerJan Kara <jack@suse.cz>2019-11-05 12:25:22 +0100
commita9913d7eafa74eb2e34e26aa31fe80449b999f8e (patch)
tree28eae996cef05661779271202762c903e3be8c36 /fs
parente705f4b8aa27a59f8933e8f384e9752f052c469c (diff)
reiserfs: replace open-coded atomic_dec_and_mutex_lock()
Replace the open-coded logic of atomic_dec_and_mutex_lock() in reiserfs_file_release(). Link: https://lore.kernel.org/r/20191103094431.GA18576-nikitas.angelinas@gmail.com Signed-off-by: Nikitas Angelinas <nikitas.angelinas@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r--fs/reiserfs/file.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index 843aadcc123c..84cf8bdbec9c 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -38,16 +38,10 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
BUG_ON(!S_ISREG(inode->i_mode));
- if (atomic_add_unless(&REISERFS_I(inode)->openers, -1, 1))
+ if (!atomic_dec_and_mutex_lock(&REISERFS_I(inode)->openers,
+ &REISERFS_I(inode)->tailpack))
return 0;
- mutex_lock(&REISERFS_I(inode)->tailpack);
-
- if (!atomic_dec_and_test(&REISERFS_I(inode)->openers)) {
- mutex_unlock(&REISERFS_I(inode)->tailpack);
- return 0;
- }
-
/* fast out for when nothing needs to be done */
if ((!(REISERFS_I(inode)->i_flags & i_pack_on_close_mask) ||
!tail_has_to_be_packed(inode)) &&