From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14389C07E99 for ; Mon, 12 Jul 2021 04:06:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B7DBC60FF3 for ; Mon, 12 Jul 2021 04:06:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B7DBC60FF3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DC2716B0070; Mon, 12 Jul 2021 00:06:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D72BB6B0098; Mon, 12 Jul 2021 00:06:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C13FB6B009B; Mon, 12 Jul 2021 00:06:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0150.hostedemail.com [216.40.44.150]) by kanga.kvack.org (Postfix) with ESMTP id 94BA26B0070 for ; Mon, 12 Jul 2021 00:06:42 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id B00C722889 for ; Mon, 12 Jul 2021 04:06:41 +0000 (UTC) X-FDA: 78352599402.03.79A33E1 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf06.hostedemail.com (Postfix) with ESMTP id 6C2F9801CF9F for ; Mon, 12 Jul 2021 04:06:41 +0000 (UTC) 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=TAfWZFSMa+r6x6aF07fD4ELFNgDf4ivzI5IhsXweRRg=; b=FhJ3dVxLXGnDDYeuYSgCX/luni Yc0Ka112sn8eqIPCyqiquqE9VB6n3JpmqvxtUJvEe7zJxDBna5RasjYwI3d+fKeOuTJMT9vjEYOrZ VLHThw68DdGFWRzA0p4e+lkOt2v+sJjiwlJKStYpXYKuOqurXRIi3yg2iMGRH/5bGP35K37WgK6Mk IJckhm07H057n6PVzCLlslecyIUgG4f8iXUwwUCYCYCD7WzRtlY+N3P/ylrgn0xsbVyhEv0Nee3ZA d8jXi/n8i+NOP6jiBsGG3i3o30daqpdiYDo6XVH51Ds+yg/2eOa6e8mrCgm/fj0SFlyiRPxzj070h ghJx6HHw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2nCQ-00GquD-OC; Mon, 12 Jul 2021 04:05:57 +0000 From: "Matthew Wilcox (Oracle)" To: linux-kernel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v13 112/137] mm/filemap: Convert find_get_pages_contig to folios Date: Mon, 12 Jul 2021 04:06:36 +0100 Message-Id: <20210712030701.4000097-113-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712030701.4000097-1-willy@infradead.org> References: <20210712030701.4000097-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 6C2F9801CF9F X-Stat-Signature: 3xjujsyb8dzhs3q1icmfiwc1wzofifwf Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=FhJ3dVxL; spf=none (imf06.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-HE-Tag: 1626062801-822739 Content-Transfer-Encoding: quoted-printable 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: 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: Matthew Wilcox (Oracle) --- mm/filemap.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 3d1a8d5f595b..e9674aabfff9 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2141,36 +2141,35 @@ unsigned find_get_pages_contig(struct address_spa= ce *mapping, pgoff_t index, unsigned int nr_pages, struct page **pages) { XA_STATE(xas, &mapping->i_pages, index); - struct page *page; + struct folio *folio; unsigned int ret =3D 0; =20 if (unlikely(!nr_pages)) return 0; =20 rcu_read_lock(); - for (page =3D xas_load(&xas); page; page =3D xas_next(&xas)) { - if (xas_retry(&xas, page)) + for (folio =3D xas_load(&xas); folio; folio =3D xas_next(&xas)) { + if (xas_retry(&xas, folio)) continue; /* * If the entry has been swapped out, we can stop looking. * No current caller is looking for DAX entries. */ - if (xa_is_value(page)) + if (xa_is_value(folio)) break; =20 - if (!page_cache_get_speculative(page)) + if (!folio_try_get_rcu(folio)) goto retry; =20 - /* Has the page moved or been split? */ - if (unlikely(page !=3D xas_reload(&xas))) + if (unlikely(folio !=3D xas_reload(&xas))) goto put_page; =20 - pages[ret] =3D find_subpage(page, xas.xa_index); + pages[ret] =3D &folio->page; if (++ret =3D=3D nr_pages) break; continue; put_page: - put_page(page); + folio_put(folio); retry: xas_reset(&xas); } --=20 2.30.2