Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3445793pxb; Mon, 1 Nov 2021 14:01:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYR9tXHuFg1agfcMDbGvCd/l9JXYlsTdjlLLfiB9zmlcwjuC4q920AlanglIaAdouCKdro X-Received: by 2002:a17:907:7253:: with SMTP id ds19mr14588144ejc.476.1635800463564; Mon, 01 Nov 2021 14:01:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635800463; cv=none; d=google.com; s=arc-20160816; b=v4S+xtWsTR1q6rwS9XjwWuw32M7ljsvswcOTVrtH4EdRvsr2kLlchjAOPot9rswPcs OkewJs61WqBdkxzrCCixbPowGnkH01/l/g3r7bkfxb7et2q3K4krvt85ZD7CHet6R3wv xq3EA3yNyVhb0vZTeiCoxQ94RVk6EsjSi5SOSBV9cQKpzm12ZDQyhf0w7Db25HfCBeeE jLuSQvq0fBIdvpheLRWsOCtl8BCqni+obhpvjCmd2zrK1+PVILxgLOqObwOzR6ZNjFIl eZBewzmk3GZnZJwi6649K4WHdC9McGG65kF2Ja/QPzt3eDMLIuX66pqU2cEoOIXQz6Lb St/g== 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=gGbc9jiBTx/dWnhLSV+gSx/4RJyglUUJJRl1T18Kt1s=; b=FUL/G0Eqm08LKTy2pwTae5GLVwRKhDzLCMcZyJQd3AwEBlZs8W0xnJdQzkK4QZZSao RemCCiWjl55r2bNule2uh1lFLkXhqtDKnytUVT++CkrvUrcWjPqQFMzpJLRRLbfxH6+W p/jG+fqF004RuGpadD4nwpk5u/hYCBXVWMbINd9PZ5HTyQuoYUO0F+K5Ia2J73JDBJKW roZRww9pOOLX/fEz70cZwROdkMlD3v/QWEFfMCJ3Ok+I9lDQaSVYH7ABXbXWHPIekdUc Hj4degVSnUXdm1QX49MFjz/FcaomxHBwz6VIlNN7HYUkcPiwVw3duTlmDWYnBqTVmwmB zKcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=PtE8t6cI; 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 l16si20745562eda.406.2021.11.01.14.00.38; Mon, 01 Nov 2021 14:01:03 -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=PtE8t6cI; 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 S230451AbhKAU7f (ORCPT + 99 others); Mon, 1 Nov 2021 16:59:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbhKAU7e (ORCPT ); Mon, 1 Nov 2021 16:59:34 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2905C061714; Mon, 1 Nov 2021 13:57:00 -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=gGbc9jiBTx/dWnhLSV+gSx/4RJyglUUJJRl1T18Kt1s=; b=PtE8t6cIO2CEsZwpyQW4W5f8+u xyaQRWBMn9xi4KXOv7DE4LwqQsp9ueR+CopZpCySEGFmQs1E3Ro6k2QJkE4vsqHghxJfid/82aXcK j9fvtGlTfrNNFvUfsE2nAR4ffEyAQJ5FrnOAXJIhEFHUTsTilBbppuYSdfcqZ2Z9ZigX9y07M+uyc KxelE21s9oelQmXrHE0CEoNiMK++F+bN0ZdUDrOPUvjLFczOa6PfCScNKPeWEoMbO/nGOjky8ouKe yVFauiTe1pMSYx5sfevSndIqyx3dUBmQHsiQ45CDMHhIJA2XItQQmZDwrwAljeG9zh4qC/+qRzWEQ XY5EnW9w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mheIV-0040pd-HW; Mon, 01 Nov 2021 20:53:26 +0000 From: "Matthew Wilcox (Oracle)" To: "Darrick J. Wong" Cc: "Matthew Wilcox (Oracle)" , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe , Christoph Hellwig Subject: [PATCH 08/21] iomap: Add iomap_invalidate_folio Date: Mon, 1 Nov 2021 20:39:16 +0000 Message-Id: <20211101203929.954622-9-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211101203929.954622-1-willy@infradead.org> References: <20211101203929.954622-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Keep iomap_invalidatepage around as a wrapper for use in address_space operations. Signed-off-by: Matthew Wilcox (Oracle) --- fs/iomap/buffered-io.c | 20 ++++++++++++-------- include/linux/iomap.h | 1 + 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index a6b64a1ad468..e9a60520e769 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -468,23 +468,27 @@ iomap_releasepage(struct page *page, gfp_t gfp_mask) } EXPORT_SYMBOL_GPL(iomap_releasepage); -void -iomap_invalidatepage(struct page *page, unsigned int offset, unsigned int len) +void iomap_invalidate_folio(struct folio *folio, size_t offset, size_t len) { - struct folio *folio = page_folio(page); - - trace_iomap_invalidatepage(page->mapping->host, offset, len); + trace_iomap_invalidatepage(folio->mapping->host, offset, len); /* * If we're invalidating the entire page, clear the dirty state from it * and release it to avoid unnecessary buildup of the LRU. */ - if (offset == 0 && len == PAGE_SIZE) { - WARN_ON_ONCE(PageWriteback(page)); - cancel_dirty_page(page); + if (offset == 0 && len == folio_size(folio)) { + WARN_ON_ONCE(folio_test_writeback(folio)); + folio_cancel_dirty(folio); iomap_page_release(folio); } } +EXPORT_SYMBOL_GPL(iomap_invalidate_folio); + +void iomap_invalidatepage(struct page *page, unsigned int offset, + unsigned int len) +{ + iomap_invalidate_folio(page_folio(page), offset, len); +} EXPORT_SYMBOL_GPL(iomap_invalidatepage); #ifdef CONFIG_MIGRATION diff --git a/include/linux/iomap.h b/include/linux/iomap.h index 63f4ea4dac9b..91de58ca09fc 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -225,6 +225,7 @@ void iomap_readahead(struct readahead_control *, const struct iomap_ops *ops); int iomap_is_partially_uptodate(struct page *page, unsigned long from, unsigned long count); int iomap_releasepage(struct page *page, gfp_t gfp_mask); +void iomap_invalidate_folio(struct folio *folio, size_t offset, size_t len); void iomap_invalidatepage(struct page *page, unsigned int offset, unsigned int len); #ifdef CONFIG_MIGRATION -- 2.33.0