From patchwork Wed Dec 8 04:22:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12663641 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 02234C433EF for ; Wed, 8 Dec 2021 06:17:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 929FE6B0073; Wed, 8 Dec 2021 01:16:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8B3416B0074; Wed, 8 Dec 2021 01:16:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 77B066B0075; Wed, 8 Dec 2021 01:16:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay031.a.hostedemail.com [64.99.140.31]) by kanga.kvack.org (Postfix) with ESMTP id 69B986B0073 for ; Wed, 8 Dec 2021 01:16:58 -0500 (EST) Received: by unirelay06.hostedemail.com (Postfix, from userid 108) id AEB462057A; Wed, 8 Dec 2021 06:15:03 +0000 (UTC) Received: by unirelay06.hostedemail.com (Postfix, from userid 108) id 5C50A20E8A; Wed, 8 Dec 2021 05:33:12 +0000 (UTC) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E98502127F for ; Wed, 8 Dec 2021 04:28:54 +0000 (UTC) X-FDA: 78893346588.23.BF4A073 Received: from relay.hostedemail.com (relay032.a.hostedemail.com [64.99.140.32]) by imf29.hostedemail.com (Postfix) with ESMTP id 851F39000249 for ; Wed, 8 Dec 2021 04:28:54 +0000 (UTC) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 875B6801B1 for ; Wed, 8 Dec 2021 04:23:16 +0000 (UTC) X-FDA: 78893332392.09.72DA62A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf13.hostedemail.com (Postfix) with ESMTP id 023781044ABA for ; Wed, 8 Dec 2021 04:23:15 +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=vspXQFsQkYxygqyTSBfIIKIkyYP21RM2Z3OtZtUgtKM=; b=Mf+AtuGjXHj7NKgO8YT6qB47HB 47WlsT2Vtws44d24pLEmegarURySLywiq+9j2LDZzsZ2BRJyFL79jKRmAzs5Z02guqjY1sbFy0Yj3 YPjjLBXANKhoJ7qV/a8+lOGw5qUAWMj551aBNnXRuhiMBzSQhvz4xHPxF8ykr8jG3m11d5C4gSeoi vPdp9d9BcM9Y0WjnJFZ56dJk79xr9Tm5a4jRXxmh95Sp7fpseiH72UmvST29p6DdnuNIn4TnsuvTb whUewrpLIfqx+zKIdf3IosKmbpPpc/0hL8Ub+kXvpuq2672ykfYvUFo08ry7FjCg98gI1RORt1B2V CeLXouOg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1muoU5-0084ZW-4F; Wed, 08 Dec 2021 04:23:13 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 28/48] filemap: Use folios in next_uptodate_page Date: Wed, 8 Dec 2021 04:22:36 +0000 Message-Id: <20211208042256.1923824-29-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211208042256.1923824-1-willy@infradead.org> References: <20211208042256.1923824-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 851F39000249 X-Stat-Signature: 5bzdadmezkdudoujbhzkuatjafwxh6nf X-HE-Tag-Orig: 1638937395-722355 Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Mf+AtuGj; spf=none (imf29.hostedemail.com: domain of FILTER%willy@infradead.org has no SPF policy when checking 64.99.140.32) smtp.mailfrom=FILTER%willy@infradead.org; dmarc=none X-HE-Tag: 1638937734-390201 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: This saves 105 bytes of text. Signed-off-by: Matthew Wilcox (Oracle) --- mm/filemap.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 3ea81adbabd8..47880ec789f4 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3227,43 +3227,43 @@ static bool filemap_map_pmd(struct vm_fault *vmf, struct page *page) return false; } -static struct page *next_uptodate_page(struct page *page, +static struct page *next_uptodate_page(struct folio *folio, struct address_space *mapping, struct xa_state *xas, pgoff_t end_pgoff) { unsigned long max_idx; do { - if (!page) + if (!folio) return NULL; - if (xas_retry(xas, page)) + if (xas_retry(xas, folio)) continue; - if (xa_is_value(page)) + if (xa_is_value(folio)) continue; - if (PageLocked(page)) + if (folio_test_locked(folio)) continue; - if (!page_cache_get_speculative(page)) + if (!folio_try_get_rcu(folio)) continue; /* Has the page moved or been split? */ - if (unlikely(page != xas_reload(xas))) + if (unlikely(folio != xas_reload(xas))) goto skip; - if (!PageUptodate(page) || PageReadahead(page)) + if (!folio_test_uptodate(folio) || folio_test_readahead(folio)) goto skip; - if (!trylock_page(page)) + if (!folio_trylock(folio)) goto skip; - if (page->mapping != mapping) + if (folio->mapping != mapping) goto unlock; - if (!PageUptodate(page)) + if (!folio_test_uptodate(folio)) goto unlock; max_idx = DIV_ROUND_UP(i_size_read(mapping->host), PAGE_SIZE); if (xas->xa_index >= max_idx) goto unlock; - return page; + return &folio->page; unlock: - unlock_page(page); + folio_unlock(folio); skip: - put_page(page); - } while ((page = xas_next_entry(xas, end_pgoff)) != NULL); + folio_put(folio); + } while ((folio = xas_next_entry(xas, end_pgoff)) != NULL); return NULL; }