···16501650 pgoff_t end, unsigned int nr_pages,16511651 struct page **pages)16521652{16531653- struct radix_tree_iter iter;16541654- void **slot;16531653+ XA_STATE(xas, &mapping->i_pages, *start);16541654+ struct page *page;16551655 unsigned ret = 0;1656165616571657 if (unlikely(!nr_pages))16581658 return 0;1659165916601660 rcu_read_lock();16611661- radix_tree_for_each_slot(slot, &mapping->i_pages, &iter, *start) {16621662- struct page *head, *page;16631663-16641664- if (iter.index > end)16651665- break;16661666-repeat:16671667- page = radix_tree_deref_slot(slot);16681668- if (unlikely(!page))16611661+ xas_for_each(&xas, page, end) {16621662+ struct page *head;16631663+ if (xas_retry(&xas, page))16691664 continue;16701670-16711671- if (radix_tree_exception(page)) {16721672- if (radix_tree_deref_retry(page)) {16731673- slot = radix_tree_iter_retry(&iter);16741674- continue;16751675- }16761676- /*16771677- * A shadow entry of a recently evicted page,16781678- * or a swap entry from shmem/tmpfs. Skip16791679- * over it.16801680- */16651665+ /* Skip over shadow, swap and DAX entries */16661666+ if (xa_is_value(page))16811667 continue;16821682- }1683166816841669 head = compound_head(page);16851670 if (!page_cache_get_speculative(head))16861686- goto repeat;16711671+ goto retry;1687167216881673 /* The page was split under us? */16891689- if (compound_head(page) != head) {16901690- put_page(head);16911691- goto repeat;16921692- }16741674+ if (compound_head(page) != head)16751675+ goto put_page;1693167616941677 /* Has the page moved? */16951695- if (unlikely(page != *slot)) {16961696- put_page(head);16971697- goto repeat;16981698- }16781678+ if (unlikely(page != xas_reload(&xas)))16791679+ goto put_page;1699168017001681 pages[ret] = page;17011682 if (++ret == nr_pages) {17021702- *start = pages[ret - 1]->index + 1;16831683+ *start = page->index + 1;17031684 goto out;17041685 }16861686+ continue;16871687+put_page:16881688+ put_page(head);16891689+retry:16901690+ xas_reset(&xas);17051691 }1706169217071693 /*17081694 * We come here when there is no page beyond @end. We take care to not17091695 * overflow the index @start as it confuses some of the callers. This17101710- * breaks the iteration when there is page at index -1 but that is16961696+ * breaks the iteration when there is a page at index -1 but that is17111697 * already broken anyway.17121698 */17131699 if (end == (pgoff_t)-1)