mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
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>
This commit is contained in:
parent
937d6a4d2c
commit
f24f7f8cd6
3 changed files with 12 additions and 10 deletions
|
@ -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,
|
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)
|
enum node_type ntype)
|
||||||
{
|
{
|
||||||
|
struct page *page = &folio->page;
|
||||||
|
|
||||||
if (unlikely(nid != nid_of_node(page) ||
|
if (unlikely(nid != nid_of_node(page) ||
|
||||||
(ntype == NODE_TYPE_INODE && !IS_INODE(page)) ||
|
(ntype == NODE_TYPE_INODE && !IS_INODE(page)) ||
|
||||||
(ntype == NODE_TYPE_XATTR &&
|
(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]",
|
"node_footer[nid:%u,ino:%u,ofs:%u,cpver:%llu,blkaddr:%u]",
|
||||||
ntype, nid, nid_of_node(page), ino_of_node(page),
|
ntype, nid, nid_of_node(page), ino_of_node(page),
|
||||||
ofs_of_node(page), cpver_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);
|
set_sbi_flag(sbi, SBI_NEED_FSCK);
|
||||||
f2fs_handle_error(sbi, ERROR_INCONSISTENT_FOOTER);
|
f2fs_handle_error(sbi, ERROR_INCONSISTENT_FOOTER);
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
|
@ -1519,7 +1521,7 @@ repeat:
|
||||||
goto out_err;
|
goto out_err;
|
||||||
}
|
}
|
||||||
page_hit:
|
page_hit:
|
||||||
err = sanity_check_node_footer(sbi, &folio->page, nid, ntype);
|
err = sanity_check_node_footer(sbi, folio, nid, ntype);
|
||||||
if (!err)
|
if (!err)
|
||||||
return folio;
|
return folio;
|
||||||
out_err:
|
out_err:
|
||||||
|
|
|
@ -268,9 +268,9 @@ static inline __u64 cpver_of_node(struct page *node_page)
|
||||||
return le64_to_cpu(rn->footer.cp_ver);
|
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);
|
return le32_to_cpu(rn->footer.next_blkaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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,
|
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_folio_put(folio, true);
|
||||||
|
|
||||||
f2fs_ra_meta_pages_cond(sbi, *blkaddr_fast, ra_blocks);
|
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;
|
entry->last_dentry = blkaddr;
|
||||||
next:
|
next:
|
||||||
/* check next segment */
|
/* check next segment */
|
||||||
blkaddr = next_blkaddr_of_node(&folio->page);
|
blkaddr = next_blkaddr_of_node(folio);
|
||||||
f2fs_folio_put(folio, true);
|
f2fs_folio_put(folio, true);
|
||||||
|
|
||||||
err = sanity_check_node_chain(sbi, blkaddr, &blkaddr_fast,
|
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);
|
list_move_tail(&entry->list, tmp_inode_list);
|
||||||
next:
|
next:
|
||||||
ra_blocks = adjust_por_ra_blocks(sbi, ra_blocks, blkaddr,
|
ra_blocks = adjust_por_ra_blocks(sbi, ra_blocks, blkaddr,
|
||||||
next_blkaddr_of_node(&folio->page));
|
next_blkaddr_of_node(folio));
|
||||||
|
|
||||||
/* check next segment */
|
/* check next segment */
|
||||||
blkaddr = next_blkaddr_of_node(&folio->page);
|
blkaddr = next_blkaddr_of_node(folio);
|
||||||
f2fs_folio_put(folio, true);
|
f2fs_folio_put(folio, true);
|
||||||
|
|
||||||
f2fs_ra_meta_pages_cond(sbi, blkaddr, ra_blocks);
|
f2fs_ra_meta_pages_cond(sbi, blkaddr, ra_blocks);
|
||||||
|
|
Loading…
Add table
Reference in a new issue