From patchwork Wed Apr 2 21:06:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 14036483 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 03696C36018 for ; Wed, 2 Apr 2025 21:06:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ACFDD280006; Wed, 2 Apr 2025 17:06:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A569E280001; Wed, 2 Apr 2025 17:06:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 91D0E280005; Wed, 2 Apr 2025 17:06:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 7141D280003 for ; Wed, 2 Apr 2025 17:06:17 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 9ACBD477E1 for ; Wed, 2 Apr 2025 21:06:18 +0000 (UTC) X-FDA: 83290336836.22.168BF86 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf21.hostedemail.com (Postfix) with ESMTP id C02371C0008 for ; Wed, 2 Apr 2025 21:06:16 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=raE6Hpsr; spf=none (imf21.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=1743627977; 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=pe0Pjjm6xDZZPKUtc3KMY1jXMbHe2FmknyFtlN8EIWI=; b=kbGMBbeqdkv4yXS5qFD2H014laE1qLLBHjc7pPploFIquXH7IFdbglHlmOjTFtAg/8dtZn sp4DZDzLEUNbw99my5jnLHc58KqPUVMu1gR7i+vWm5Pjh/2tbD/b2LcMxKEiXXuBjety25 JTLILLX/ld3luQ+TRRy/EaghqMjknIg= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=raE6Hpsr; spf=none (imf21.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=1743627977; a=rsa-sha256; cv=none; b=dqeFOGKWRfzY0e00mDF++4gJ5eZWwitiuecmKv9rhupVaF0YHWFWqIgkPzsLyuiOBO+R45 uKHvRuJ8HVVSvKsJgFV6MlA2b5RFA78qill7kRv9cb8olSRB1Cmkkiv4Ozk5vLI9pugcME xxRH/T6iVHsMkpry/jLJ1XOBDDOOtPY= 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=pe0Pjjm6xDZZPKUtc3KMY1jXMbHe2FmknyFtlN8EIWI=; b=raE6HpsrueXDb9uqvPB13rISbE KJAnPg1e81yzYuuxSGT+g7ro58lEysOfYQPl+VoCHzDhvYglzXvH/MlolRyXNbvbwcxMwJgsKbALl Wb/hP2jxBEYndgJDgEwGKcs4BtDIwYh0zyO/UbcpFRf/W0crLPKqh+KZ6W+eam+JNTUFQ821m/vZQ 9ex28ont48t2jNgurc4aA59N4EM8da5J6CeC3YAY5LrEgi3z3f+spwedf+WzDBOe6BduPhcW6cm8E 5NaRUc8dEg9F+aRAKBKPDVMl/y/L91BP3TuONymRuaIwr1p80Jr3k4QmDF5ttVDSuxXVQgY8QAaSH kC/JJw7A==; Received: from willy by casper.infradead.org with local (Exim 4.98.1 #2 (Red Hat Linux)) id 1u05Hq-0000000AFqQ-410d; Wed, 02 Apr 2025 21:06:14 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , 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 Message-ID: <20250402210612.2444135-4-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-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: C02371C0008 X-Stat-Signature: yoyw9o1tpk3nbfyay4yq91sk94ibetzi X-HE-Tag: 1743627976-140278 X-HE-Meta: U2FsdGVkX181HH5z0g8830sRi/JM4aNd91QN96e2WQemFJpTTvZ6tH/Imj978NlY4PrXJM2foOICyPv7RdAWfG25hViDpMvHSrECCnbkAQp/wXTuXKE506gBGpvFpQRKpXBPmWrWLoR2oxBK6J5OvNireyRw8DjO2DD7Mex/orHfKsL+znfPdQ7RQ7tlkXCwtqDZsGoCdqvBApRtaflft0reMsPdQLRpK2xbPgW6Gqfa8SoqcNYIRdc86F2+xpd6YjCa+kvTaLAussdnpD2NnIAxiecr+ccB0zMCH/3k+RGyFYF0BDUGiwaqFM2XAzixemdtwXvZlmUrzcIm/WRCMgnAOjhN6CkIUA1BtJdD1H1KiXFh9/bvIQ4dwTdqLLmTkej5mmzLnpOCdipl1hAOvXWtkfs2fzBvyChXtsvG2EaxxRrSesHT4Wah84+yjgTfGRn0jqGrcaALP3XY0NybwfmLDD0DiROxwrMzTqh56mwbItY6MwhnjkswvFIpaBhxiQsdEp35uhWkpqBklQTOIKKiS5eSg/hllEeUaDguwpSDZ7In3RO1/rJz5+dqwAQSkFATLsag/M9PXyro/ilx6Y9abvBBL3gEGS1O6siapAzac9ArR2yfmjy3qygLIzV4kxYy7kzyGr7zEmzk67Z6iOW2B3ZjBiwUrI+qhrCXgQTw58HiMDxVi01I6qT0WvoshD4SyJ/f075HqhrGvfobVRxD0q3jLYuRH7fcuFCFvGNxJrtcfwQOPTX7dIUozHlIH6EdNtDo1yVjZFIPwQPhdPvnwRNOSFYdoMoUIEYud9s527KClJMmVH51qNDu9T3pjpMcrOgRXpka2ST6d25xTq8p3wc5yblXwxp2gcseLCYXgBYOJoB51N5O6BV/TiJGJiVLwiy7QfYQpzPOoFHK1LRxPD55+sXrUAxfw50EGMZYUXQF2TaglmNA1Om2jLHyKLecOO+qV6KRIxLONSu XenPwtHX IFFfgRKaSbW8fpt3qLWsGbr5yy+ic0hZFj+O//02zpO/Gi7raDNOg9M+UytYjCgZk9iptxY0vfRUWx5wIbPgU9G60hectIjB3SBlO4WUFn2vHiVYO5xOHr0co/pXjqkdWMn+Eqq601FIAiJSa16Y5chIyLBzUzq3N8af0kjqFxPxjE4n86hA602VFH9i8Gvps9d8woPJ7bbIAFmhqg6eCSO0BTyA2vo/o12K51fNlOk0Kv6+vR+nUYDy+qDWwbTMSnJl2d/8zXVIjwF5gxT3c0edMjkNc7UInppUt 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 hidden call to compound_head() and a use of find_subpage(). Signed-off-by: Matthew Wilcox (Oracle) --- 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; }