From patchwork Wed Dec 8 04:22:53 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: 12663645 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 15B7DC433EF for ; Wed, 8 Dec 2021 06:18:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9C6566B0078; Wed, 8 Dec 2021 01:17:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 974C56B007B; Wed, 8 Dec 2021 01:17:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 83D036B007D; Wed, 8 Dec 2021 01:17:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay040.a.hostedemail.com [64.99.140.40]) by kanga.kvack.org (Postfix) with ESMTP id 7490E6B0078 for ; Wed, 8 Dec 2021 01:17:42 -0500 (EST) Received: by unirelay02.hostedemail.com (Postfix, from userid 108) id 52AAD20E56; Wed, 8 Dec 2021 06:16:37 +0000 (UTC) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 2BFB820E7A for ; Wed, 8 Dec 2021 04:39:00 +0000 (UTC) X-FDA: 78893372040.07.349138D Received: from relay.hostedemail.com (relay026.a.hostedemail.com [64.99.140.26]) by imf03.hostedemail.com (Postfix) with ESMTP id D3F0D20004 for ; Wed, 8 Dec 2021 04:38:59 +0000 (UTC) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 4951360191 for ; Wed, 8 Dec 2021 04:23:20 +0000 (UTC) X-FDA: 78893332518.15.ABCF3BD Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf18.hostedemail.com (Postfix) with ESMTP id D2FD2400208A for ; Wed, 8 Dec 2021 04:23:19 +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=9FuAZvEtMvxjRhXYotUloBtGh5RYj0EuwlnJq5DbYZk=; b=j2TCVe3IdQvXco4UDlUZ2iSgHT 4O297skJBjiAOe+4WDlIKE0KCtnBUq6n+lTXiBEFHMefV0+VNh+v1N5m++HP73uVEaoXQV9+y7r/A Lsoa6HtmItRUBT2DKF5G+0HFXPyiQEGG4mSD1/bfh251eIqsFnR8DoYdzw9ia0BydIEHVIMiqFU+C g5NE88smItA4IfPeVRpJay9O136IWdnTaeTB1oWbKC1h/TmvjwkRA+7aXAPaQfaAlZ5r4NXeNx3Fw RDFemEoyv5yBiC23mORAbKAo+Ch1wccxs3U9ee7TbKo7NZ6b67as5jQdBa2PRZjeTkFgqqlmb4p6a CtlQI7iw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1muoU8-0084dz-3h; Wed, 08 Dec 2021 04:23:16 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 45/48] truncate: Convert invalidate_inode_pages2_range to folios Date: Wed, 8 Dec 2021 04:22:53 +0000 Message-Id: <20211208042256.1923824-46-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: D3F0D20004 X-HE-Tag-Orig: 1638937399-487121 Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=j2TCVe3I; spf=none (imf03.hostedemail.com: domain of FILTER%willy@infradead.org has no SPF policy when checking 64.99.140.26) smtp.mailfrom=FILTER%willy@infradead.org; dmarc=none X-Rspamd-Server: rspam04 X-Stat-Signature: uodx6t93frzswyupd6bghqe7wg3wugdb X-HE-Tag: 1638938339-561365 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: If we're going to unmap a folio, we have to be sure to unmap the entire folio, not just the part of it which lies after the search index. Signed-off-by: Matthew Wilcox (Oracle) --- mm/truncate.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/truncate.c b/mm/truncate.c index a1113b0abb30..2d1dae085acb 100644 --- a/mm/truncate.c +++ b/mm/truncate.c @@ -599,13 +599,13 @@ static int invalidate_complete_folio2(struct address_space *mapping, return 0; } -static int do_launder_page(struct address_space *mapping, struct page *page) +static int do_launder_folio(struct address_space *mapping, struct folio *folio) { - if (!PageDirty(page)) + if (!folio_test_dirty(folio)) return 0; - if (page->mapping != mapping || mapping->a_ops->launder_page == NULL) + if (folio->mapping != mapping || mapping->a_ops->launder_page == NULL) return 0; - return mapping->a_ops->launder_page(page); + return mapping->a_ops->launder_page(&folio->page); } /** @@ -671,7 +671,7 @@ int invalidate_inode_pages2_range(struct address_space *mapping, unmap_mapping_folio(folio); BUG_ON(folio_mapped(folio)); - ret2 = do_launder_page(mapping, &folio->page); + ret2 = do_launder_folio(mapping, folio); if (ret2 == 0) { if (!invalidate_complete_folio2(mapping, folio)) ret2 = -EBUSY;