summaryrefslogtreecommitdiff
path: root/fs/nilfs2/page.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-06-05 16:44:53 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2022-06-05 16:44:53 -0400
commit5d370ea0a95804da1d533cc806040f78b0a6f297 (patch)
treeea333d8344734f33d79cbcf8d4e7049c655b93a4 /fs/nilfs2/page.c
parent6fc5ba99ee0db14f86d99db929210e21b68b9ab2 (diff)
filemap: for_each_folio_batched()folio_iter_batched
This adds a cleaner interface around iterating over folios with batched lookup, and a new iterator type (folio_iter_batched), and converts most users of filemap_get_folios() to the new interface. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/nilfs2/page.c')
-rw-r--r--fs/nilfs2/page.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c
index 3267e96c256c..d7dc8eeb44d8 100644
--- a/fs/nilfs2/page.c
+++ b/fs/nilfs2/page.c
@@ -294,18 +294,10 @@ repeat:
void nilfs_copy_back_pages(struct address_space *dmap,
struct address_space *smap)
{
- struct folio_batch fbatch;
- unsigned int i, n;
- pgoff_t start = 0;
+ struct folio_iter_batched iter;
+ struct folio *folio, *dfolio;
- folio_batch_init(&fbatch);
-repeat:
- n = filemap_get_folios(smap, &start, ~0UL, &fbatch);
- if (!n)
- return;
-
- for (i = 0; i < folio_batch_count(&fbatch); i++) {
- struct folio *folio = fbatch.folios[i], *dfolio;
+ for_each_folio_batched(smap, iter, 0, ~0UL, folio) {
pgoff_t index = folio->index;
folio_lock(folio);
@@ -344,10 +336,7 @@ repeat:
}
folio_unlock(folio);
}
- folio_batch_release(&fbatch);
- cond_resched();
-
- goto repeat;
+ folio_iter_batched_exit(&iter);
}
/**