Skip to content

Commit

Permalink
btrfs: convert btree_write_cache_pages() to use filemap_get_folio_tag()
Browse files Browse the repository at this point in the history
Convert function to use folios throughout.  This is in preparation for the
removal of find_get_pages_range_tag().

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Vishal Moola (Oracle) <[email protected]>
Acked-by: David Sterba <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
VMoola authored and akpm00 committed Feb 3, 2023
1 parent acc8d85 commit 51c5cd3
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions fs/btrfs/extent_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2865,14 +2865,14 @@ int btree_write_cache_pages(struct address_space *mapping,
int ret = 0;
int done = 0;
int nr_to_write_done = 0;
struct pagevec pvec;
int nr_pages;
struct folio_batch fbatch;
unsigned int nr_folios;
pgoff_t index;
pgoff_t end; /* Inclusive */
int scanned = 0;
xa_mark_t tag;

pagevec_init(&pvec);
folio_batch_init(&fbatch);
if (wbc->range_cyclic) {
index = mapping->writeback_index; /* Start from prev offset */
end = -1;
Expand All @@ -2895,14 +2895,15 @@ int btree_write_cache_pages(struct address_space *mapping,
if (wbc->sync_mode == WB_SYNC_ALL)
tag_pages_for_writeback(mapping, index, end);
while (!done && !nr_to_write_done && (index <= end) &&
(nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, end,
tag))) {
(nr_folios = filemap_get_folios_tag(mapping, &index, end,
tag, &fbatch))) {
unsigned i;

for (i = 0; i < nr_pages; i++) {
struct page *page = pvec.pages[i];
for (i = 0; i < nr_folios; i++) {
struct folio *folio = fbatch.folios[i];

ret = submit_eb_page(page, wbc, &bio_ctrl, &eb_context);
ret = submit_eb_page(&folio->page, wbc, &bio_ctrl,
&eb_context);
if (ret == 0)
continue;
if (ret < 0) {
Expand All @@ -2917,7 +2918,7 @@ int btree_write_cache_pages(struct address_space *mapping,
*/
nr_to_write_done = wbc->nr_to_write <= 0;
}
pagevec_release(&pvec);
folio_batch_release(&fbatch);
cond_resched();
}
if (!scanned && !done) {
Expand Down

0 comments on commit 51c5cd3

Please sign in to comment.