linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH 3/8] iov_iter: Convert iter_xarray_populate_pages() to use folios
Date: Wed,  2 Apr 2025 22:06:05 +0100	[thread overview]
Message-ID: <20250402210612.2444135-4-willy@infradead.org> (raw)
In-Reply-To: <20250402210612.2444135-1-willy@infradead.org>

ITER_XARRAY is exclusively used with xarrays that contain folios,
not pages, so extract folio pointers from it, not page pointers.
Removes a hidden call to compound_head() and a use of find_subpage().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 lib/iov_iter.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 8c7fdb7d8c8f..7c50691fc5bb 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1059,22 +1059,22 @@ static ssize_t iter_xarray_populate_pages(struct page **pages, struct xarray *xa
 					  pgoff_t index, unsigned int nr_pages)
 {
 	XA_STATE(xas, xa, index);
-	struct page *page;
+	struct folio *folio;
 	unsigned int ret = 0;
 
 	rcu_read_lock();
-	for (page = xas_load(&xas); page; page = xas_next(&xas)) {
-		if (xas_retry(&xas, page))
+	for (folio = xas_load(&xas); folio; folio = xas_next(&xas)) {
+		if (xas_retry(&xas, folio))
 			continue;
 
-		/* Has the page moved or been split? */
-		if (unlikely(page != xas_reload(&xas))) {
+		/* Has the folio moved or been split? */
+		if (unlikely(folio != xas_reload(&xas))) {
 			xas_reset(&xas);
 			continue;
 		}
 
-		pages[ret] = find_subpage(page, xas.xa_index);
-		get_page(pages[ret]);
+		pages[ret] = folio_file_page(folio, xas.xa_index);
+		folio_get(folio);
 		if (++ret == nr_pages)
 			break;
 	}
-- 
2.47.2



  parent reply	other threads:[~2025-04-02 21:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-02 21:06 [PATCH 0/8] Misc folio patches for 6.16 Matthew Wilcox (Oracle)
2025-04-02 21:06 ` [PATCH 1/8] filemap: Remove readahead_page() Matthew Wilcox (Oracle)
2025-04-04 20:52   ` David Hildenbrand
2025-04-02 21:06 ` [PATCH 2/8] mm: Remove offset_in_thp() Matthew Wilcox (Oracle)
2025-04-04 20:52   ` David Hildenbrand
2025-04-02 21:06 ` Matthew Wilcox (Oracle) [this message]
2025-04-04 20:53   ` [PATCH 3/8] iov_iter: Convert iter_xarray_populate_pages() to use folios David Hildenbrand
2025-04-02 21:06 ` [PATCH 4/8] iov_iter: Convert iov_iter_extract_xarray_pages() " Matthew Wilcox (Oracle)
2025-04-04 20:56   ` David Hildenbrand
2025-04-02 21:06 ` [PATCH 5/8] filemap: Remove find_subpage() Matthew Wilcox (Oracle)
2025-04-04 20:57   ` David Hildenbrand
2025-04-02 21:06 ` [PATCH 6/8] filemap: Convert __readahead_batch() to use a folio Matthew Wilcox (Oracle)
2025-04-04 20:59   ` David Hildenbrand
2025-04-02 21:06 ` [PATCH 7/8] filemap: Remove readahead_page_batch() Matthew Wilcox (Oracle)
2025-04-04 21:00   ` David Hildenbrand
2025-04-02 21:06 ` [PATCH 8/8] mm: Delete thp_nr_pages() Matthew Wilcox (Oracle)
2025-04-04 21:00   ` David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250402210612.2444135-4-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox