Commit 6817ef51 authored by Vishal Moola (Oracle)'s avatar Vishal Moola (Oracle) Committed by Andrew Morton

filemap: convert __filemap_fdatawait_range() to use filemap_get_folios_tag()

Convert function to use folios.  This is in preparation for the removal of
find_get_pages_range_tag().  This change removes 2 calls to
compound_head().

Link: https://lkml.kernel.org/r/20230104211448.4804-4-vishal.moola@gmail.comSigned-off-by: default avatarVishal Moola (Oracle) <vishal.moola@gmail.com>
Reviewed-by: default avatarMatthew Wilcow (Oracle) <willy@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 247f9e1f
...@@ -503,25 +503,27 @@ static void __filemap_fdatawait_range(struct address_space *mapping, ...@@ -503,25 +503,27 @@ static void __filemap_fdatawait_range(struct address_space *mapping,
{ {
pgoff_t index = start_byte >> PAGE_SHIFT; pgoff_t index = start_byte >> PAGE_SHIFT;
pgoff_t end = end_byte >> PAGE_SHIFT; pgoff_t end = end_byte >> PAGE_SHIFT;
struct pagevec pvec; struct folio_batch fbatch;
int nr_pages; unsigned nr_folios;
folio_batch_init(&fbatch);
pagevec_init(&pvec);
while (index <= end) { while (index <= end) {
unsigned i; unsigned i;
nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, nr_folios = filemap_get_folios_tag(mapping, &index, end,
end, PAGECACHE_TAG_WRITEBACK); PAGECACHE_TAG_WRITEBACK, &fbatch);
if (!nr_pages)
if (!nr_folios)
break; break;
for (i = 0; i < nr_pages; i++) { for (i = 0; i < nr_folios; i++) {
struct page *page = pvec.pages[i]; struct folio *folio = fbatch.folios[i];
wait_on_page_writeback(page); folio_wait_writeback(folio);
ClearPageError(page); folio_clear_error(folio);
} }
pagevec_release(&pvec); folio_batch_release(&fbatch);
cond_resched(); cond_resched();
} }
} }
......
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