unsigned int *found_pages)
{
struct cifs_writedata *wdata;
-
+ struct folio_batch fbatch;
+ unsigned int i, idx, p, nr;
wdata = cifs_writedata_alloc((unsigned int)tofind,
cifs_writev_complete);
if (!wdata)
return NULL;
- *found_pages = find_get_pages_range_tag(mapping, index, end,
- PAGECACHE_TAG_DIRTY, tofind, wdata->pages);
+ folio_batch_init(&fbatch);
+ *found_pages = 0;
+
+again:
+ nr = filemap_get_folios_tag(mapping, index, end,
+ PAGECACHE_TAG_DIRTY, &fbatch);
+ if (!nr)
+ goto out; /* No dirty pages left in the range */
+
+ for (i = 0; i < nr; i++) {
+ struct folio *folio = fbatch.folios[i];
+
+ idx = 0;
+ p = folio_nr_pages(folio);
+add_more:
+ wdata->pages[*found_pages] = folio_page(folio, idx);
+ folio_get(folio);
+ if (++*found_pages == tofind) {
+ folio_batch_release(&fbatch);
+ goto out;
+ }
+ if (++idx < p)
+ goto add_more;
+ }
+ folio_batch_release(&fbatch);
+ goto again;
+out:
return wdata;
}