Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2642369pxv; Sun, 11 Jul 2021 21:12:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYkQhcF31axNv++QMBmSbNvfzZvT6Okf5DpHIo8GJVHX9XkyReLE8qTb2ygSdpVlw0JPoj X-Received: by 2002:a05:6402:d4c:: with SMTP id ec12mr6861293edb.246.1626063130395; Sun, 11 Jul 2021 21:12:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626063130; cv=none; d=google.com; s=arc-20160816; b=N3+zirD4nd3jZQigtHiW8NRf1jjCe1kb6GNpLeXW3abSICq/XxgDZSDyCLDK8eJshe WhiN75cUYZ9vKzs0PmdwQFN/ocQ+QenApMQY2GEQ1ifDEyRCXD09Fu/Mq9mm1ff4rLUr WNslOpzBoKGdI0asJN8HsX/mP7FK8WDxpxCrWP7hC8+pDB4ow16U1IpkQCWrOjrbBt1D yRho6LuAesk5wamesCedcpJGBzGA/zw66b9MpIjhAk7cHhtwvrqJv6rcvnt9r9PlOqUZ 3FNNZHHaRqN3/84dI/pZDHn/kHjNFvBqHLEVRjl58Yh8ZpAaF/sss3juCpbHLjOmSU3T 2fHg== 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=Q7TwLHeSyF6+eG63lskCvQJuWKct+HxA/LZcak9lgZg=; b=MVUAzM1blO+B9PA0DKmXHsK3xShgIfQcRZKarp4N5aQQfLEEqyhVbkRy/NMKYHeMs1 VfRh+PsRlhCptquznW9wXbI+pE6D0ipt9s/P3FrK7xpB1QHeriBuGNXljNNbaoKC6RQK epAB3PPtenxFcxerXvX6CGJqxEWOXiHeqkE3ORDdbElfdW6ko+kKR9wT+juLRkNhJ1kv TkYVKwn7KfTHVzeptSZfKowSkipvBeN307Xxs1pR8dUHOW7Jtwk3+Qo3/35M4jIB5NOX ha9YIsJC4GwAZ47ky4UDus9XrqGbqv+fYtM5w0ypQCmWSjrdJNOUOvXDIIMmzHFIJ/Yc PEyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=A0vaY9sz; 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 24si16262260ejw.232.2021.07.11.21.11.46; Sun, 11 Jul 2021 21:12:10 -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=A0vaY9sz; 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 S231514AbhGLENP (ORCPT + 99 others); Mon, 12 Jul 2021 00:13:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbhGLENP (ORCPT ); Mon, 12 Jul 2021 00:13:15 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE6E7C0613DD; Sun, 11 Jul 2021 21:10:27 -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=Q7TwLHeSyF6+eG63lskCvQJuWKct+HxA/LZcak9lgZg=; b=A0vaY9sz3vgitFbK8gjQHlT3oN 4TBp6QbvotVmN2c5DCSUKaWpEWJ8Twoc0U9tWtBrwUlrDu58NuKlS+GfJ+3fnP5fpc+UrA6QE0nCl jjzlcH6oMNDScR9smywesaUig/u0Cvp8wjiQ20aLBEucYUOhHXmKH9QpNgnaKg/tBdHDAxoazZpZU t2cUX96/UbJZ0wNWcfdivaSrEeuTOpq/wG2qS+bMnGqO4a4Yy0o+NEqsGWUKJdhej0C0WYHoG9vKr daZ+IlxnwkSTIfnewKbuiLy/uvUYzb70MsQ2tGjee15DpskcnlDM3K6UqlGw6MkveIV/m4yzF//Ha 7m0Pk3vg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2nG0-00GrD8-By; Mon, 12 Jul 2021 04:09:32 +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 v13 119/137] mm/filemap: Convert page_cache_delete_batch to folios Date: Mon, 12 Jul 2021 04:06:43 +0100 Message-Id: <20210712030701.4000097-120-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712030701.4000097-1-willy@infradead.org> References: <20210712030701.4000097-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Saves one call to compound_head() and reduces text size by 15 bytes. Signed-off-by: Matthew Wilcox (Oracle) --- mm/filemap.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 6700fbd9e8f6..9da9bac99ecd 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -287,15 +287,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 @@ -304,16 +304,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_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 */ /* @@ -321,7 +321,8 @@ 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++; -- 2.30.2