]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
f2fs: Pass a folio to is_recoverable_dnode()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 8 Jul 2025 17:03:09 +0000 (18:03 +0100)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 22 Jul 2025 15:55:53 +0000 (15:55 +0000)
All callers have a folio so pass it in.  Also make the argument const
as the function does not modify it.  Removes a call to compound_head().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/f2fs.h
fs/f2fs/node.h
fs/f2fs/recovery.c

index c33ed614c01108c941548348c1fc1d49b623f794..f6a295d61d2b5ff868ce557410dcde60d86221d8 100644 (file)
@@ -2018,7 +2018,7 @@ static inline struct f2fs_sb_info *F2FS_M_SB(struct address_space *mapping)
        return F2FS_I_SB(mapping->host);
 }
 
-static inline struct f2fs_sb_info *F2FS_F_SB(struct folio *folio)
+static inline struct f2fs_sb_info *F2FS_F_SB(const struct folio *folio)
 {
        return F2FS_M_SB(folio->mapping);
 }
index a4ffb9460ee9ed046b6e4b67efb77966901ac79e..76dae4ab57d2de0de8db4411f9a8fa26fe87beae 100644 (file)
@@ -262,7 +262,7 @@ static inline unsigned int ofs_of_node(const struct page *node_page)
        return flag >> OFFSET_BIT_SHIFT;
 }
 
-static inline __u64 cpver_of_node(struct page *node_page)
+static inline __u64 cpver_of_node(const struct page *node_page)
 {
        struct f2fs_node *rn = F2FS_NODE(node_page);
        return le64_to_cpu(rn->footer.cp_ver);
@@ -313,19 +313,19 @@ static inline void fill_node_footer_blkaddr(struct page *page, block_t blkaddr)
        rn->footer.next_blkaddr = cpu_to_le32(blkaddr);
 }
 
-static inline bool is_recoverable_dnode(struct page *page)
+static inline bool is_recoverable_dnode(const struct folio *folio)
 {
-       struct f2fs_checkpoint *ckpt = F2FS_CKPT(F2FS_P_SB(page));
+       struct f2fs_checkpoint *ckpt = F2FS_CKPT(F2FS_F_SB(folio));
        __u64 cp_ver = cur_cp_version(ckpt);
 
        /* Don't care crc part, if fsck.f2fs sets it. */
        if (__is_set_ckpt_flags(ckpt, CP_NOCRC_RECOVERY_FLAG))
-               return (cp_ver << 32) == (cpver_of_node(page) << 32);
+               return (cp_ver << 32) == (cpver_of_node(&folio->page) << 32);
 
        if (__is_set_ckpt_flags(ckpt, CP_CRC_RECOVERY_FLAG))
                cp_ver |= (cur_cp_crc(ckpt) << 32);
 
-       return cp_ver == cpver_of_node(page);
+       return cp_ver == cpver_of_node(&folio->page);
 }
 
 /*
index e5cd9959c894d030d5acc6f7c3e6bf529b9de813..dac0d7189b2b33462a62295a87d47a884f20b301 100644 (file)
@@ -375,7 +375,7 @@ static int sanity_check_node_chain(struct f2fs_sb_info *sbi, block_t blkaddr,
                if (IS_ERR(folio))
                        return PTR_ERR(folio);
 
-               if (!is_recoverable_dnode(&folio->page)) {
+               if (!is_recoverable_dnode(folio)) {
                        f2fs_folio_put(folio, true);
                        *is_detecting = false;
                        return 0;
@@ -424,7 +424,7 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head,
                        break;
                }
 
-               if (!is_recoverable_dnode(&folio->page)) {
+               if (!is_recoverable_dnode(folio)) {
                        f2fs_folio_put(folio, true);
                        break;
                }
@@ -806,7 +806,7 @@ static int recover_data(struct f2fs_sb_info *sbi, struct list_head *inode_list,
                        break;
                }
 
-               if (!is_recoverable_dnode(&folio->page)) {
+               if (!is_recoverable_dnode(folio)) {
                        f2fs_folio_put(folio, true);
                        break;
                }