mirror of
https://github.com/torvalds/linux.git
synced 2025-04-12 06:49:52 +00:00
f2fs: Use a folio throughout __get_meta_page()
Use f2fs_grab_cache_folio() to get a folio and use it throughout, removing seven calls to compound_head() and a reference to page->mapping. 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
520b17e093
commit
922e24acb4
@ -58,7 +58,7 @@ static struct page *__get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index,
|
||||
bool is_meta)
|
||||
{
|
||||
struct address_space *mapping = META_MAPPING(sbi);
|
||||
struct page *page;
|
||||
struct folio *folio;
|
||||
struct f2fs_io_info fio = {
|
||||
.sbi = sbi,
|
||||
.type = META,
|
||||
@ -74,37 +74,37 @@ static struct page *__get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index,
|
||||
if (unlikely(!is_meta))
|
||||
fio.op_flags &= ~REQ_META;
|
||||
repeat:
|
||||
page = f2fs_grab_cache_page(mapping, index, false);
|
||||
if (!page) {
|
||||
folio = f2fs_grab_cache_folio(mapping, index, false);
|
||||
if (IS_ERR(folio)) {
|
||||
cond_resched();
|
||||
goto repeat;
|
||||
}
|
||||
if (PageUptodate(page))
|
||||
if (folio_test_uptodate(folio))
|
||||
goto out;
|
||||
|
||||
fio.page = page;
|
||||
fio.page = &folio->page;
|
||||
|
||||
err = f2fs_submit_page_bio(&fio);
|
||||
if (err) {
|
||||
f2fs_put_page(page, 1);
|
||||
f2fs_folio_put(folio, true);
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
|
||||
f2fs_update_iostat(sbi, NULL, FS_META_READ_IO, F2FS_BLKSIZE);
|
||||
|
||||
lock_page(page);
|
||||
if (unlikely(page->mapping != mapping)) {
|
||||
f2fs_put_page(page, 1);
|
||||
folio_lock(folio);
|
||||
if (unlikely(folio->mapping != mapping)) {
|
||||
f2fs_folio_put(folio, true);
|
||||
goto repeat;
|
||||
}
|
||||
|
||||
if (unlikely(!PageUptodate(page))) {
|
||||
f2fs_handle_page_eio(sbi, page_folio(page), META);
|
||||
f2fs_put_page(page, 1);
|
||||
if (unlikely(!folio_test_uptodate(folio))) {
|
||||
f2fs_handle_page_eio(sbi, folio, META);
|
||||
f2fs_folio_put(folio, true);
|
||||
return ERR_PTR(-EIO);
|
||||
}
|
||||
out:
|
||||
return page;
|
||||
return &folio->page;
|
||||
}
|
||||
|
||||
struct page *f2fs_get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index)
|
||||
|
Loading…
x
Reference in New Issue
Block a user