diff options
author | Chao Yu <chao.yu@oppo.com> | 2022-08-04 16:38:21 +0300 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2022-08-05 14:20:02 +0300 |
commit | e53f8643474a32ddfcfd04e5b22613fdd2a92a52 (patch) | |
tree | c5b6683d20c561eaf5abbd3603cd7167786d6e45 /fs/f2fs/segment.c | |
parent | bff139b49d9f70c1ac5384aac94554846aa834de (diff) | |
download | linux-e53f8643474a32ddfcfd04e5b22613fdd2a92a52.tar.xz |
f2fs: clean up f2fs_abort_atomic_write()
f2fs_abort_atomic_write() has checked whether current inode is
atomic_write one or not, it's redundant to check in its caller,
remove it for cleanup.
Signed-off-by: Chao Yu <chao.yu@oppo.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r-- | fs/f2fs/segment.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index f14c5a807312..72ce00ebcede 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -190,19 +190,20 @@ void f2fs_abort_atomic_write(struct inode *inode, bool clean) struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct f2fs_inode_info *fi = F2FS_I(inode); - if (f2fs_is_atomic_file(inode)) { - if (clean) - truncate_inode_pages_final(inode->i_mapping); - clear_inode_flag(fi->cow_inode, FI_COW_FILE); - iput(fi->cow_inode); - fi->cow_inode = NULL; - release_atomic_write_cnt(inode); - clear_inode_flag(inode, FI_ATOMIC_FILE); - - spin_lock(&sbi->inode_lock[ATOMIC_FILE]); - sbi->atomic_files--; - spin_unlock(&sbi->inode_lock[ATOMIC_FILE]); - } + if (!f2fs_is_atomic_file(inode)) + return; + + if (clean) + truncate_inode_pages_final(inode->i_mapping); + clear_inode_flag(fi->cow_inode, FI_COW_FILE); + iput(fi->cow_inode); + fi->cow_inode = NULL; + release_atomic_write_cnt(inode); + clear_inode_flag(inode, FI_ATOMIC_FILE); + + spin_lock(&sbi->inode_lock[ATOMIC_FILE]); + sbi->atomic_files--; + spin_unlock(&sbi->inode_lock[ATOMIC_FILE]); } static int __replace_atomic_write_block(struct inode *inode, pgoff_t index, |