mirror of
https://github.com/raspberrypi/linux.git
synced 2026-01-05 10:47:34 +00:00
f2fs: Add f2fs_get_node_folio()
Change __get_node_page() to return a folio and convert back to a page in f2fs_get_node_page() and f2fs_get_node_page_ra(). 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:
committed by
Jaegeuk Kim
parent
1a58a41ccc
commit
4d417ae2bf
@@ -3700,6 +3700,7 @@ struct page *f2fs_new_inode_page(struct inode *inode);
|
||||
struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs);
|
||||
void f2fs_ra_node_page(struct f2fs_sb_info *sbi, nid_t nid);
|
||||
struct page *f2fs_get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid);
|
||||
struct folio *f2fs_get_node_folio(struct f2fs_sb_info *sbi, pgoff_t nid);
|
||||
struct page *f2fs_get_node_page_ra(struct page *parent, int start);
|
||||
int f2fs_move_node_page(struct page *node_page, int gc_type);
|
||||
void f2fs_flush_inline_data(struct f2fs_sb_info *sbi);
|
||||
|
||||
@@ -1456,7 +1456,7 @@ void f2fs_ra_node_page(struct f2fs_sb_info *sbi, nid_t nid)
|
||||
f2fs_put_page(apage, err ? 1 : 0);
|
||||
}
|
||||
|
||||
static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid,
|
||||
static struct folio *__get_node_folio(struct f2fs_sb_info *sbi, pgoff_t nid,
|
||||
struct page *parent, int start)
|
||||
{
|
||||
struct folio *folio;
|
||||
@@ -1469,7 +1469,7 @@ static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid,
|
||||
repeat:
|
||||
folio = f2fs_grab_cache_folio(NODE_MAPPING(sbi), nid, false);
|
||||
if (IS_ERR(folio))
|
||||
return ERR_CAST(folio);
|
||||
return folio;
|
||||
|
||||
err = read_node_page(&folio->page, 0);
|
||||
if (err < 0) {
|
||||
@@ -1500,7 +1500,7 @@ repeat:
|
||||
}
|
||||
page_hit:
|
||||
if (likely(nid == nid_of_node(&folio->page)))
|
||||
return &folio->page;
|
||||
return folio;
|
||||
|
||||
f2fs_warn(sbi, "inconsistent node block, nid:%lu, node_footer[nid:%u,ino:%u,ofs:%u,cpver:%llu,blkaddr:%u]",
|
||||
nid, nid_of_node(&folio->page), ino_of_node(&folio->page),
|
||||
@@ -1519,17 +1519,25 @@ out_put_err:
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
|
||||
struct folio *f2fs_get_node_folio(struct f2fs_sb_info *sbi, pgoff_t nid)
|
||||
{
|
||||
return __get_node_folio(sbi, nid, NULL, 0);
|
||||
}
|
||||
|
||||
struct page *f2fs_get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid)
|
||||
{
|
||||
return __get_node_page(sbi, nid, NULL, 0);
|
||||
struct folio *folio = __get_node_folio(sbi, nid, NULL, 0);
|
||||
|
||||
return &folio->page;
|
||||
}
|
||||
|
||||
struct page *f2fs_get_node_page_ra(struct page *parent, int start)
|
||||
{
|
||||
struct f2fs_sb_info *sbi = F2FS_P_SB(parent);
|
||||
nid_t nid = get_nid(parent, start, false);
|
||||
struct folio *folio = __get_node_folio(sbi, nid, parent, start);
|
||||
|
||||
return __get_node_page(sbi, nid, parent, start);
|
||||
return &folio->page;
|
||||
}
|
||||
|
||||
static void flush_inline_data(struct f2fs_sb_info *sbi, nid_t ino)
|
||||
|
||||
Reference in New Issue
Block a user