Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp39088pxv; Wed, 14 Jul 2021 22:23:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKL/v7R2lfxycXmqCjV0m498R96RrNfbpxXJmomNuHRbw6/qle8JtXVov/ufrQV4id62iU X-Received: by 2002:a17:906:e97:: with SMTP id p23mr3059243ejf.287.1626326635186; Wed, 14 Jul 2021 22:23:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626326635; cv=none; d=google.com; s=arc-20160816; b=IXcfhk6fjWe4pJVsoxxKOHrm95PGfvfu+TnB/t8auQ019t55t053dlXwbgD/L5cY3L NRckcIGRvg2Rj4kXBRyjwNTwAenHw37wQ8vdxHBfjN42xtUa9QChy7tl8PPKqJIHl0yT fjwHFLYppjbsaNx1Im4ARY+5wfnNAS2MxGJjxMuRrSulIEBuH1KUT3FiUD28soYrzrjQ zYEYm4YEin9XGF4nkgbwQ5+JxSnW5aE5cEHqvLYRyuYp1X/D3qoPWPv/LIZt+hYH3pCd d0JQwsjUlczzzJvm766dwAi6ZEpWC3kFVK20bkCl8jgsDebTNKcUFuaXEZ1Pn0B2wacn FMdQ== 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=2kO2DGhsWpCEZQZSuKBdU48h/VIyaOm4/uZr2l+t0xI=; b=O7bTDwqv2l+5lBw3CVayPjKFZprswbTXdhdVwDwlQxeiai0m+CkkO4DrdmRzMms9qR iUn70PkqPF0QkxAL2d8OYWt3vHny+rBAW4o9TkxX8LrqkbZpgMuV/TNEDbC9MMzEGuan ygeydQWImPYhWePoOY9sXUu22OQJxvHKDS1GmZ+goQOaWsejIWe59WD5QxSxH4JhTsho WZen3Qi0oV8kdoGCp3RyO0sQ2KUtdI4G0kzhFezcAg+69ApfYKLrZPHrUxgcqzWb9y1c b3If8i/qVsD9z0m1G5JV4T5Fnas97aA2cLwK2WIYIkrqWz1udl1+vuJIN7IQLBjPNj0k mk+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=HSHshhoP; 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 s8si5554155edr.527.2021.07.14.22.23.32; Wed, 14 Jul 2021 22:23:55 -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=HSHshhoP; 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 S231718AbhGOFJ1 (ORCPT + 99 others); Thu, 15 Jul 2021 01:09:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233239AbhGOFJ0 (ORCPT ); Thu, 15 Jul 2021 01:09:26 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DBD6C06175F; Wed, 14 Jul 2021 22:06:33 -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=2kO2DGhsWpCEZQZSuKBdU48h/VIyaOm4/uZr2l+t0xI=; b=HSHshhoPypa7G76ECE/ojc5dqA KLh/vHqG9HVhsGikLecnTX4MFIv7Hnn9WCQYDjWTq2okVsZPNwyuaQPzjnpiF6j2J/va075rL9RuM AreyvSS8bkKNbAZuDs6sSrR/e3bSFfMii4BrMMt5Jmhg+yAzEXh03mzc8D09lNSQncGFni/6iWHJh ABvsfk5drBhjR46SDlRWevk5gulri/Yx6gDBTpzlc9Ro59bsv2GV7qXoFZxm8S272m4wO8QvODiPv 1XmyELguUzQjTRhQGoPbYAFwBtipeMveIwxti0aZnsoSXaJnO6SVeI7qwZ5HlqpvGYRSUTlrsUA4H oWXP50+w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3tXy-002zqN-79; Thu, 15 Jul 2021 05:04: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 v14 108/138] mm/filemap: Convert page_cache_delete to take a folio Date: Thu, 15 Jul 2021 04:36:34 +0100 Message-Id: <20210715033704.692967-109-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 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) --- mm/filemap.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 0434c5a55fec..c96febad32fc 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -120,27 +120,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); + XA_STATE(xas, &mapping->i_pages, folio->index); unsigned int 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; } @@ -222,12 +221,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, -- 2.30.2