filemap: Convert find_get_pages_contig to folios

None of the callers of find_get_pages_contig() want tail pages.  They all
use order-0 pages today, but if they were converted, they'd want folios.
So just remove the call to find_subpage() instead of replacing it with
folio_page().
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarWilliam Kucharski <william.kucharski@oracle.com>
parent bdb72932
...@@ -2208,36 +2208,35 @@ unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t index, ...@@ -2208,36 +2208,35 @@ unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t index,
unsigned int nr_pages, struct page **pages) unsigned int nr_pages, struct page **pages)
{ {
XA_STATE(xas, &mapping->i_pages, index); XA_STATE(xas, &mapping->i_pages, index);
struct page *page; struct folio *folio;
unsigned int ret = 0; unsigned int ret = 0;
if (unlikely(!nr_pages)) if (unlikely(!nr_pages))
return 0; return 0;
rcu_read_lock(); rcu_read_lock();
for (page = xas_load(&xas); page; page = xas_next(&xas)) { for (folio = xas_load(&xas); folio; folio = xas_next(&xas)) {
if (xas_retry(&xas, page)) if (xas_retry(&xas, folio))
continue; continue;
/* /*
* If the entry has been swapped out, we can stop looking. * If the entry has been swapped out, we can stop looking.
* No current caller is looking for DAX entries. * No current caller is looking for DAX entries.
*/ */
if (xa_is_value(page)) if (xa_is_value(folio))
break; break;
if (!page_cache_get_speculative(page)) if (!folio_try_get_rcu(folio))
goto retry; goto retry;
/* Has the page moved or been split? */ if (unlikely(folio != xas_reload(&xas)))
if (unlikely(page != xas_reload(&xas)))
goto put_page; goto put_page;
pages[ret] = find_subpage(page, xas.xa_index); pages[ret] = &folio->page;
if (++ret == nr_pages) if (++ret == nr_pages)
break; break;
continue; continue;
put_page: put_page:
put_page(page); folio_put(folio);
retry: retry:
xas_reset(&xas); xas_reset(&xas);
} }
......
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