Skip to content

Commit

Permalink
f2fs: avoid duplicate call of mark_inode_dirty
Browse files Browse the repository at this point in the history
Let's check the condition first before set|clear bit.

Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  • Loading branch information
Jaegeuk Kim committed Dec 10, 2021
1 parent ae2e280 commit 766c663
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/f2fs/f2fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -3115,12 +3115,16 @@ static inline int is_file(struct inode *inode, int type)

static inline void set_file(struct inode *inode, int type)
{
if (is_file(inode, type))
return;
F2FS_I(inode)->i_advise |= type;
f2fs_mark_inode_dirty_sync(inode, true);
}

static inline void clear_file(struct inode *inode, int type)
{
if (!is_file(inode, type))
return;
F2FS_I(inode)->i_advise &= ~type;
f2fs_mark_inode_dirty_sync(inode, true);
}
Expand Down

0 comments on commit 766c663

Please sign in to comment.