Skip to contentSkip to conversation

f2fs: avoid duplicate call of mark_inode_dirty

PATCH In review Jaegeuk Kim 2 participants 2 messages Dec 4, 2021 – Dec 8, 2021 F2FS file system

lore
Share & tools
lore

Jaegeuk Kim

author maintainer
#0 lore raw

PATCH 1/1 f2fs: avoid duplicate call of mark_inode_dirty

Let's check the condition first before set|clear bit.

---
 fs/f2fs/f2fs.h | 4 ++++
 1 file changed, 4 insertions(+)
fs/f2fs/f2fs.h +4 -0
index ac6dda6c4c5a..cbc73bd71dad 100644
@@ -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);
 }
Signature · 1 line
2.34.1.400.ga245620fadb-goog