summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2025-03-31 21:10:37 +0100
committerJaegeuk Kim <jaegeuk@kernel.org>2025-04-28 15:22:44 +0000
commitf24f7f8cd6e8ff21ad40677f26f8c73a7d855843 (patch)
treef23604efaa13e1f95267aa0d8730d1f374714555 /fs/f2fs
parentf2fs: Convert f2fs_get_tmp_page() to f2fs_get_tmp_folio() (diff)
downloadlinux-f24f7f8cd6e8ff21ad40677f26f8c73a7d855843.tar.gz
linux-f24f7f8cd6e8ff21ad40677f26f8c73a7d855843.zip
f2fs: Pass a folio to next_blkaddr_of_node()
Pass the folio into sanity_check_node_footer() so that we can pass it further into next_blkaddr_of_node(). Removes a lot of conversions from folio->page. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> 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/node.c8
-rw-r--r--fs/f2fs/node.h4
-rw-r--r--fs/f2fs/recovery.c10
3 files changed, 12 insertions, 10 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 3ca321fa7495..8a8d4d9d9b05 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1457,9 +1457,11 @@ void f2fs_ra_node_page(struct f2fs_sb_info *sbi, nid_t nid)
}
static int sanity_check_node_footer(struct f2fs_sb_info *sbi,
- struct page *page, pgoff_t nid,
+ struct folio *folio, pgoff_t nid,
enum node_type ntype)
{
+ struct page *page = &folio->page;
+
if (unlikely(nid != nid_of_node(page) ||
(ntype == NODE_TYPE_INODE && !IS_INODE(page)) ||
(ntype == NODE_TYPE_XATTR &&
@@ -1469,7 +1471,7 @@ static int sanity_check_node_footer(struct f2fs_sb_info *sbi,
"node_footer[nid:%u,ino:%u,ofs:%u,cpver:%llu,blkaddr:%u]",
ntype, nid, nid_of_node(page), ino_of_node(page),
ofs_of_node(page), cpver_of_node(page),
- next_blkaddr_of_node(page));
+ next_blkaddr_of_node(folio));
set_sbi_flag(sbi, SBI_NEED_FSCK);
f2fs_handle_error(sbi, ERROR_INCONSISTENT_FOOTER);
return -EFSCORRUPTED;
@@ -1519,7 +1521,7 @@ repeat:
goto out_err;
}
page_hit:
- err = sanity_check_node_footer(sbi, &folio->page, nid, ntype);
+ err = sanity_check_node_footer(sbi, folio, nid, ntype);
if (!err)
return folio;
out_err:
diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h
index 103a437e6425..c58ff16f1227 100644
--- a/fs/f2fs/node.h
+++ b/fs/f2fs/node.h
@@ -268,9 +268,9 @@ static inline __u64 cpver_of_node(struct page *node_page)
return le64_to_cpu(rn->footer.cp_ver);
}
-static inline block_t next_blkaddr_of_node(struct page *node_page)
+static inline block_t next_blkaddr_of_node(struct folio *node_folio)
{
- struct f2fs_node *rn = F2FS_NODE(node_page);
+ struct f2fs_node *rn = F2FS_NODE(&node_folio->page);
return le32_to_cpu(rn->footer.next_blkaddr);
}
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
index 9848f0516a7e..a29bd82de93b 100644
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -382,9 +382,9 @@ static int sanity_check_node_chain(struct f2fs_sb_info *sbi, block_t blkaddr,
}
ra_blocks = adjust_por_ra_blocks(sbi, ra_blocks, *blkaddr_fast,
- next_blkaddr_of_node(&folio->page));
+ next_blkaddr_of_node(folio));
- *blkaddr_fast = next_blkaddr_of_node(&folio->page);
+ *blkaddr_fast = next_blkaddr_of_node(folio);
f2fs_folio_put(folio, true);
f2fs_ra_meta_pages_cond(sbi, *blkaddr_fast, ra_blocks);
@@ -467,7 +467,7 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head,
entry->last_dentry = blkaddr;
next:
/* check next segment */
- blkaddr = next_blkaddr_of_node(&folio->page);
+ blkaddr = next_blkaddr_of_node(folio);
f2fs_folio_put(folio, true);
err = sanity_check_node_chain(sbi, blkaddr, &blkaddr_fast,
@@ -833,10 +833,10 @@ static int recover_data(struct f2fs_sb_info *sbi, struct list_head *inode_list,
list_move_tail(&entry->list, tmp_inode_list);
next:
ra_blocks = adjust_por_ra_blocks(sbi, ra_blocks, blkaddr,
- next_blkaddr_of_node(&folio->page));
+ next_blkaddr_of_node(folio));
/* check next segment */
- blkaddr = next_blkaddr_of_node(&folio->page);
+ blkaddr = next_blkaddr_of_node(folio);
f2fs_folio_put(folio, true);
f2fs_ra_meta_pages_cond(sbi, blkaddr, ra_blocks);