ext4: Convert mpage_map_and_submit_buffers() to use filemap_get_folios()

The called functions all use pages, so just convert back to a page.
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarChristian Brauner (Microsoft) <brauner@kernel.org>
parent fb5a5be0
...@@ -2314,8 +2314,8 @@ static int mpage_process_page(struct mpage_da_data *mpd, struct page *page, ...@@ -2314,8 +2314,8 @@ static int mpage_process_page(struct mpage_da_data *mpd, struct page *page,
*/ */
static int mpage_map_and_submit_buffers(struct mpage_da_data *mpd) static int mpage_map_and_submit_buffers(struct mpage_da_data *mpd)
{ {
struct pagevec pvec; struct folio_batch fbatch;
int nr_pages, i; unsigned nr, i;
struct inode *inode = mpd->inode; struct inode *inode = mpd->inode;
int bpp_bits = PAGE_SHIFT - inode->i_blkbits; int bpp_bits = PAGE_SHIFT - inode->i_blkbits;
pgoff_t start, end; pgoff_t start, end;
...@@ -2329,14 +2329,13 @@ static int mpage_map_and_submit_buffers(struct mpage_da_data *mpd) ...@@ -2329,14 +2329,13 @@ static int mpage_map_and_submit_buffers(struct mpage_da_data *mpd)
lblk = start << bpp_bits; lblk = start << bpp_bits;
pblock = mpd->map.m_pblk; pblock = mpd->map.m_pblk;
pagevec_init(&pvec); folio_batch_init(&fbatch);
while (start <= end) { while (start <= end) {
nr_pages = pagevec_lookup_range(&pvec, inode->i_mapping, nr = filemap_get_folios(inode->i_mapping, &start, end, &fbatch);
&start, end); if (nr == 0)
if (nr_pages == 0)
break; break;
for (i = 0; i < nr_pages; i++) { for (i = 0; i < nr; i++) {
struct page *page = pvec.pages[i]; struct page *page = &fbatch.folios[i]->page;
err = mpage_process_page(mpd, page, &lblk, &pblock, err = mpage_process_page(mpd, page, &lblk, &pblock,
&map_bh); &map_bh);
...@@ -2352,14 +2351,14 @@ static int mpage_map_and_submit_buffers(struct mpage_da_data *mpd) ...@@ -2352,14 +2351,14 @@ static int mpage_map_and_submit_buffers(struct mpage_da_data *mpd)
if (err < 0) if (err < 0)
goto out; goto out;
} }
pagevec_release(&pvec); folio_batch_release(&fbatch);
} }
/* Extent fully mapped and matches with page boundary. We are done. */ /* Extent fully mapped and matches with page boundary. We are done. */
mpd->map.m_len = 0; mpd->map.m_len = 0;
mpd->map.m_flags = 0; mpd->map.m_flags = 0;
return 0; return 0;
out: out:
pagevec_release(&pvec); folio_batch_release(&fbatch);
return err; return err;
} }
......
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