From patchwork Wed Dec 8 04:22:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12663627 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 6F366C433F5 for ; Wed, 8 Dec 2021 06:05:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7B4DA6B0074; Wed, 8 Dec 2021 01:05:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 763C56B0075; Wed, 8 Dec 2021 01:05:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 604C56B0078; Wed, 8 Dec 2021 01:05:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay026.a.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 4DC7C6B0074 for ; Wed, 8 Dec 2021 01:05:08 -0500 (EST) Received: by unirelay01.hostedemail.com (Postfix, from userid 108) id E3F28603FA; Wed, 8 Dec 2021 05:38:44 +0000 (UTC) Received: by unirelay01.hostedemail.com (Postfix, from userid 108) id 77C9A6056A; Wed, 8 Dec 2021 05:32:09 +0000 (UTC) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 90F206099B for ; Wed, 8 Dec 2021 04:48:40 +0000 (UTC) X-FDA: 78893396400.21.7EF9875 Received: from relay.hostedemail.com (relay025.a.hostedemail.com [64.99.140.25]) by imf10.hostedemail.com (Postfix) with ESMTP id 3E56B6001986 for ; Wed, 8 Dec 2021 04:48:40 +0000 (UTC) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 85439209F0 for ; Wed, 8 Dec 2021 04:39:00 +0000 (UTC) X-FDA: 78893371998.14.676F1EE Received: from relay.hostedemail.com (relay038.a.hostedemail.com [64.99.140.38]) by imf13.hostedemail.com (Postfix) with ESMTP id D5BFF1044801 for ; Wed, 8 Dec 2021 04:38:59 +0000 (UTC) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id B744F6019E for ; Wed, 8 Dec 2021 04:23:14 +0000 (UTC) X-FDA: 78893332308.16.86A96C0 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf09.hostedemail.com (Postfix) with ESMTP id 27E553000100 for ; Wed, 8 Dec 2021 04:23:14 +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=4GYC4zomnfMK1s3qCzsnkSCKwVtKcv5N2U8Vny3BnNo=; b=bzIJdgUxakOcUFNXYAWZgFkJnD Aa+e38cnGy1mKXDnYvsbjXuKGZI1iEb7oQcsyNa8axteOvrA1ar2xwnwN32TbWzb6SblLHuOMCmgv mkFDC/4kSsUlyGvTzQAj4mad9HBk66F2ldJ8uVeVwD+SonVClqfNrTvVX8pZge4F13EBy3UqGDp2w jrd4/Itk3EjZdx25fvtjfLETynP7hHhszqijFWPjzYIAT1JeK7cPeWdzviKEBQvLAazGWABSSH7Lc IVukBizVdatKzsIrZDqTT95EsW6pIWfnMFab+MU0acXYessKF7H7DaJ4hUlWpLn6JTJCRSMHSAl7C 2H9B+S6A==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1muoU4-0084ZK-Uy; 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 27/48] filemap: Convert page_cache_delete_batch to folios Date: Wed, 8 Dec 2021 04:22:35 +0000 Message-Id: <20211208042256.1923824-28-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-HE-Tag-Orig: 1638937394-881077 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 3E56B6001986 X-Stat-Signature: xmr6cg8w76d7ios6dh516kfp8k5oj8yj X-HE-Tag-Orig: 1638938339-132204 Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=bzIJdgUx; dmarc=none; spf=none (imf10.hostedemail.com: domain of FILTER%FILTER%willy@infradead.org has no SPF policy when checking 64.99.140.25) smtp.mailfrom=FILTER%FILTER%willy@infradead.org X-HE-Tag: 1638938920-813677 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: Saves one call to compound_head() and reduces text size by 15 bytes. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- mm/filemap.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index d191a4fd758a..3ea81adbabd8 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -290,15 +290,15 @@ static void page_cache_delete_batch(struct address_space *mapping, XA_STATE(xas, &mapping->i_pages, pvec->pages[0]->index); int total_pages = 0; int i = 0; - struct page *page; + struct folio *folio; mapping_set_update(&xas, mapping); - xas_for_each(&xas, page, ULONG_MAX) { + xas_for_each(&xas, folio, ULONG_MAX) { if (i >= pagevec_count(pvec)) break; /* A swap/dax/shadow entry got inserted? Skip it. */ - if (xa_is_value(page)) + if (xa_is_value(folio)) continue; /* * A page got inserted in our range? Skip it. We have our @@ -307,16 +307,16 @@ static void page_cache_delete_batch(struct address_space *mapping, * means our page has been removed, which shouldn't be * possible because we're holding the PageLock. */ - if (page != pvec->pages[i]) { - VM_BUG_ON_PAGE(page->index > pvec->pages[i]->index, - page); + if (&folio->page != pvec->pages[i]) { + VM_BUG_ON_FOLIO(folio->index > + pvec->pages[i]->index, folio); continue; } - WARN_ON_ONCE(!PageLocked(page)); + WARN_ON_ONCE(!folio_test_locked(folio)); - if (page->index == xas.xa_index) - page->mapping = NULL; + if (folio->index == xas.xa_index) + folio->mapping = NULL; /* Leave page->index set: truncation lookup relies on it */ /* @@ -324,7 +324,7 @@ static void page_cache_delete_batch(struct address_space *mapping, * page or the index is of the last sub-page of this compound * page. */ - if (page->index + compound_nr(page) - 1 == xas.xa_index) + if (folio->index + folio_nr_pages(folio) - 1 == xas.xa_index) i++; xas_store(&xas, NULL); total_pages++;