From patchwork Wed Apr 2 21:06:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 14036487 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67FB3C3601B for ; Wed, 2 Apr 2025 21:06:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6BA9C280007; Wed, 2 Apr 2025 17:06:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6407B280003; Wed, 2 Apr 2025 17:06:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A6DA280007; Wed, 2 Apr 2025 17:06:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 16C44280003 for ; Wed, 2 Apr 2025 17:06:20 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 4B8681407BF for ; Wed, 2 Apr 2025 21:06:21 +0000 (UTC) X-FDA: 83290336962.14.99F9B2F Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf27.hostedemail.com (Postfix) with ESMTP id A732B4000F for ; Wed, 2 Apr 2025 21:06:19 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=S1WB6wUv; spf=none (imf27.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743627979; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=m4T5LNp9+vduHggkLGzj9TeayJ79kOVaHGxfjN+fZbw=; b=bm7qqD2lCjrg78CAwVKetHBFzi2XzxoiXiywNWC+ja3GgDXzw8fT8WN4dtrM9+ViEyQT7+ DpOzMLdO4IesErVbFLcZocTusIaQKDqYuszuCUkXSwN6mbXRvmgX0XUAJMUXwBlE6VD60n b3EZ3eJShk8W0Kz3IprCv3nycyKJIyA= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=S1WB6wUv; spf=none (imf27.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743627979; a=rsa-sha256; cv=none; b=wMQ5DFWRareJdODIW+O3SR1poxHFEGhuR8FWzjNLpBhG6/BpPQD1AFNG3AhO7u/Q+oB40g sddrrKS83SQcwyEBpwfOd3I8wSjj+jax/w9I+g2nnZ7O9yeEjuvroPYgKjV+A7sN26kd5m rRT10cOwBIXFRequ8ZlKXTSSxfolESU= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=m4T5LNp9+vduHggkLGzj9TeayJ79kOVaHGxfjN+fZbw=; b=S1WB6wUvfDFoIOnVbTiCIdOdS7 Z/VKJRySCxvlDmz05MAXh6BrtyZb9211AryI9i2YT3PNl2SntCgyTdEHcLDSm/JroA0MUXA7BXr4l ZZ7d3Gm+sr8FJEfGBQ2MC0msiRrfYXSChveFCLKf5Afa8As4zecAkP+QFzgkcKxVxB0a3ILm+5Z46 0ZdDelC2V+242e51pvdhrroLLjnn7QcdfxHKe/EFVVX9DivrnFsGEapB+RpeaWWilwEzzxmNDVziH Km5tMq/f6gjc8vLmofREGkNe3Hq5Lq52gVOG/XF6slxcKKL/h3JG2dNKs2sII1VpHB/sIaausyLsU pWPG06nQ==; Received: from willy by casper.infradead.org with local (Exim 4.98.1 #2 (Red Hat Linux)) id 1u05Hr-0000000AFqS-07h1; Wed, 02 Apr 2025 21:06:15 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 4/8] iov_iter: Convert iov_iter_extract_xarray_pages() to use folios Date: Wed, 2 Apr 2025 22:06:06 +0100 Message-ID: <20250402210612.2444135-5-willy@infradead.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402210612.2444135-1-willy@infradead.org> References: <20250402210612.2444135-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: A732B4000F X-Rspamd-Server: rspam05 X-Rspam-User: X-Stat-Signature: a4dyr4hq4indngpwpok3zstk8yc9bdca X-HE-Tag: 1743627979-24918 X-HE-Meta: U2FsdGVkX1+bxlwd4WfWzm0CBVYCUGnhlDbKUQCGEdNQjNCs//5U4+Ah/Kh+cEKcgNVx2AAzwd3UTDtlozpx9rcJopL+rCZwG1Zjj1oXalxAp23o8wwqwiDOrF5j2JjAVVEwJVSujqZlLCcPnS2H0EEHmb83eQMOS6puelf0jNYxZ6qk12EBa6MjuUEtpyRHSgE/F44eRV4o2sSz86fahMJKIyyzgeozqDYQyXjVFV6pA+iyPyTITEEBrhVspj+FOxl4vIQ9hU0Gr/CIn5wIQ32gAcQ7Io5qzPLjHl+a/e7XuK1+oq6BtxZGmBJAzcX+gSzKVYd5z2xDokjHgLvoj9FO1Rp+QqwxILdOoYJYYwO/EI/agKr1cjQvCFySQRSQ7VtS5HcncVsDjHpQRn5T35LFfCYFrlOrmMWql0c+XQVc6ku6QrgB+ulZI/X+2i1pYlbnjCZtWjjN9irI+PCevPZTwz+bv823pIDPQwkhXjvSo2+QRTdSVgxlEgy7DgXcElUsyzU9UKFCOmBNpqO9jd9d/dsB9TFNWRH15nJ91FaephlhzWBTVJqNSuBAT4DsBUsD2YONZJmmI5pxfYlIcABp8DCLppcawoq13n3/P6XDPK7YIvZTyH7x6IvUs7jN/SNiSQyPN0oENb/oEovdqSZp4EYGSkxhIOe4AEDdY7JOP7DkchOnBcb3W8hcEdo/M+2Gk/Pe/yaeNJdT+spYRm6rVeBSlJXU5XpebrnopRKPoXaI9cFw5Tf+xWmykL02Fu33uoTt9lRx7mOK/G0OKdO2lePDXDMN9aGQ8rTlzNqIz0/1SgE23ToAnGCmOgoZareSO4a3o1cUfNfocKDkRK2UFxfzLU/+UUn5PLeHAO1cd6WgUhp0kn/puqtlGGjVWLqWvjyhupcNiRCp2XUHggUPNeRkRi8Tf31hk3NTQHmkZ7mohOfef6moEPOBvYY7ApsfR0bbW9n3J9JyC8F Wt3KIdz1 xOJ0oMWYbfN1JRYRpRrlpjEsfDjdqfdEuwoeUgdKX5sKV+TXTJ9395FpNF3PtD9vBiXQVrNF7hobgrNOxhzh8CeSOVVj4faI6EETBvIPJHSLhpCAa4vxfNSyGRQuCVW261Ucors36ebFv5ZzdvfnK6gEKLM66zbFG+CSwaAsCw2VfcczjCDNmUTDEc3oKF5PYHfOsfvZ5pp85bxhnnrdG1xhUjQbuuR+aGTsIqM1uSpO/bvH/28HQUyO29Al0IneMAY46x3WuttjhnJv8kpet4cSA1Ef8RDHReVBU X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: ITER_XARRAY is exclusively used with xarrays that contain folios, not pages, so extract folio pointers from it, not page pointers. Removes a use of find_subpage(). Signed-off-by: Matthew Wilcox (Oracle) --- lib/iov_iter.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 7c50691fc5bb..a56bbf71a5d6 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -1650,11 +1650,11 @@ static ssize_t iov_iter_extract_xarray_pages(struct iov_iter *i, iov_iter_extraction_t extraction_flags, size_t *offset0) { - struct page *page, **p; + struct page **p; + struct folio *folio; unsigned int nr = 0, offset; loff_t pos = i->xarray_start + i->iov_offset; - pgoff_t index = pos >> PAGE_SHIFT; - XA_STATE(xas, i->xarray, index); + XA_STATE(xas, i->xarray, pos >> PAGE_SHIFT); offset = pos & ~PAGE_MASK; *offset0 = offset; @@ -1665,17 +1665,17 @@ static ssize_t iov_iter_extract_xarray_pages(struct iov_iter *i, p = *pages; 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; } - p[nr++] = find_subpage(page, xas.xa_index); + p[nr++] = folio_file_page(folio, xas.xa_index); if (nr == maxpages) break; }