Commit 4f4a4f0f authored by Vishal Moola (Oracle)'s avatar Vishal Moola (Oracle) Committed by Andrew Morton

f2fs: convert last_fsync_dnode() to use filemap_get_folios_tag()

Convert to use a folio_batch instead of pagevec.  This is in preparation
for the removal of find_get_pages_range_tag().

Link: https://lkml.kernel.org/r/20230104211448.4804-16-vishal.moola@gmail.comSigned-off-by: default avatarVishal Moola (Oracle) <vishal.moola@gmail.com>
Acked-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 1cd98ee7
...@@ -1518,23 +1518,24 @@ static void flush_inline_data(struct f2fs_sb_info *sbi, nid_t ino) ...@@ -1518,23 +1518,24 @@ static void flush_inline_data(struct f2fs_sb_info *sbi, nid_t ino)
static struct page *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino) static struct page *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino)
{ {
pgoff_t index; pgoff_t index;
struct pagevec pvec; struct folio_batch fbatch;
struct page *last_page = NULL; struct page *last_page = NULL;
int nr_pages; int nr_folios;
pagevec_init(&pvec); folio_batch_init(&fbatch);
index = 0; index = 0;
while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index, while ((nr_folios = filemap_get_folios_tag(NODE_MAPPING(sbi), &index,
PAGECACHE_TAG_DIRTY))) { (pgoff_t)-1, PAGECACHE_TAG_DIRTY,
&fbatch))) {
int i; int i;
for (i = 0; i < nr_pages; i++) { for (i = 0; i < nr_folios; i++) {
struct page *page = pvec.pages[i]; struct page *page = &fbatch.folios[i]->page;
if (unlikely(f2fs_cp_error(sbi))) { if (unlikely(f2fs_cp_error(sbi))) {
f2fs_put_page(last_page, 0); f2fs_put_page(last_page, 0);
pagevec_release(&pvec); folio_batch_release(&fbatch);
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
} }
...@@ -1565,7 +1566,7 @@ static struct page *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino) ...@@ -1565,7 +1566,7 @@ static struct page *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino)
last_page = page; last_page = page;
unlock_page(page); unlock_page(page);
} }
pagevec_release(&pvec); folio_batch_release(&fbatch);
cond_resched(); cond_resched();
} }
return last_page; return last_page;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment