From patchwork Wed Dec 8 04:22:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 12663865 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 C6239C433F5 for ; Wed, 8 Dec 2021 07:53:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 24F5B6B0071; Wed, 8 Dec 2021 02:53:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FF686B0073; Wed, 8 Dec 2021 02:53:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A0D96B0074; Wed, 8 Dec 2021 02:53:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay036.a.hostedemail.com [64.99.140.36]) by kanga.kvack.org (Postfix) with ESMTP id EB5BF6B0071 for ; Wed, 8 Dec 2021 02:53:35 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 5697360184 for ; Wed, 8 Dec 2021 04:23:15 +0000 (UTC) X-FDA: 78893332350.23.BF0D943 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf20.hostedemail.com (Postfix) with ESMTP id F161DD0000A6 for ; Wed, 8 Dec 2021 04:23:11 +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=rF8B5Bv6xTxudXTmrHELyzSGUCagkpzrcf/781BtVxg=; b=WC2Sw82qHt3NL9eKhvdbIcJ7jZ VkibfBA7ok4kr0WMAK06JK0P1a2F8FqP19vz3guLQBJUB1RWoiyI6lRNPfLfXXMxNmE9/0c+qUDyQ S7vW5ke/npS6XKfy9zpubgmniy69pd/3IRAviL6y1q27zJgGdVpFggZkhUc8l2ak1WtJ80ybjtUS0 2Z4tUgVFWzIgIRH917dlx6/G3OyAvoOJqkW9Bj1fe5RpduWzkcwD71I/RJG+nIaJga8RtPgyqmdw4 6RCfB4FFrZCmojNhNFzY2PCm+mxalOacqoUdLltDCVc1IWG+QmfAnNexZg0VOH1vTwsmfhnW50Jqw UrIXsEXw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1muoU2-0084XQ-KT; Wed, 08 Dec 2021 04:23:10 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 10/48] filemap: Convert page_cache_delete to take a folio Date: Wed, 8 Dec 2021 04:22:18 +0000 Message-Id: <20211208042256.1923824-11-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-Queue-Id: F161DD0000A6 Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=WC2Sw82q; spf=none (imf20.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-Rspamd-Server: rspam04 X-Stat-Signature: bq4ekh3cjaij74a3wq5f535dm68h4art X-HE-Tag: 1638937391-469903 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: It was already assuming a head page, so this is a straightforward conversion. Convert the one caller to call page_folio(), even though it must currently be passing in a head page. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- mm/filemap.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 5dd3c6e39c9f..38fb26e16b85 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -121,27 +121,26 @@ */ static void page_cache_delete(struct address_space *mapping, - struct page *page, void *shadow) + struct folio *folio, void *shadow) { - XA_STATE(xas, &mapping->i_pages, page->index); - unsigned int nr = 1; + XA_STATE(xas, &mapping->i_pages, folio->index); + long nr = 1; mapping_set_update(&xas, mapping); /* hugetlb pages are represented by a single entry in the xarray */ - if (!PageHuge(page)) { - xas_set_order(&xas, page->index, compound_order(page)); - nr = compound_nr(page); + if (!folio_test_hugetlb(folio)) { + xas_set_order(&xas, folio->index, folio_order(folio)); + nr = folio_nr_pages(folio); } - VM_BUG_ON_PAGE(!PageLocked(page), page); - VM_BUG_ON_PAGE(PageTail(page), page); - VM_BUG_ON_PAGE(nr != 1 && shadow, page); + VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); + VM_BUG_ON_FOLIO(nr != 1 && shadow, folio); xas_store(&xas, shadow); xas_init_marks(&xas); - page->mapping = NULL; + folio->mapping = NULL; /* Leave page->index set: truncation lookup relies upon it */ mapping->nrpages -= nr; } @@ -223,12 +222,13 @@ static void unaccount_page_cache_page(struct address_space *mapping, */ void __delete_from_page_cache(struct page *page, void *shadow) { + struct folio *folio = page_folio(page); struct address_space *mapping = page->mapping; trace_mm_filemap_delete_from_page_cache(page); unaccount_page_cache_page(mapping, page); - page_cache_delete(mapping, page, shadow); + page_cache_delete(mapping, folio, shadow); } static void page_cache_free_page(struct address_space *mapping,