Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

f2fs: refactor node footer flag setting related code

This patch refactors the node footer flag setting code to simplify
redundant logic and adjust function parameters and return types. No
logical changes.

Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

authored by

Yongpeng Yang and committed by
Jaegeuk Kim
68cb1a6b 92c20989

+13 -14
+1 -1
fs/f2fs/f2fs.h
··· 3924 3924 void f2fs_init_fsync_node_info(struct f2fs_sb_info *sbi); 3925 3925 void f2fs_del_fsync_node_entry(struct f2fs_sb_info *sbi, struct folio *folio); 3926 3926 void f2fs_reset_fsync_node_info(struct f2fs_sb_info *sbi); 3927 - int f2fs_need_dentry_mark(struct f2fs_sb_info *sbi, nid_t nid); 3927 + bool f2fs_need_dentry_mark(struct f2fs_sb_info *sbi, nid_t nid); 3928 3928 bool f2fs_is_checkpointed_node(struct f2fs_sb_info *sbi, nid_t nid); 3929 3929 bool f2fs_need_inode_block_update(struct f2fs_sb_info *sbi, nid_t ino); 3930 3930 int f2fs_get_node_info(struct f2fs_sb_info *sbi, nid_t nid,
+1 -1
fs/f2fs/node.c
··· 391 391 spin_unlock_irqrestore(&sbi->fsync_node_lock, flags); 392 392 } 393 393 394 - int f2fs_need_dentry_mark(struct f2fs_sb_info *sbi, nid_t nid) 394 + bool f2fs_need_dentry_mark(struct f2fs_sb_info *sbi, nid_t nid) 395 395 { 396 396 struct f2fs_nm_info *nm_i = NM_I(sbi); 397 397 struct nat_entry *e;
+11 -12
fs/f2fs/node.h
··· 400 400 #define is_fsync_dnode(folio) is_node(folio, FSYNC_BIT_SHIFT) 401 401 #define is_dent_dnode(folio) is_node(folio, DENT_BIT_SHIFT) 402 402 403 - static inline void set_cold_node(const struct folio *folio, bool is_dir) 403 + static inline void __set_mark(const struct folio *folio, bool mark, int type) 404 404 { 405 405 struct f2fs_node *rn = F2FS_NODE(folio); 406 406 unsigned int flag = le32_to_cpu(rn->footer.flag); 407 407 408 - if (is_dir) 409 - flag &= ~BIT(COLD_BIT_SHIFT); 410 - else 411 - flag |= BIT(COLD_BIT_SHIFT); 412 - rn->footer.flag = cpu_to_le32(flag); 413 - } 414 - 415 - static inline void set_mark(struct folio *folio, int mark, int type) 416 - { 417 - struct f2fs_node *rn = F2FS_NODE(folio); 418 - unsigned int flag = le32_to_cpu(rn->footer.flag); 419 408 if (mark) 420 409 flag |= BIT(type); 421 410 else 422 411 flag &= ~BIT(type); 423 412 rn->footer.flag = cpu_to_le32(flag); 413 + } 414 + 415 + static inline void set_cold_node(const struct folio *folio, bool is_dir) 416 + { 417 + __set_mark(folio, !is_dir, COLD_BIT_SHIFT); 418 + } 419 + 420 + static inline void set_mark(struct folio *folio, bool mark, int type) 421 + { 422 + __set_mark(folio, mark, type); 424 423 425 424 #ifdef CONFIG_F2FS_CHECK_FS 426 425 f2fs_inode_chksum_set(F2FS_F_SB(folio), folio);