Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp43195pxv; Wed, 14 Jul 2021 22:29:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyD9wjkJ6vrbQGf/KfJkVjX8gusJEQVFTDvzuaKHF14xT7S+5/cM4kUYyRwAKXb+Jw97Pw/ X-Received: by 2002:a02:cc4e:: with SMTP id i14mr2148458jaq.125.1626326949678; Wed, 14 Jul 2021 22:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626326949; cv=none; d=google.com; s=arc-20160816; b=jAcV9ILkQPmacHC+b21gvxzD38SyR0NayooYT2baIogurGIkEn8+j6DXEFQom015g1 H7UU+IidR6jiEs31c6Ch8/EWKVTNRKB/WUCMllPRcT23AyENLR4RV3bsu5Wt6HXKCrVY V7lCJG8kXfxwvK5JNDbtAPMry+QOXWaxEVIr/gZzVkPcP6sZF7PMIxnwpK1ZoFGio46/ HRcDFiUiXsIn0f0PtPUiW+zSkYFGjBCLZlTM6609/kdL8fyiHCVDLHuKL4cdaiEXyycS XLUpQlYdnJzLAfWUPHqp0lPAyia7XFm97XT4hAMZPmsL9bzfn9L/7tEFLOXwg8e8GD5V z4RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=A3fDsifX2HweSey8qgo1JGC+yGw4pXjaGc1TRorG4VY=; b=tzofYZymo4w+zMfVu4o8SJkkMEGFf8TbuI0jyAGhFldTxOeWjHIg9VGuCyH6/jWFyh bmCFcaoC1cNaLNeKi1HqwREGo4XDT64tHIDYF0M9/kj04zptBhQ9eQbP59WizaXCtIlc 0qCwyEl/bvhHr/4G/h0Scqxv1hOepWNNY23jK+yLGlFKvfH3Oi9JShtUNVnioiqV05+f /6FYUaKYSz8ik6iSadC/D/MITvoftxqyYUNAEXbYy7RuzJjh7DSm73CMksdCP2UhjIQT 96cMZgrVEF7mbSrKReKsMLx2O7CnbdV7JWHHsrn4BANuI6QtzuOF9121kMQBnnwOzp1f u2xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Qqtj4BqJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n20si6126081jat.115.2021.07.14.22.28.56; Wed, 14 Jul 2021 22:29:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Qqtj4BqJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239404AbhGOFTt (ORCPT + 99 others); Thu, 15 Jul 2021 01:19:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238195AbhGOFTt (ORCPT ); Thu, 15 Jul 2021 01:19:49 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D288C06175F; Wed, 14 Jul 2021 22:16:56 -0700 (PDT) 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=A3fDsifX2HweSey8qgo1JGC+yGw4pXjaGc1TRorG4VY=; b=Qqtj4BqJne5QKkrZcxxk2BWSJg dw4eOLXguP0WMWShLnQeVlZuwwIL0jK5QP1waHM7LYE5qu2M5E0B3EvsG/ZDnhpKHtljn+ZokxEAd TWTLls5w96wGkw0XQgI07Ss/ryG4icjyLjYy3lkRuKrk7XlmXmG/Y33V9rpcpGmm/3a3ifXpywStV A9l20Jlua7h9Y9ds1AxeOIB7ugMrEBJ1iOgEGidgeQRjES7x93croNfa4y12tCbM1iSEp33BWH6Ym Q8p4WQOj3Qb8RpVw8OT4qfCe1fCEkhtieJUbZjrOtRdRjj2MaRWO45PaxL8MPqecU8+zUKWroshBh 5kP1bctw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3tiR-0030St-Tr; Thu, 15 Jul 2021 05:15:50 +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 v14 122/138] mm/filemap: Use folios in next_uptodate_page Date: Thu, 15 Jul 2021 04:36:48 +0100 Message-Id: <20210715033704.692967-123-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210715033704.692967-1-willy@infradead.org> References: <20210715033704.692967-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 717b0d262306..545323a77c1c 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3105,43 +3105,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; } -- 2.30.2