From patchwork Mon Jan 9 05:18:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 40667 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1984987wrt; Sun, 8 Jan 2023 21:20:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXtfgHKxgFwIdbf/rjZp3coUhwWYz33aiy3YMYZ9GxMafAQQ2IG0A1esefFGeopwlrrX3rUH X-Received: by 2002:a17:90a:4086:b0:226:27c2:829e with SMTP id l6-20020a17090a408600b0022627c2829emr40496570pjg.32.1673241601836; Sun, 08 Jan 2023 21:20:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673241601; cv=none; d=google.com; s=arc-20160816; b=BpUt8FcZNeRlK14SCv/pRjPXzVz79QFda4h6GKUgu5nKmN5nRFKe3RPd18suuZoxe7 9pV76zkmWGQ2mx1qAulE7ezqSGa1AcPs/3N52lF0L0QQx0a4nnhd8VdEPKgrZtD8QzZ8 5scv+U5Ni3BZc5OH6PJRTUDBkBXQBa8Obh3QUNtBRB5wizg8PaV6uHs7zyRX42vpJIbn E1VZpzc0v6Q6Bc4Oo4InWW/2N36Z+6AuJlGTsT4S51euzrCV0K6qX5DiYMQ4uxyqD/a2 VXfJhiYf+UiqGcyCyBuSvVLPZKVQ/GXrsQMs+lAgiDtNZoh2TTVLfR6O5ij0oEjyM3H6 sFoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=/TboxjvLj2LzaTPo6wOwSPdZqcAQLPCIOhhkOsSnAto=; b=stc+iPEZ+Ysz3NwUEEj1q/qn0uC9sEYhEDJzU4YDWgazDjdv34vc1k02H+h0voXrbg yEpzzJUVybyNUCzKzhcpwOrrvMBTQJ8mp03ggnbvnqwSMNj8OGJwCKKR7+xWPfW2IroU vXZTRkGhR0dyWIUo/pnylvZqj2MopIvMRtN+Go+jO82hTfRCPw6aIYkkSXt7iALLTnCC gkBiyeWUFPx6C77M60YsF2f2QL2bpHq/oEtc/BWoLLBjO7qyD1LHEJcqPQyclp0/gRVV owpjDJVlVFVOQKXOAwn6PEo3xdna05G6lDJRsAm0d5JyBL1ZaYiuZaKLVZ89+1oVHzpX tThQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=nb4a5StF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d7-20020a631d47000000b0044fb332e9c2si4362786pgm.560.2023.01.08.21.19.49; Sun, 08 Jan 2023 21:20:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=nb4a5StF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236502AbjAIFT0 (ORCPT + 99 others); Mon, 9 Jan 2023 00:19:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234729AbjAIFST (ORCPT ); Mon, 9 Jan 2023 00:18:19 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2C4DDEBB; Sun, 8 Jan 2023 21:18:17 -0800 (PST) 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=/TboxjvLj2LzaTPo6wOwSPdZqcAQLPCIOhhkOsSnAto=; b=nb4a5StFHAwGzV5DL8zXSWnxJw zX600UOuwgmVsgmjNFBmqtMFxS3xy8oIktPbQkH8TRK7ibTOd9FSpSh760MmC9CNX44HBqsWmi/N/ UDlCxOA7LujBoWs15c9vzwZdsHq5P+N6jwyH3KWvAvYzHO2vlJFU9V1QNqyBGQRrdrZwNcdugBvtP 3zAHtqfRrI9/eo03r3LBI3D0DlE6gp7IrVEkLzTfqFcNiqtxYLZGQs5aDUuOlcHvk31wtghpU8Omp 15oltxC23wFZYvXnu2blmo/TycCTrH3pEYJvW4N4bLOfpWYrtEf0G6ZhxHe1M6ij03Kc3FJ4BHc5S 19VIUrTA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEkYC-0020wm-NL; Mon, 09 Jan 2023 05:18:25 +0000 From: "Matthew Wilcox (Oracle)" Cc: "Matthew Wilcox (Oracle)" , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH 01/11] memory-failure: Remove comment referencing AS_EIO Date: Mon, 9 Jan 2023 05:18:13 +0000 Message-Id: <20230109051823.480289-2-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230109051823.480289-1-willy@infradead.org> References: <20230109051823.480289-1-willy@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754520986063793794?= X-GMAIL-MSGID: =?utf-8?q?1754520986063793794?= The EIO is now reported to every caller which has the file open on the next operation which returns an error. We obviously cannot check whether the user took action correctly on that error, but we can remove this comment as wb_err is never cleared, unlike AS_EIO. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- mm/memory-failure.c | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index c77a9e37e27e..1a1c66f7e5dd 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -992,34 +992,6 @@ static int me_pagecache_dirty(struct page_state *ps, struct page *p) * who check the mapping. * This way the application knows that something went * wrong with its dirty file data. - * - * There's one open issue: - * - * The EIO will be only reported on the next IO - * operation and then cleared through the IO map. - * Normally Linux has two mechanisms to pass IO error - * first through the AS_EIO flag in the address space - * and then through the PageError flag in the page. - * Since we drop pages on memory failure handling the - * only mechanism open to use is through AS_AIO. - * - * This has the disadvantage that it gets cleared on - * the first operation that returns an error, while - * the PageError bit is more sticky and only cleared - * when the page is reread or dropped. If an - * application assumes it will always get error on - * fsync, but does other operations on the fd before - * and the page is dropped between then the error - * will not be properly reported. - * - * This can already happen even without hwpoisoned - * pages: first on metadata IO errors (which only - * report through AS_EIO) or when the page is dropped - * at the wrong time. - * - * So right now we assume that the application DTRT on - * the first EIO, but we're not worse than other parts - * of the kernel. */ mapping_set_error(mapping, -EIO); } From patchwork Mon Jan 9 05:18:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 40671 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1992121wrt; Sun, 8 Jan 2023 21:50:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXsH39mmRLe57mOcYYSUi0i7Fs7xZJNugpyEk6/7yDQRXqJpJ+8qndKJ6FL249w5LA/A2IOG X-Received: by 2002:aa7:cb4b:0:b0:491:3a5c:6e5 with SMTP id w11-20020aa7cb4b000000b004913a5c06e5mr18015883edt.1.1673243439926; Sun, 08 Jan 2023 21:50:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673243439; cv=none; d=google.com; s=arc-20160816; b=fxXhP8pfNmQWMmyamKCqRUsqM51KM5REgL8/3ejqOwlLT9H+jQpYXyGaeFUgm8RVf7 etwgTnEs9DhAD4PpxiKiA5cOWU3JQbwQD4uQgXkBsg4AZPNY/e3P7wpu8AQ3u2D9cUWC lE+ETRNgv6OR+m4STbj8DtMnwfhEknhqzmA3OKpdw2g8YK90edpgJQpISEhp7Jhjgt89 655NCVKICjaMQJE3zHSTXiougrbnqW7vYoFuH4pSFXWNdPoKhAyiuYMp9Rguapny/T8/ RF+oZFslcqbx4jEceb3zDIlvALv9jTXEW3JFUurUCU6moetnuvsGXYKWvZVj3vb3QB1Q blNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=ka5+iF4ZHGa0/h4sTq7sbQGVl9e8Q3iYzmlIIaQ/sWI=; b=k5PppBLaBLnYhgtzR4CHM3ca2OQ/L+DOVoD4maSYXMCW2NagIO6ds4JDqSMY1gzl1l 6AN+2MkgRq40c33mewuN9sWFNyDlraSMmq5NKETmZRitvCL3DjEVQ3k1itptlAij9Dza hN9ajWc+sOUCnOzwvpJYYhK4w3rGnNg1G24ObAD4qCpWgT54ceG42T5rzmmXvPaALXZz 1vg2RDPdVYCXLQhK+s7xXQDmTMLtsx2ZX1NIFRyXXkA0oh6HaEor+afFfmdsV0QyrVm6 ZnNzqgTFjJUMN+eEFQvoPNrt99pUosycRG38gtJb4slOzsFE6BcMjVW14ydpGfmZjC3L nUVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b="i/qCQROx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id em8-20020a056402364800b0048ec063ea63si8411176edb.396.2023.01.08.21.50.16; Sun, 08 Jan 2023 21:50:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b="i/qCQROx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236593AbjAIFTt (ORCPT + 99 others); Mon, 9 Jan 2023 00:19:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234878AbjAIFSY (ORCPT ); Mon, 9 Jan 2023 00:18:24 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D69A6DE80; Sun, 8 Jan 2023 21:18:23 -0800 (PST) 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=ka5+iF4ZHGa0/h4sTq7sbQGVl9e8Q3iYzmlIIaQ/sWI=; b=i/qCQROxWBGYJBbp7WWwA2/Yvw Dp51Rqs4Jyu0jDo2hlrt+BgXNzbaN0GGMq7jiZbomx7g2Z1moIfQd4S26iD20Wx1lgwxVcVVLJlfB m3oJgbKQ7cxdKfhGyEArj6Pdh/Vavd0nsnL+WwFB9DYdYPvjEMdayAceV2jqlDwDfoc1bB9+8xv/W 2sD8mcl3FP9+WTM0o7s8uiBCj5KapY4EWuMdX7aB0vExNWT2/2+ku+8olFqdDnvPmw9+fspzT718R 3MzT+pW9s1EyjLZYJH8nv6yJcMkiJnMmFZLvaNPl+bbgf4FKlttTj+F+vUdAZFW0YOKrcSrFt4Nfx AQo3heCw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEkYD-0020wp-46; Mon, 09 Jan 2023 05:18:25 +0000 From: "Matthew Wilcox (Oracle)" Cc: "Matthew Wilcox (Oracle)" , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH 02/11] filemap: Remove filemap_check_and_keep_errors() Date: Mon, 9 Jan 2023 05:18:14 +0000 Message-Id: <20230109051823.480289-3-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230109051823.480289-1-willy@infradead.org> References: <20230109051823.480289-1-willy@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754522913234715418?= X-GMAIL-MSGID: =?utf-8?q?1754522913234715418?= Convert both callers to use the "new" errseq infrastructure. Signed-off-by: Matthew Wilcox (Oracle) --- mm/filemap.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index c4d4ace9cc70..48daedc224d9 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -355,16 +355,6 @@ int filemap_check_errors(struct address_space *mapping) } EXPORT_SYMBOL(filemap_check_errors); -static int filemap_check_and_keep_errors(struct address_space *mapping) -{ - /* Check for outstanding write errors */ - if (test_bit(AS_EIO, &mapping->flags)) - return -EIO; - if (test_bit(AS_ENOSPC, &mapping->flags)) - return -ENOSPC; - return 0; -} - /** * filemap_fdatawrite_wbc - start writeback on mapping dirty pages in range * @mapping: address space structure to write @@ -567,8 +557,10 @@ EXPORT_SYMBOL(filemap_fdatawait_range); int filemap_fdatawait_range_keep_errors(struct address_space *mapping, loff_t start_byte, loff_t end_byte) { + errseq_t since = filemap_sample_wb_err(mapping); + __filemap_fdatawait_range(mapping, start_byte, end_byte); - return filemap_check_and_keep_errors(mapping); + return filemap_check_wb_err(mapping, since); } EXPORT_SYMBOL(filemap_fdatawait_range_keep_errors); @@ -613,8 +605,10 @@ EXPORT_SYMBOL(file_fdatawait_range); */ int filemap_fdatawait_keep_errors(struct address_space *mapping) { + errseq_t since = filemap_sample_wb_err(mapping); + __filemap_fdatawait_range(mapping, 0, LLONG_MAX); - return filemap_check_and_keep_errors(mapping); + return filemap_check_wb_err(mapping, since); } EXPORT_SYMBOL(filemap_fdatawait_keep_errors); From patchwork Mon Jan 9 05:18:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 40668 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1985002wrt; Sun, 8 Jan 2023 21:20:07 -0800 (PST) X-Google-Smtp-Source: AMrXdXu2j3Ds0NxkVJgFzxjT1VGGzoPEhzDh6eMz7Eg1HagFWg9PfQGnFE7fHXpVVGB2vFute4so X-Received: by 2002:a62:2545:0:b0:581:fc19:4aa3 with SMTP id l66-20020a622545000000b00581fc194aa3mr36766973pfl.0.1673241606979; Sun, 08 Jan 2023 21:20:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673241606; cv=none; d=google.com; s=arc-20160816; b=yx8lGLdh66DDR6NGeLvLixl0Y6UHF2ZSPc7E+NvF86C2yUuQ6HtYYwtyda2JIyucpl JVFkSXCovYuROg7/qetwpWiBQECJTsF3aPMsQZtgg/WWWdIdRBmGgKb1t6iCmGWhL6ry PNdyYo058fK0wV0nbcbGFDHVmlFa1C40IPvXhPPiGzwsYeNNhc/Rpg6Arikq8s43nTMy RFQVlieCfx7LyIl3Elo3FYynJhdjiqOHBSX7wPiL5NGekWkBSiuGYWeTk5/395S7nIfq AV+kyuLgztRGO4fDY6Xpx+c83unc+8fyiFJwo8zYagLUuZukd4zwmuY8LMu2XUK4YJ1m MRBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=q/yHyMldu60gOBaQs0jTxyPBD38OhQT4AJEanuofTzA=; b=WD6opM1HPSvxeses/GJ4wXEv06YNQIS/dCBqb3tQW86/kMoHvNZtnQaQVdxbEAfNjV o/TyK9P0n4/RO6ogqETappKppJ431xPPpr/cFA+XzaSPuO3Aelazbl3JN96Xu76Qk2S+ 4JAd+t7CIbho1seKq4nn5COJWLPLFT7idg/6WRjqxVDvQ3hOlVn369BnLGBroa2AHR0M G8z3VWgXRQLfss5w3gfklGDzbdtlm83KIbR/+rRpUzeBKRg+hx1nfJRf8DA1EGzduBXC +wZhS60GjCh1a1a4GpJszltP7rmoVjWgNVN2ml7J1kkSnMGta9e4Nc4fjOGYfYYdfhHs Hdpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=iVygUdYU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x42-20020a056a000bea00b00581da213e4fsi7993763pfu.350.2023.01.08.21.19.54; Sun, 08 Jan 2023 21:20:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=iVygUdYU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236534AbjAIFTj (ORCPT + 99 others); Mon, 9 Jan 2023 00:19:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236122AbjAIFSV (ORCPT ); Mon, 9 Jan 2023 00:18:21 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF662CE16; Sun, 8 Jan 2023 21:18:20 -0800 (PST) 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=q/yHyMldu60gOBaQs0jTxyPBD38OhQT4AJEanuofTzA=; b=iVygUdYUAJcdSPVDpeLxNQYVjX VZ2eUIAr5Ni+Oq6UGlvHzp4wUhACJQlG+KVRJBJsBYXc1bElntXZ9kqQZPw8xJ1uMo9SviLIzgjB/ 4osnd9cWjUDxrDgHRBs2L3rrTD3u/kTJ9kxjdg1fqA2JTvD1KaonAc6P7HxK2kpd13noRlgtZSdQs /6GV9vYKYJNFilnTeuY/k/DjIGsd5d3k+A24w5+VIhfm31A30b6n0A9heS7y6kXjUPEXgm42wFA6X PuBqeYRiNfeuoD7/Jaiv8zElM3UVQOwf1xBIJNJ7j+aRCqZlyr5dbmR8mGAHAdXVWwd7VTg+FteSH n5LpyBKg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEkYD-0020wr-6J; Mon, 09 Jan 2023 05:18:25 +0000 From: "Matthew Wilcox (Oracle)" Cc: "Matthew Wilcox (Oracle)" , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH 03/11] f2fs: Convert f2fs_wait_on_node_pages_writeback() to errseq Date: Mon, 9 Jan 2023 05:18:15 +0000 Message-Id: <20230109051823.480289-4-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230109051823.480289-1-willy@infradead.org> References: <20230109051823.480289-1-willy@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754520991216077808?= X-GMAIL-MSGID: =?utf-8?q?1754520991216077808?= Convert from the old filemap_check_errors() to the errseq infrastructure. This means we will not report any previously-occurring error, and we will not clear any previously-occurring error. Signed-off-by: Matthew Wilcox (Oracle) --- fs/f2fs/node.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index dde4c0458704..a87b5515c681 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -2055,12 +2055,14 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi, int f2fs_wait_on_node_pages_writeback(struct f2fs_sb_info *sbi, unsigned int seq_id) { + struct address_space *mapping = NODE_MAPPING(sbi); struct fsync_node_entry *fn; struct page *page; struct list_head *head = &sbi->fsync_node_list; unsigned long flags; unsigned int cur_seq_id = 0; int ret2, ret = 0; + errseq_t since = filemap_sample_wb_err(mapping); while (seq_id && cur_seq_id < seq_id) { spin_lock_irqsave(&sbi->fsync_node_lock, flags); @@ -2088,7 +2090,7 @@ int f2fs_wait_on_node_pages_writeback(struct f2fs_sb_info *sbi, break; } - ret2 = filemap_check_errors(NODE_MAPPING(sbi)); + ret2 = filemap_check_wb_err(mapping, since); if (!ret) ret = ret2; From patchwork Mon Jan 9 05:18:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 40670 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1985850wrt; Sun, 8 Jan 2023 21:23:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXtZLzxdEQ3hzM24PRfiDU8vlPP23r+tefJ3lJXw32fMVYbEIWZe3xjHxrdewESqYk84xnHU X-Received: by 2002:a17:902:db05:b0:192:7c38:4842 with SMTP id m5-20020a170902db0500b001927c384842mr74599431plx.53.1673241794013; Sun, 08 Jan 2023 21:23:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673241793; cv=none; d=google.com; s=arc-20160816; b=PCPzkSoZA630DF8fjSfwmChG6KBuXDQdZfhZ0YM29MQ6xoZrTBnW7mSxDDnm77CuSa 2ZuStd1U3Uhbo2pr0baTcJTuI3EO+ifLjtBTO+nOhtaO/gXmkgSbUP8DL3IfDe4Vq8y2 EJbaPv3FUF0fGZtPHfdH14s1lfRvK4nKRp91taQOgITKtGiQOLAaId/rGseIk7Eoezyq DXJf6ZmPu66DVf1+cQ322Khd5H7OqJzNPSRdQ0izIp45jwTtPc9v1aWoyyp7UOyUrq+m C/v8Pf4d0PKSsNgJCQVFa8N2NhsrZO13i1WWl6PBvW55Gnnhkjmk+y44k+fR7YdpkKEQ X9ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=h9sfp3qLT5oZoYTMaEr7e7TXlhgkzcAwkjYXoXSr31A=; b=f38r9hYvDe+6w9LOIJxpxHQaez/DMXMSZNQUAnbvUdrPURY8C4+yEr0TQxZTi2BTtD Hx7Pa8ZZvqASLaadA1c3G5iyXjxLxcdZ7aYd3p10HWOSf7joPWuKKnnlcLJc5cPoBGWa Gb55cFigq5RBvaC0CtqEXnI8E2pI/flFrnaflqQnl8u8OKpKfIRT0bh9/9TmWmupceoS f0ba00WnfhnjihuGqVV70KzEdiYQsTDN8mMHO6SKRHqe8hxQ10mkREx3Kp/+ZoZ9UrD3 sDDqoDDPGQGOVjg8un3RlwvQHnb/WHEcpx8GOfulTlJQZ908Meha6dH3ZIACGiE3mKst W2JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=PcO+1hL8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d18-20020a170902e15200b00189b15ea35bsi7698024pla.208.2023.01.08.21.22.59; Sun, 08 Jan 2023 21:23:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=PcO+1hL8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236517AbjAIFTx (ORCPT + 99 others); Mon, 9 Jan 2023 00:19:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236277AbjAIFS1 (ORCPT ); Mon, 9 Jan 2023 00:18:27 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D43DECE16; Sun, 8 Jan 2023 21:18:26 -0800 (PST) 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=h9sfp3qLT5oZoYTMaEr7e7TXlhgkzcAwkjYXoXSr31A=; b=PcO+1hL8pqtTOSY4yjQyps5RAT 8G47NpMFqRsfCTyyb3fqOkD4nZvLhv1r3FVYZrLgN00r1oeN21QCtKgEmFKzGXeWTCrysJbJ5YCil Aen/7Z5sWnYFTkumxQdid4EhfMATxkw91mIj+zVArGyLIan5liKmfdqEW61z3f8VWfKyIhAxEoXFX OFPTEcFDp3LtnC3sMgROMruznAor3rlG093CS6uBuQeVaKkIhsONDXkN5aHoXxKuympj6b484oPaV jgvthhmyZLyRzVTiLrG9W00eMDs0V5nEXE8hsS2ogRU3/wyaoGYP/GTMBu+Za3JZpHnvcsoysOqXm XozSWbbw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEkYD-0020wt-9W; Mon, 09 Jan 2023 05:18:25 +0000 From: "Matthew Wilcox (Oracle)" Cc: "Matthew Wilcox (Oracle)" , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH 04/11] fuse: Convert fuse_flush() to use file_check_and_advance_wb_err() Date: Mon, 9 Jan 2023 05:18:16 +0000 Message-Id: <20230109051823.480289-5-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230109051823.480289-1-willy@infradead.org> References: <20230109051823.480289-1-willy@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754521187229940226?= X-GMAIL-MSGID: =?utf-8?q?1754521187229940226?= As with fsync, use the newer file_check_and_advance_wb_err() instead of filemap_check_errors(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/fuse/file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 875314ee6f59..7174646ddf09 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -500,11 +500,10 @@ static int fuse_flush(struct file *file, fl_owner_t id) fuse_sync_writes(inode); inode_unlock(inode); - err = filemap_check_errors(file->f_mapping); + err = file_check_and_advance_wb_err(file); if (err) return err; - err = 0; if (fm->fc->no_flush) goto inval_attr_out; From patchwork Mon Jan 9 05:18:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 40661 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1984638wrt; Sun, 8 Jan 2023 21:18:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXuHG+gZxVvXkSe0pLRRDdvPIb3rQ68z6AsnbrgK2eBWZt4pIUCFa2FTfcWepfDw4K1FbOgi X-Received: by 2002:a05:6402:3608:b0:495:b002:4ba2 with SMTP id el8-20020a056402360800b00495b0024ba2mr11117080edb.3.1673241527455; Sun, 08 Jan 2023 21:18:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673241527; cv=none; d=google.com; s=arc-20160816; b=YoDsSCGdidp98yk42LaFKn2qhPKJzge/QGGzJ1TbwNZxDPHKn7or5fNMwEj7NZgh47 Xje6cl956V6vylpbzLHxcz5GDyzAw281ql9/F5OGWrf1t1sTwn7GeKstKtiSyx+22wtz BODFGKD0b8aY2wKcuMNImjPLdBzBd2qxz4Y6xvZhXBCbpfBHWzWg5VSMqbMOsPRXqjvo Xxityk/mBIfc20XIQIBhEiN2VAAmjMjqaSbpXBXK61NzmvQbuBqyTFRscalaSce0QSbH bfDF/ebaUU9bYZbS+ZdTLx/2/0EghYFadNqxj16JcEvuBKbPuwt4DrhKgGOzdReYk8mv IRcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=20JVe/q5nqvxBF2DQBmPeH9KaV31rTvIVcnyqDD6QmU=; b=pegOrabsNf/NbyMHF3psjq+Va8TYRMR0YAYCrNLaTETfiPw1RIyiceS2tBeggy5+Yq CtEJGhREOzM8qfTJXip7wiUVCVCR0HkVk1E9onyeJNjZZhGwJxYzIiN/JbbPznLaTW+V 9y/Mp4aXb+G0g/a7e/KNCKzGHTpimoOTlXpla13FfZTW9xYAcJ34JbAsneQUqUi0KcuV u4lPaj3TJdp8s7L24WbBjzJ9pWFuv3P1qFnwXCGSXUbDjm7vd9wBcpQV0mxcC+7A6e8L jRv2a9k69np6Y1WviqxMzvX/jILwtfIHk9x7OLjuZM/6dxEy+UhZ4ttw5BqcN4lzuJIq W0Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=tx0zFFcH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g14-20020a056402090e00b0048721e1b62csi9750335edz.613.2023.01.08.21.18.23; Sun, 08 Jan 2023 21:18:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=tx0zFFcH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236042AbjAIFSV (ORCPT + 99 others); Mon, 9 Jan 2023 00:18:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231135AbjAIFSS (ORCPT ); Mon, 9 Jan 2023 00:18:18 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CEEACE16; Sun, 8 Jan 2023 21:18:15 -0800 (PST) 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=20JVe/q5nqvxBF2DQBmPeH9KaV31rTvIVcnyqDD6QmU=; b=tx0zFFcHpu3W2ppNLSOI9B5Sz+ xd91xrR9fMh4Z6dRVmSBn0jkXtna1ZZDZn0uFhvE6MiSIlY8+hIE0Lrio1bwW+2uWiaiMwb/Wpsd6 zJ8jSC2IElx3hY6ACHIcBjHn5xFGDTdpUCYWPxzpWl+sZ3GaZrI8u759dIKXifFdjiQM8gCO3a2nD JiCbF9/p1SucWAF0/taqy5CyWt3rpIpVpekZy0IdnRdWprkiL8MqmcxZn2XHNo1NIrzvk9pui+NL5 TK+MByXCi2QINbqO4iSHVv7NTJS/A9pOe9xQJ+MR5d0PJly663FCWwH722+gI7EaL+Ab+Hdq4zj07 OEHsN6BA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEkYD-0020wy-CL; Mon, 09 Jan 2023 05:18:25 +0000 From: "Matthew Wilcox (Oracle)" Cc: "Matthew Wilcox (Oracle)" , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH 05/11] page-writeback: Convert folio_write_one() to use an errseq Date: Mon, 9 Jan 2023 05:18:17 +0000 Message-Id: <20230109051823.480289-6-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230109051823.480289-1-willy@infradead.org> References: <20230109051823.480289-1-willy@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754520908201564350?= X-GMAIL-MSGID: =?utf-8?q?1754520908201564350?= Use the errseq infrastructure to detect an error due to writing back this folio instead of the old error checking code. Signed-off-by: Matthew Wilcox (Oracle) --- mm/page-writeback.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index ad608ef2a243..491b70dad994 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2610,15 +2610,12 @@ int do_writepages(struct address_space *mapping, struct writeback_control *wbc) * * The folio must be locked by the caller and will be unlocked upon return. * - * Note that the mapping's AS_EIO/AS_ENOSPC flags will be cleared when this - * function returns. - * * Return: %0 on success, negative error code otherwise */ int folio_write_one(struct folio *folio) { struct address_space *mapping = folio->mapping; - int ret = 0; + int err = 0; struct writeback_control wbc = { .sync_mode = WB_SYNC_ALL, .nr_to_write = folio_nr_pages(folio), @@ -2629,18 +2626,20 @@ int folio_write_one(struct folio *folio) folio_wait_writeback(folio); if (folio_clear_dirty_for_io(folio)) { + errseq_t since = filemap_sample_wb_err(mapping); + folio_get(folio); - ret = mapping->a_ops->writepage(&folio->page, &wbc); - if (ret == 0) + err = mapping->a_ops->writepage(&folio->page, &wbc); + if (!err) { folio_wait_writeback(folio); + err = filemap_check_wb_err(mapping, since); + } folio_put(folio); } else { folio_unlock(folio); } - if (!ret) - ret = filemap_check_errors(mapping); - return ret; + return err; } EXPORT_SYMBOL(folio_write_one); From patchwork Mon Jan 9 05:18:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 40662 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1984745wrt; Sun, 8 Jan 2023 21:19:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXsNkU0MX0o5s3ByEa7IWoPsLCEXMPGvkKWiZc3fT+QOX7/N1xaejt2vgKc9ms3VJZzkJFgK X-Received: by 2002:a17:90b:2684:b0:227:203d:4d70 with SMTP id pl4-20020a17090b268400b00227203d4d70mr692246pjb.32.1673241550321; Sun, 08 Jan 2023 21:19:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673241550; cv=none; d=google.com; s=arc-20160816; b=oIvYNwE1reC9bjEjKsWz9lKtI2g1PyLOr1MFaC/z/HvDp0GrwGg2t7cAdW7RxX/0YX N1rjcr4aKmY2aeictAD0s5P5jsN61zzF78ryjMo+30UzF3BzkgAmqteeqWXCP3UEK6a6 X5Hnxi7adXF5npGBPTbg08oqNB1EOinLUQ5v/G+7FmqN71O+kWRsfY8Tfx8lE6aNAHiD oaEJoftVcFzdZaiGJgIwl/dOLsn5hZHtiMu3m4y0SF02YL5ENrAuLCWY6LWJNfDRpl0R iEG7oGJeaPrsSrvF+tc1JYiiDhBeKuA/qyGVXMeJir7Tn1Mk9cQ4+HhIm0dJhiz/eiXX GIYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=b0czJbVeNEC59VHM8B9sq3qAwimTZQLD9J+IkbH6tGY=; b=dvq7LgymG42SD84YdG2jXgxWzokfXsBxPg6DxnGwuMjXpLTQL5HYF6i9iIh5hdeGDq 24O//Sf1gC/GTMNRQKsiJuYvBa3gRgtN4bTciPXZq/QjCya0PD63+Ql/dWm3YjsXowTy NtBzOSKofQgcKUycaGEfjl1u7WtgsqjCZq8pktKriyBia9b66APqTFIvMnAinjzmNk+z +yLtLo8l6jdSPKy48edCUq8ePOZ77EZ+aIgUHxSF5LuS8MyaSyg3bfyaLSWCEqOQyhE+ P+CUdCH9P858gIIQVLOoIvSdV6KN0iblKBLATEKpz1jkfbkzvQfNmSXTDiYzTxZhkVxj hhvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=ROGJTN6U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v36-20020a634824000000b0047866258f1fsi8002756pga.321.2023.01.08.21.18.56; Sun, 08 Jan 2023 21:19:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=ROGJTN6U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231135AbjAIFSa (ORCPT + 99 others); Mon, 9 Jan 2023 00:18:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234167AbjAIFSS (ORCPT ); Mon, 9 Jan 2023 00:18:18 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D669CE17; Sun, 8 Jan 2023 21:18:15 -0800 (PST) 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=b0czJbVeNEC59VHM8B9sq3qAwimTZQLD9J+IkbH6tGY=; b=ROGJTN6UntJy+YzsThEJJrxCJi TtVnoQq6up+P0EtHyGjHt6GeNnEoNZZk5bvjdgDBnt5U65teg3i0Q/vxeBhKrad0sQs5iCaUJ9aai hCoVJCKYxDMlWwNLtSUIdhPNwVYFZp7rjLsp1+yMFDTlOZEtR/uM5wKsrSTfHHqwDseBTLtSg1DqX 9fj9xRKQeflkeQLrCnDNMoea62skAbanZyCf2l5+xZAyzuXC4pRHywBj+sm5Z1MGsJ/DbzLeUgH2w RCVS9uE/Mi1NxFEeqnCNUT4mhbmgSj9IAKRM104Ix+jlmWWqNram/pb4oU6K2cN5Lppll1ajraNhZ 0ddXvYzQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEkYD-0020x5-JH; Mon, 09 Jan 2023 05:18:25 +0000 From: "Matthew Wilcox (Oracle)" Cc: "Matthew Wilcox (Oracle)" , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH 06/11] filemap: Convert filemap_write_and_wait_range() to use errseq Date: Mon, 9 Jan 2023 05:18:18 +0000 Message-Id: <20230109051823.480289-7-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230109051823.480289-1-willy@infradead.org> References: <20230109051823.480289-1-willy@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754520931715409190?= X-GMAIL-MSGID: =?utf-8?q?1754520931715409190?= Use the errseq APIs to discover writeback errors instead of filemap_check_errors(). This gives us more precise information about whether this writeback generated the error. This will no longer clear errors, so they will be visible to other users, which is what we want. Take this opportunity to de-indent filemap_write_and_wait_range(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/filemap.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 48daedc224d9..c72b2e1140d7 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -659,26 +659,27 @@ EXPORT_SYMBOL_GPL(filemap_range_has_writeback); int filemap_write_and_wait_range(struct address_space *mapping, loff_t lstart, loff_t lend) { - int err = 0, err2; + int err; + errseq_t since; if (lend < lstart) return 0; + if (!mapping_needs_writeback(mapping)) + return 0; - if (mapping_needs_writeback(mapping)) { - err = __filemap_fdatawrite_range(mapping, lstart, lend, - WB_SYNC_ALL); - /* - * Even if the above returned error, the pages may be - * written partially (e.g. -ENOSPC), so we wait for it. - * But the -EIO is special case, it may indicate the worst - * thing (e.g. bug) happened, so we avoid waiting for it. - */ - if (err != -EIO) - __filemap_fdatawait_range(mapping, lstart, lend); - } - err2 = filemap_check_errors(mapping); + since = filemap_sample_wb_err(mapping); + err = __filemap_fdatawrite_range(mapping, lstart, lend, WB_SYNC_ALL); + /* + * Even if the above returned an error, the pages may be written + * partially (e.g. -ENOSPC), so we wait for it. But the -EIO + * is a special case, it may indicate the worst thing (e.g. bug) + * happened, so we avoid waiting for it. + */ + if (err != -EIO) + __filemap_fdatawait_range(mapping, lstart, lend); if (!err) - err = err2; + err = filemap_check_wb_err(mapping, since); + return err; } EXPORT_SYMBOL(filemap_write_and_wait_range); From patchwork Mon Jan 9 05:18:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 40664 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1984829wrt; Sun, 8 Jan 2023 21:19:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXtDDNSGqgRcYYZuw4oKfNej1/+PY6tanwQRT+Xon+p1W89SULAacgA/EUhpu8sZLcRfXXNa X-Received: by 2002:a05:6a21:e30a:b0:a9:f163:3ecf with SMTP id cb10-20020a056a21e30a00b000a9f1633ecfmr78574245pzc.50.1673241570819; Sun, 08 Jan 2023 21:19:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673241570; cv=none; d=google.com; s=arc-20160816; b=RgrHpR1acNqtSecZ5xWDAvLpbqiy1t1R4a6DMuRFp61A0XHxaoz8Xhl9Nt2mPztGCv nbHUKe+GoNMppTjRWYo+rB3/iwVUPU6n0DNeicd/fSXgzYo+ho4ObF0IsE95QRTEiPXh hP0CkQqsdG75tSRxMDNBwyW8vKh96KGhV7YzFz6jfyNM25t+2zLzhZld7LvZ00yH0ryT SHROngbzKxOMpOZCooRE/kG51Wu1PX4IHipGoUE/aE3d1VVBiojr1DoujXAwVxnFfxJH 9xEsi2BkUHQSjzfKD6xz/c3HdS5udMNMM+hop5wueKCfbyx2vhgXBoGQGdnVOAaA0WTL 1SVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=k+ZZta1I7fiddKSuD0VDKROProxG+mv989F2OQevFVE=; b=VJpVryTlhWs93zwcE8R4c7sHqH/mvQdoZCAuPrOue2JXKQ4zOb6gh56O138UMk1lYH cd4KW5S7PNkN3W0ih8uCIDdXBbr2kRDS6+Cr/dnuB6AedGg55GmyicBfsDDtkbVLLBQx vwqo9X6p6SDa6NXd+/EsNKhiDs6DSkEi9TKidERGLCrXSMLes+mtSG2PGGYyGvXPxz3v GERXzeQsq7gTNP0hd41j/FfjrHC4DAtMCNYzbuLiHw7T9rDLax7yq+d3FFKCh4/MZyVf tgUa5MJTHDYRjnrSIhM7pneGvjC1hw2QXQkAAJaQESGKPHFLRP1fnGZaX8qItmT/5XeK HpTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=DoU3MBHw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y185-20020a638ac2000000b004a9ffdf9fffsi140413pgd.82.2023.01.08.21.19.18; Sun, 08 Jan 2023 21:19:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=DoU3MBHw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236419AbjAIFTA (ORCPT + 99 others); Mon, 9 Jan 2023 00:19:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234227AbjAIFSS (ORCPT ); Mon, 9 Jan 2023 00:18:18 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51C8AD127; Sun, 8 Jan 2023 21:18:15 -0800 (PST) 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=k+ZZta1I7fiddKSuD0VDKROProxG+mv989F2OQevFVE=; b=DoU3MBHwJXeUVlXpjR6BahDygE rEByLa9Kflz15xo39pKdfYcKiETrJxGAkDDIbdIRjAGz/2E2RS4zEGILLyeqi9+0oACdLFofz2Eyi s6f9m61E66DO+xVmMf8K2EY5OIGT2ttz5Q/c+eaMDstvvR5SvYWv5iL99XYnfo0i+EZw8gogjFn6/ 3CyvkQspNvX+c3ppbQ0JYxfo6J8koDQa9sFSx6I/T6fXMY28OQdYc1E8eM/bKizrOzUkkjPnOplht +UMBnwvIz/lKlPh5NwijUi27DC/U4yD7F7LdoRBlZnWa00pQ/DnconPqvKN98qR+aN5WcURO4Hv27 J0LlnnNg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEkYD-0020xB-Nx; Mon, 09 Jan 2023 05:18:25 +0000 From: "Matthew Wilcox (Oracle)" Cc: "Matthew Wilcox (Oracle)" , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH 07/11] filemap: Convert filemap_fdatawait_range() to errseq Date: Mon, 9 Jan 2023 05:18:19 +0000 Message-Id: <20230109051823.480289-8-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230109051823.480289-1-willy@infradead.org> References: <20230109051823.480289-1-willy@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754520953213730470?= X-GMAIL-MSGID: =?utf-8?q?1754520953213730470?= This removes the unwelcome behaviour of clearing the errors in the address space, which is the same behaviour as filemap_fdatawait_range_keep_errors(), so unify the two functions. We can also get rid of filemap_fdatawait_keep_errors() as it is now the same as filemap_fdatawait() Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 7 +++--- mm/filemap.c | 51 +---------------------------------------- 2 files changed, 5 insertions(+), 53 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 29e1f9e76eb6..985fd47739f4 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -33,16 +33,17 @@ int invalidate_inode_pages2_range(struct address_space *mapping, int write_inode_now(struct inode *, int sync); int filemap_fdatawrite(struct address_space *); int filemap_flush(struct address_space *); -int filemap_fdatawait_keep_errors(struct address_space *mapping); int filemap_fdatawait_range(struct address_space *, loff_t lstart, loff_t lend); -int filemap_fdatawait_range_keep_errors(struct address_space *mapping, - loff_t start_byte, loff_t end_byte); static inline int filemap_fdatawait(struct address_space *mapping) { return filemap_fdatawait_range(mapping, 0, LLONG_MAX); } +#define filemap_fdatawait_range_keep_errors(mapping, start, end) \ + filemap_fdatawait_range(mapping, start, end) +#define filemap_fdatawait_keep_errors(mapping) filemap_fdatawait(mapping) + bool filemap_range_has_page(struct address_space *, loff_t lstart, loff_t lend); int filemap_write_and_wait_range(struct address_space *mapping, loff_t lstart, loff_t lend); diff --git a/mm/filemap.c b/mm/filemap.c index c72b2e1140d7..887520db115a 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -526,43 +526,17 @@ static void __filemap_fdatawait_range(struct address_space *mapping, * in the given range and wait for all of them. Check error status of * the address space and return it. * - * Since the error status of the address space is cleared by this function, - * callers are responsible for checking the return value and handling and/or - * reporting the error. - * * Return: error status of the address space. */ int filemap_fdatawait_range(struct address_space *mapping, loff_t start_byte, loff_t end_byte) -{ - __filemap_fdatawait_range(mapping, start_byte, end_byte); - return filemap_check_errors(mapping); -} -EXPORT_SYMBOL(filemap_fdatawait_range); - -/** - * filemap_fdatawait_range_keep_errors - wait for writeback to complete - * @mapping: address space structure to wait for - * @start_byte: offset in bytes where the range starts - * @end_byte: offset in bytes where the range ends (inclusive) - * - * Walk the list of under-writeback pages of the given address space in the - * given range and wait for all of them. Unlike filemap_fdatawait_range(), - * this function does not clear error status of the address space. - * - * Use this function if callers don't handle errors themselves. Expected - * call sites are system-wide / filesystem-wide data flushers: e.g. sync(2), - * fsfreeze(8) - */ -int filemap_fdatawait_range_keep_errors(struct address_space *mapping, - loff_t start_byte, loff_t end_byte) { errseq_t since = filemap_sample_wb_err(mapping); __filemap_fdatawait_range(mapping, start_byte, end_byte); return filemap_check_wb_err(mapping, since); } -EXPORT_SYMBOL(filemap_fdatawait_range_keep_errors); +EXPORT_SYMBOL(filemap_fdatawait_range); /** * file_fdatawait_range - wait for writeback to complete @@ -589,29 +563,6 @@ int file_fdatawait_range(struct file *file, loff_t start_byte, loff_t end_byte) } EXPORT_SYMBOL(file_fdatawait_range); -/** - * filemap_fdatawait_keep_errors - wait for writeback without clearing errors - * @mapping: address space structure to wait for - * - * Walk the list of under-writeback pages of the given address space - * and wait for all of them. Unlike filemap_fdatawait(), this function - * does not clear error status of the address space. - * - * Use this function if callers don't handle errors themselves. Expected - * call sites are system-wide / filesystem-wide data flushers: e.g. sync(2), - * fsfreeze(8) - * - * Return: error status of the address space. - */ -int filemap_fdatawait_keep_errors(struct address_space *mapping) -{ - errseq_t since = filemap_sample_wb_err(mapping); - - __filemap_fdatawait_range(mapping, 0, LLONG_MAX); - return filemap_check_wb_err(mapping, since); -} -EXPORT_SYMBOL(filemap_fdatawait_keep_errors); - /* Returns true if writeback might be needed or already in progress. */ static bool mapping_needs_writeback(struct address_space *mapping) { From patchwork Mon Jan 9 05:18:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 40663 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1984782wrt; Sun, 8 Jan 2023 21:19:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXtw5f67qSNi9HE8IaO3WYb5KJLYsF76ErqMdBw1VHAE/Bqr19lA+Tmq/K8O/qB3lxM+vePq X-Received: by 2002:a17:90a:af91:b0:219:de9b:f397 with SMTP id w17-20020a17090aaf9100b00219de9bf397mr67588423pjq.3.1673241556554; Sun, 08 Jan 2023 21:19:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673241556; cv=none; d=google.com; s=arc-20160816; b=z/8j5oGwvAxV9UwYXHMD4sgcP53J5RZQz5dGeq4tbyfpwJ4ZWpALFtzMZk7EvLEKtw 51O9YxZOLWtQvUH9Is/VOakjiUtj77YnjXu57RI3s/BYBEqQegerXLfQYZJWhv8Z2XKF BeIQxbS0pantiHnTqxg/nEAzjLY/pa/DAZQDea7phPNvvvFQsjyph2y32wKHi4thPJTq FRhpOHIs+4jcIbjkgy1CyXfri5VkyHqfhJVEuzgVuJYilnryFpjyh86AYcod3TgKxIHE 5JgPbLXtYtgA3NBeZh4vEBJHI/NhT2B3IoDuZqCxAdFXOzTL//Uj1NCST9ruBgDO5vev DNOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=UvH9ycUllkHxgh2ZsVpQIK1Y6EVpAeDrvEMZLSZxFIM=; b=CvNx0oExZL0wiT/glfvTLvsNvdIk1nJ1m9fPZDzjnjk8Dq+WCyoemtS9/hfIrODFyB CCWCchdrrwSvVCU2X7aBaUh9Gv7vHKqtvu801sOtI7iHHGIyZ4AT06+hQKDp5A18ZUh+ cAb/mO1Kl2L5MgG4uGOhuAfDSMTjdokI/mumL/A2ZkfKSyamopUNAc/jqRO+b4kMKomW MJoi0AcaphpyNS4hpR/6oAD8IyTL26YgoTz+pmL3hY7KVYYN2RhdNR7W+kZh2e3yRzUW PTpl4L6+A6ryWy4KZxd5CpRmLvI5e40CCkm5EbNroW4pqPDanD3j+tHTqr7Jq1hWujAz 0ObQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=LbvKlGSO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc22-20020a656d96000000b004ad990a963asi6678437pgb.648.2023.01.08.21.19.04; Sun, 08 Jan 2023 21:19:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=LbvKlGSO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236358AbjAIFSi (ORCPT + 99 others); Mon, 9 Jan 2023 00:18:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229622AbjAIFSS (ORCPT ); Mon, 9 Jan 2023 00:18:18 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E2D1D2C8; Sun, 8 Jan 2023 21:18:15 -0800 (PST) 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=UvH9ycUllkHxgh2ZsVpQIK1Y6EVpAeDrvEMZLSZxFIM=; b=LbvKlGSOOBJGYKzPTxzwC51OUM 4pi+Lu0AKUj5674G9a9HGH2avOJVNKMzAho+9kZg1BLmoaQWZGFapak9qevcs5vCNX4cowDhjDTMy fecc/Mp4vTjQxDqsMnH/5D+7oIUueYz/KbNAPa3cSljyAFyidWyyb6gUZ0lx9YaUaNCpo18r76syB DIIOJfRRf+AcFziAPXk8JB5K4EdITspdaBq+l84JN1RdFBkFF+cD7zAqa1vPwm8jweofhVKpcmaFM i137t3ozQkjZdDD9Vrt8EYXLDGZ808AQNdtpYA+unsLNTlfaq9tJjcQ3MUy87+YUWevUMEmHHRCjb WlbLNRRA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEkYD-0020xJ-SI; Mon, 09 Jan 2023 05:18:25 +0000 From: "Matthew Wilcox (Oracle)" Cc: "Matthew Wilcox (Oracle)" , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH 08/11] cifs: Remove call to filemap_check_wb_err() Date: Mon, 9 Jan 2023 05:18:20 +0000 Message-Id: <20230109051823.480289-9-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230109051823.480289-1-willy@infradead.org> References: <20230109051823.480289-1-willy@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754520938327781031?= X-GMAIL-MSGID: =?utf-8?q?1754520938327781031?= filemap_write_and_wait() now calls filemap_check_wb_err(), so we cannot glean any additional information by calling it ourselves. It may also be misleading as it will pick up on any errors since the beginning of time which may well be since before this program opened the file. Signed-off-by: Matthew Wilcox (Oracle) --- fs/cifs/file.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 22dfc1f8b4f1..7e7ee26cf77d 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -3042,14 +3042,12 @@ int cifs_flush(struct file *file, fl_owner_t id) int rc = 0; if (file->f_mode & FMODE_WRITE) - rc = filemap_write_and_wait(inode->i_mapping); + rc = filemap_write_and_wait(file->f_mapping); cifs_dbg(FYI, "Flush inode %p file %p rc %d\n", inode, file, rc); - if (rc) { - /* get more nuanced writeback errors */ - rc = filemap_check_wb_err(file->f_mapping, 0); + if (rc) trace_cifs_flush_err(inode->i_ino, rc); - } + return rc; } From patchwork Mon Jan 9 05:18:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 40665 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1984873wrt; Sun, 8 Jan 2023 21:19:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXuAAcNZhn2K69I/iA8spR+oZPY+GcDAhL1CR/0esgVJj86gl8RSpCliCXX5HczDw9tnsytR X-Received: by 2002:a17:902:db05:b0:192:7c38:4842 with SMTP id m5-20020a170902db0500b001927c384842mr74589585plx.53.1673241580554; Sun, 08 Jan 2023 21:19:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673241580; cv=none; d=google.com; s=arc-20160816; b=E0V/QrOcG0JFWA602THTJRTQgfzttgYDCYzeAYCgWIGY69vHe8LW9lyrX2HPc3wLfr 691Ml5roELT8pgn3nc1j/CKCrzMpnxPbrgKdaByXzhVIiI+fTj+30wdEzujXBvOf9l92 vNMGreQLP778Ji8ejG6cBWiulLQLG4cZV+FwDZyt6L41O68L+MYANUeCRJyOQpiNxjf+ hsd30gAqwpKtUrVpG2633VOOaStOlvmaS27plItKwPbha/PLAfCvmP+DXj7yAB7o+pt7 CG4vb4SbFmHuZvM0RBZT1ObBtdUgIEuMoZKsB2953GMS9BgHBih4Lf5Hucla73bpXJRN twYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=YLUcsaMTdWzUTPeweatSYOos3qbQs6I0puU7586j9/8=; b=EhbyBtvIVBJlO2KO45mZq9KsMGFtDcDgE87WzKjJiiPuQepsyShBq4lDBw59Pn2p1n XSuI5ZCcoYHkKn29669LtN5trpkl6IHFqPKkrQ7un+Gymcn0AdGxwYH/LtGliGsEJ+WB oSOJOZxB0oYImgx0g5vdmmFZU1OFhc0IZsjS1LJDi6P5Ue6MvhpqNLIm98Uiyc6hQQI9 A6ytbF/XjYXMqh4aY3m+v+n0++9rrNwQ79V8GQutGqLswCS0YraQvjwqiK3mzKiWURHh GQUWaQqz+b2qR8LHIEONNVh7sSZv6e2Gsg51VIKE5Eq4E45i1AlJ4MQZ++DCMAPuNnFt AaTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=rAzQJTyZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k23-20020a63f017000000b00476e11d6938si8478278pgh.325.2023.01.08.21.19.27; Sun, 08 Jan 2023 21:19:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=rAzQJTyZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236369AbjAIFTF (ORCPT + 99 others); Mon, 9 Jan 2023 00:19:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234347AbjAIFSS (ORCPT ); Mon, 9 Jan 2023 00:18:18 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9929ED2DC; Sun, 8 Jan 2023 21:18:15 -0800 (PST) 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=YLUcsaMTdWzUTPeweatSYOos3qbQs6I0puU7586j9/8=; b=rAzQJTyZjPOc2dWheR771P9Y5N zEFvxTxSDP0E8IpVfF6xp0gNN58oO9Dpqu10uAK0toI8KWtTrYdFheabjxryK47Fc/6XtgZMl/qcK qFHVBKck4DfGAQMCUFkPHaYjIOxCKUezVTuKaQ5SABoD/vTuoEjpfNQOUqxuDHw5k8oDZq+xFcfSl XJl+2VeymGOsq6o/fwSbipUr+VEFYqSYdhM6Eg9Z/n+gV0uwM27qKhuw14Nd2fpbBlbZj6Z0Xvh9O JApINzQ7SNd06B2+cWVk5UY4YnSzbEpF03HpCfFRUUzauiuhQLMORV1XQIxAzasoT5c5qgxAGv65O TUrFVwvQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEkYE-0020xQ-0e; Mon, 09 Jan 2023 05:18:26 +0000 From: "Matthew Wilcox (Oracle)" Cc: "Matthew Wilcox (Oracle)" , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH 09/11] mm: Remove AS_EIO and AS_ENOSPC Date: Mon, 9 Jan 2023 05:18:21 +0000 Message-Id: <20230109051823.480289-10-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230109051823.480289-1-willy@infradead.org> References: <20230109051823.480289-1-willy@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754520963029678182?= X-GMAIL-MSGID: =?utf-8?q?1754520963029678182?= All users are now converted to use wb_err, so convert the remaining comments, drop the unused filemap_check_errors() and remove the compatibility code in mapping_set_error() and file_check_and_advance_wb_err(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/btrfs/extent_io.c | 6 +++--- fs/f2fs/data.c | 2 +- include/linux/pagemap.h | 20 +++++--------------- mm/filemap.c | 21 --------------------- 4 files changed, 9 insertions(+), 40 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 9bd32daa9b9a..f1c3572b6a90 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2386,7 +2386,7 @@ static void set_btree_ioerr(struct page *page, struct extent_buffer *eb) * or the content of some node/leaf from a past generation that got * cowed or deleted and is no longer valid. * - * Note: setting AS_EIO/AS_ENOSPC in the btree inode's i_mapping would + * Note: setting wb_err in the btree inode's i_mapping would * not be enough - we need to distinguish between log tree extents vs * non-log tree extents, and the next filemap_fdatawait_range() call * will catch and clear such errors in the mapping - and that call might @@ -2397,10 +2397,10 @@ static void set_btree_ioerr(struct page *page, struct extent_buffer *eb) * set (since it's a runtime flag, not persisted on disk). * * Using the flags below in the btree inode also makes us achieve the - * goal of AS_EIO/AS_ENOSPC when writepages() returns success, started + * goal of wb_err when writepages() returns success, started * writeback for all dirty pages and before filemap_fdatawait_range() * is called, the writeback for all dirty pages had already finished - * with errors - because we were not using AS_EIO/AS_ENOSPC, + * with errors - because we were not using wb_err, * filemap_fdatawait_range() would return success, as it could not know * that writeback errors happened (the pages were no longer tagged for * writeback). diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 97e816590cd9..566fe19ca57d 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2913,7 +2913,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, redirty_page_for_writepage(wbc, page); /* * pageout() in MM traslates EAGAIN, so calls handle_write_error() - * -> mapping_set_error() -> set_bit(AS_EIO, ...). + * -> mapping_set_error(). * file_write_and_wait_range() will see EIO error, which is critical * to return value of fsync() followed by atomic_write failure to user. */ diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 985fd47739f4..573b8cce3a85 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -51,7 +51,6 @@ int __filemap_fdatawrite_range(struct address_space *mapping, loff_t start, loff_t end, int sync_mode); int filemap_fdatawrite_range(struct address_space *mapping, loff_t start, loff_t end); -int filemap_check_errors(struct address_space *mapping); void __filemap_set_wb_err(struct address_space *mapping, int err); int filemap_fdatawrite_wbc(struct address_space *mapping, struct writeback_control *wbc); @@ -192,14 +191,11 @@ static inline bool mapping_shrinkable(struct address_space *mapping) * Bits in mapping->flags. */ enum mapping_flags { - AS_EIO = 0, /* IO error on async write */ - AS_ENOSPC = 1, /* ENOSPC on async write */ - AS_MM_ALL_LOCKS = 2, /* under mm_take_all_locks() */ - AS_UNEVICTABLE = 3, /* e.g., ramdisk, SHM_LOCK */ - AS_EXITING = 4, /* final truncate in progress */ - /* writeback related tags are not used */ - AS_NO_WRITEBACK_TAGS = 5, - AS_LARGE_FOLIO_SUPPORT = 6, + AS_MM_ALL_LOCKS = 0, /* under mm_take_all_locks() */ + AS_UNEVICTABLE, /* e.g., ramdisk, SHM_LOCK */ + AS_EXITING, /* final truncate in progress */ + AS_NO_WRITEBACK_TAGS, /* writeback related tags are not used */ + AS_LARGE_FOLIO_SUPPORT, }; /** @@ -227,12 +223,6 @@ static inline void mapping_set_error(struct address_space *mapping, int error) /* Record it in superblock */ if (mapping->host) errseq_set(&mapping->host->i_sb->s_wb_err, error); - - /* Record it in flags for now, for legacy callers */ - if (error == -ENOSPC) - set_bit(AS_ENOSPC, &mapping->flags); - else - set_bit(AS_EIO, &mapping->flags); } static inline void mapping_set_unevictable(struct address_space *mapping) diff --git a/mm/filemap.c b/mm/filemap.c index 887520db115a..7bf8442bcfaa 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -341,20 +341,6 @@ void delete_from_page_cache_batch(struct address_space *mapping, filemap_free_folio(mapping, fbatch->folios[i]); } -int filemap_check_errors(struct address_space *mapping) -{ - int ret = 0; - /* Check for outstanding write errors */ - if (test_bit(AS_ENOSPC, &mapping->flags) && - test_and_clear_bit(AS_ENOSPC, &mapping->flags)) - ret = -ENOSPC; - if (test_bit(AS_EIO, &mapping->flags) && - test_and_clear_bit(AS_EIO, &mapping->flags)) - ret = -EIO; - return ret; -} -EXPORT_SYMBOL(filemap_check_errors); - /** * filemap_fdatawrite_wbc - start writeback on mapping dirty pages in range * @mapping: address space structure to write @@ -684,13 +670,6 @@ int file_check_and_advance_wb_err(struct file *file) spin_unlock(&file->f_lock); } - /* - * We're mostly using this function as a drop in replacement for - * filemap_check_errors. Clear AS_EIO/AS_ENOSPC to emulate the effect - * that the legacy code would have had on these flags. - */ - clear_bit(AS_EIO, &mapping->flags); - clear_bit(AS_ENOSPC, &mapping->flags); return err; } EXPORT_SYMBOL(file_check_and_advance_wb_err); From patchwork Mon Jan 9 05:18:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 40666 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1984942wrt; Sun, 8 Jan 2023 21:19:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXvpRa1t+AUpPBbOqyObxKTHepjoNAyzllr38pHOTuoaBSXcYhDAijL2g65jhJzDEp2t3lMy X-Received: by 2002:a17:90a:5d08:b0:219:4578:6409 with SMTP id s8-20020a17090a5d0800b0021945786409mr66805870pji.41.1673241592235; Sun, 08 Jan 2023 21:19:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673241592; cv=none; d=google.com; s=arc-20160816; b=OA2AsMLhkUOzlZZ1JIT31KtU+IawTyJgrjf9v6u0mLUEQP7NQ6BfDfMNJ8Atzoz5E9 ZFfmsuSOtkHHJqHEDJVMeRn4OvG2GhpC9l7sbcnbGTR1Fpqfqlxgcuwij2oYkm/85RKy x3+aLsOkug38eV8vQg5e8J6DHJzq5cpebODPNgFIfbbASSsCQNEi64Jyyifwo1D386cc ksSWr6KSw8lYdGu0nOKJ5Q3qA+jxLyWCLTTQYr5DnfFRFoiG7uzcebbpxDSibng46ElU 1dCJ9qSPBYt9VjmfSRtj54WTcBjmpzL/isJq4A4WCYEnFrrHgO56uxKNxwuAV2zDl+m+ BogA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=lzB774qlWOGeuLTuMSFQPkmJwRXTwSiLN6M5EhwWaoI=; b=dvwvgdcir1BWpuvN5iLutHU2DqJ+p0w7fbhFFzwCOr/UMUjb61ksJTMV84DT9IuIC0 xqxTRSTz3qNQhURlQw2DhvgDjynyaAl613i0aMhthJA1M332du3j5cEFMaE/MX8Gz41D ZenkUB2aHayJvgVoFpg0NHnug417aVoS7Rayy7biUtCZCYv6+pHdJhq0IGD/9bJn+J+E E3+LOYBmt12S4b9H4FYvkesI36FNhDkc+v4tNHyeIWiEnUh+Du4OmMLJ21Yqc0zR/S5f 4GCSJerqlcSxXl07N5OAlJxhZ5gYlScPME3dpCNh7Df4JKKvG/D8HfKSPyQkrSMVBXB2 Io0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=mKbzCkts; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ls3-20020a17090b350300b00225c475b3d2si13839240pjb.55.2023.01.08.21.19.40; Sun, 08 Jan 2023 21:19:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=mKbzCkts; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236420AbjAIFTS (ORCPT + 99 others); Mon, 9 Jan 2023 00:19:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234366AbjAIFSS (ORCPT ); Mon, 9 Jan 2023 00:18:18 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB478DE80; Sun, 8 Jan 2023 21:18:15 -0800 (PST) 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=lzB774qlWOGeuLTuMSFQPkmJwRXTwSiLN6M5EhwWaoI=; b=mKbzCktscn6Jx0BP1xTRqukdZF nsrtNLVPeVuRjragXpmoIVeIzgGb0cnGyr1MUaySI1GDPtjn0IbSqa1+ySzdBGWA1S+PzmWo59/+f wH9GGe5EvRbCf1EvX6MwIPKGc6bpARRvARTX+OeC+dTWgQAsx9Pq4h2GNzhFWNOFVSkYkGn9pCgRO P8JFQRh+f9PZko0g5ck1IucaLmdMcqlO3ERpHcWUv0XNcctHTopQkPQOZ3QxjGmbwkUSMj0yMwp31 HxN2gKdn3STEHlZiuf/HEmUJitZ5FijtDNFgXX/ve9HDjDPTWu7ilckbmLKnRpQcSsvi0IiYuJ+8Z ViBPmQCQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEkYE-0020xW-4R; Mon, 09 Jan 2023 05:18:26 +0000 From: "Matthew Wilcox (Oracle)" Cc: "Matthew Wilcox (Oracle)" , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH 10/11] mm: Remove filemap_fdatawait_range_keep_errors() Date: Mon, 9 Jan 2023 05:18:22 +0000 Message-Id: <20230109051823.480289-11-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230109051823.480289-1-willy@infradead.org> References: <20230109051823.480289-1-willy@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754520975816207239?= X-GMAIL-MSGID: =?utf-8?q?1754520975816207239?= This function is now the same as filemap_fdatawait_range(), so change both callers to use that instead. Signed-off-by: Matthew Wilcox (Oracle) --- fs/jbd2/commit.c | 12 +++++------- include/linux/pagemap.h | 2 -- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 4810438b7856..36aa1b117a50 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -221,11 +221,10 @@ EXPORT_SYMBOL(jbd2_submit_inode_data); int jbd2_wait_inode_data(journal_t *journal, struct jbd2_inode *jinode) { if (!jinode || !(jinode->i_flags & JI_WAIT_DATA) || - !jinode->i_vfs_inode || !jinode->i_vfs_inode->i_mapping) + !jinode->i_vfs_inode || !jinode->i_vfs_inode->i_mapping) return 0; - return filemap_fdatawait_range_keep_errors( - jinode->i_vfs_inode->i_mapping, jinode->i_dirty_start, - jinode->i_dirty_end); + return filemap_fdatawait_range(jinode->i_vfs_inode->i_mapping, + jinode->i_dirty_start, jinode->i_dirty_end); } EXPORT_SYMBOL(jbd2_wait_inode_data); @@ -270,9 +269,8 @@ int jbd2_journal_finish_inode_data_buffers(struct jbd2_inode *jinode) { struct address_space *mapping = jinode->i_vfs_inode->i_mapping; - return filemap_fdatawait_range_keep_errors(mapping, - jinode->i_dirty_start, - jinode->i_dirty_end); + return filemap_fdatawait_range(mapping, jinode->i_dirty_start, + jinode->i_dirty_end); } /* diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 573b8cce3a85..7fe2a5ec1c12 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -40,8 +40,6 @@ static inline int filemap_fdatawait(struct address_space *mapping) return filemap_fdatawait_range(mapping, 0, LLONG_MAX); } -#define filemap_fdatawait_range_keep_errors(mapping, start, end) \ - filemap_fdatawait_range(mapping, start, end) #define filemap_fdatawait_keep_errors(mapping) filemap_fdatawait(mapping) bool filemap_range_has_page(struct address_space *, loff_t lstart, loff_t lend); From patchwork Mon Jan 9 05:18:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 40669 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1985014wrt; Sun, 8 Jan 2023 21:20:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXsvbwSbwWrWJbt47H+yYWO+Dzv40l+aWTRT0/8sRNn2Z0jpqg6OFTd86ECZGBCiefkAgtrs X-Received: by 2002:a05:6a20:d38c:b0:af:a276:2f94 with SMTP id iq12-20020a056a20d38c00b000afa2762f94mr80565598pzb.35.1673241609091; Sun, 08 Jan 2023 21:20:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673241609; cv=none; d=google.com; s=arc-20160816; b=eiOaN/FY8YQiA5y+Ehovm6fJE1VP+oMjHwROkY5qzxLqtMp8bZZMNxvfJzXR9c61TX EM1K8yLleFgkZAR6MKPv8XgOoJQ1+FeatccfH66XihfmPd3d/t05de5vAlnVs6BNuKos 6Q7RzjXCAYUvcbELANV6j81OBip4Vs1tm7zqAhs0W7TJAeZNn8aTLwmy+wf6Fe0R2ZOW /HR79wE9aPFRjo9cq6YG4RSNzNUE5292vJSP54yfWRe+GbrM1wvaXwyciTPdvtHrFpWF E71l8YzhWTbSTeKXIiJByLWz7gc8/XdVqa5k/AtITJPBzR+u9uu/BIJ9d5NSbdQfwp6r 261g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=vQF/XULxVm6847KaRqQbhdaohxHXi2nEuadxTiR1ZyE=; b=BUDJN1jUW3cei121y4IfZqN153i2p7wHF3liI8Fw3pCJeum7R1TN4JHIKoQX0drca9 dmPo8yOJ5nhXPafyduD4aejcYToXdR/yPUqeTLXP0GZltJfcQozZum6N836hXKGqJd5R 6Pt23Y1LI23tVTuOSGBrz/OAbtEWPoNP+2RS9y6IStFNPg9W7qAexwQ2vxsWBS0EmUfJ xW5WZCxIC9o34P31fOk3A4SjZr6wp3UFqCMnXj28QKO/xd+VXN9DA/UnRl0rwMQAqJhn oLJrDe74jK2gVftd/Dy8vJkq3lPm/D0ase9p+ke4QjTJ0nAtrpfw+T+zIY+efbiZXMHL UneA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=aRa6C07m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o25-20020a635a19000000b0045131d08c18si9194862pgb.244.2023.01.08.21.19.56; Sun, 08 Jan 2023 21:20:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=aRa6C07m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236374AbjAIFTM (ORCPT + 99 others); Mon, 9 Jan 2023 00:19:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234414AbjAIFST (ORCPT ); Mon, 9 Jan 2023 00:18:19 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC210DE9C; Sun, 8 Jan 2023 21:18:15 -0800 (PST) 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=vQF/XULxVm6847KaRqQbhdaohxHXi2nEuadxTiR1ZyE=; b=aRa6C07mcL3ngPuqUeUeiq9Ewx ojEY5TSS9TePzq8VcMu5ajWtwn4NiV+m5NNngSAtK9zTzdDs3q90VzpUCMIrSyZGbu7kEiTeRh619 6q3IWbwiybuoZMlQU/vqIim43gIyzhp3Ph8+GVUVj/vWGpTU/+Vxfh6YkJL/frk+TJxlOamIQqcWt IzYn4QhNA4rFF0qJuAkxUWsHMRoGHusUQ/kdpMG6Wvwysl2pFmTgzmP41oczAMhe2Rntw6fQfNV5C y5mvfiSAJm2MwpIQYvhXFRsv37zIzK32GV2QCdxDA5nlXXnWl94CSidw9tcoy3HcxKd6KOir4+OTQ wQw0SzcQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEkYE-0020xc-8n; Mon, 09 Jan 2023 05:18:26 +0000 From: "Matthew Wilcox (Oracle)" Cc: "Matthew Wilcox (Oracle)" , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH 11/11] mm: Remove filemap_fdatawait_keep_errors() Date: Mon, 9 Jan 2023 05:18:23 +0000 Message-Id: <20230109051823.480289-12-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230109051823.480289-1-willy@infradead.org> References: <20230109051823.480289-1-willy@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754520993298625839?= X-GMAIL-MSGID: =?utf-8?q?1754520993298625839?= This function is now the same as filemap_fdatawait(), so change all callers to use that instead. Remove the comments which talk about keeping the errors around for other callers as this is now the only behaviour. Signed-off-by: Matthew Wilcox (Oracle) --- block/bdev.c | 8 +------- fs/fs-writeback.c | 7 +------ fs/xfs/scrub/bmap.c | 2 +- include/linux/pagemap.h | 2 -- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/block/bdev.c b/block/bdev.c index edc110d90df4..2fae19f0a5c2 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -1053,13 +1053,7 @@ void sync_bdevs(bool wait) if (!atomic_read(&bdev->bd_openers)) { ; /* skip */ } else if (wait) { - /* - * We keep the error status of individual mapping so - * that applications can catch the writeback error using - * fsync(2). See filemap_fdatawait_keep_errors() for - * details. - */ - filemap_fdatawait_keep_errors(inode->i_mapping); + filemap_fdatawait(inode->i_mapping); } else { filemap_fdatawrite(inode->i_mapping); } diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 6fba5a52127b..dc0158125e5d 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -2598,12 +2598,7 @@ static void wait_sb_inodes(struct super_block *sb) spin_unlock(&inode->i_lock); rcu_read_unlock(); - /* - * We keep the error status of individual mapping so that - * applications can catch the writeback error using fsync(2). - * See filemap_fdatawait_keep_errors() for details. - */ - filemap_fdatawait_keep_errors(mapping); + filemap_fdatawait(mapping); cond_resched(); diff --git a/fs/xfs/scrub/bmap.c b/fs/xfs/scrub/bmap.c index d50d0eab196a..8f169047d410 100644 --- a/fs/xfs/scrub/bmap.c +++ b/fs/xfs/scrub/bmap.c @@ -64,7 +64,7 @@ xchk_setup_inode_bmap( */ error = filemap_fdatawrite(mapping); if (!error) - error = filemap_fdatawait_keep_errors(mapping); + error = filemap_fdatawait(mapping); if (error && (error != -ENOSPC && error != -EIO)) goto out; } diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 7fe2a5ec1c12..69190335deb1 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -40,8 +40,6 @@ static inline int filemap_fdatawait(struct address_space *mapping) return filemap_fdatawait_range(mapping, 0, LLONG_MAX); } -#define filemap_fdatawait_keep_errors(mapping) filemap_fdatawait(mapping) - bool filemap_range_has_page(struct address_space *, loff_t lstart, loff_t lend); int filemap_write_and_wait_range(struct address_space *mapping, loff_t lstart, loff_t lend);