summaryrefslogtreecommitdiff
path: root/fs/f2fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2021-12-04 09:55:35 -0800
committerJaegeuk Kim <jaegeuk@kernel.org>2021-12-10 15:48:32 -0800
commit766c663933bec1068a6041f05bf31d39606bc2e8 (patch)
treef6f7dad898eb877c4d832bd659ff15a2d407d59d /fs/f2fs
parentae2e2804caa120af188b0d7b08936c7ac5c7d8fe (diff)
downloadlwn-766c663933bec1068a6041f05bf31d39606bc2e8.tar.gz
lwn-766c663933bec1068a6041f05bf31d39606bc2e8.zip
f2fs: avoid duplicate call of mark_inode_dirty
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>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/f2fs.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index ac6dda6c4c5a..cbc73bd71dad 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -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);
}