From patchwork Thu Feb 15 06:36:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13557438 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 5E0F6C4829E for ; Thu, 15 Feb 2024 06:37:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 69FFC6B00AE; Thu, 15 Feb 2024 01:37:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 604076B00AF; Thu, 15 Feb 2024 01:37:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 42F816B00B0; Thu, 15 Feb 2024 01:37:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 1D6BB6B00AE for ; Thu, 15 Feb 2024 01:37:12 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C3EA7C0296 for ; Thu, 15 Feb 2024 06:37:11 +0000 (UTC) X-FDA: 81793081062.22.E46D8B4 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf21.hostedemail.com (Postfix) with ESMTP id 1C0A11C0019 for ; Thu, 15 Feb 2024 06:37:09 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=uCBSVVuE; dmarc=none; spf=none (imf21.hostedemail.com: domain of BATV+a252b21bd4a653ddb6e6+7480+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+a252b21bd4a653ddb6e6+7480+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707979030; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=VFSwwvxPq8YqSy1LhT+7I32BZPWfWyPm9+xgXvBp1QY=; b=MEQMLNvSy4M/mPL8LecY0VpkqbUH4o9AMYcjQ8fTv3rDSH7XeRqEZ4L0biSjo8e7wT8Qxx oTD2EdKWeqoEKJ7AaZnXZVe1v6g6jo4SbXgaclX+hZEKvzXrGKA2QqXPBSyMZnSKrNRCAC JvH8emVuFE0t6Mtxzc+2w+m3dAT5W6Y= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=uCBSVVuE; dmarc=none; spf=none (imf21.hostedemail.com: domain of BATV+a252b21bd4a653ddb6e6+7480+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+a252b21bd4a653ddb6e6+7480+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707979030; a=rsa-sha256; cv=none; b=yxEdk57OC4iwyR87liz8R59+1m7zzGveMHBHC9XCKHqPEImQKrYHidVaxEcDr1ziVVeh/8 Cfpsk8p9+JRlpqjQCKQNWz+1ezdq+HoDajENUaGLvuh0mXJoXN7e2QQJES7ZGz6MONI9IU QpbECGpMYHwPm8XzFFGuY+QzAFd68hM= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=VFSwwvxPq8YqSy1LhT+7I32BZPWfWyPm9+xgXvBp1QY=; b=uCBSVVuEZjdlJt7d69NrZVeolB /kjMsFwTJq60LblBUNHI8D9FKeIk7EaezCshL5MogOcilaVzUumWQGFyJrDArSTXi7Be+4pxG1SNU S4gmAl49iTyY6WOw8cOyjIXQ0HQRApALNkz2oNuat9VB/mKsPrv7sgmbsT8B+ncFcw0sKTS3fDhhE dIVKGU2jvuQRTYkueAMF6D4cvDfNdntGtGWQfI2Ks96cc93QJiyGud5hoxOyUcxhQT8n/0WhK+ijs 84Swzl2V1QHFqyP82EEgRAqxGEJybxmPbUJ4jjUtr9JCOKeok9U6pcX4oWzLWefbnx74h/KMQUTzE TZv+y9eg==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1raVMq-0000000F6ro-3TeQ; Thu, 15 Feb 2024 06:37:09 +0000 From: Christoph Hellwig To: linux-mm@kvack.org Cc: Matthew Wilcox , Jan Kara , David Howells , Brian Foster , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kara , Dave Chinner Subject: [PATCH 04/14] writeback: also update wbc->nr_to_write on writeback failure Date: Thu, 15 Feb 2024 07:36:39 +0100 Message-Id: <20240215063649.2164017-5-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215063649.2164017-1-hch@lst.de> References: <20240215063649.2164017-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Queue-Id: 1C0A11C0019 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: b89arjynh5daernmj5xpdpmpxr5ungez X-HE-Tag: 1707979029-218462 X-HE-Meta: U2FsdGVkX19BqH8yu300U3kNXaRxn4stCQJh8AhGHcSTjZKYHFooRyVSiKl+fJfW3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POP6rpr/GCDqlXCK/bW5Lx4/OI5cXm8LmD5eyT0SzR0zUX1/aLYwCq7AMqOEx+9/gNKba7DOz7BIlaqJJGbIhA4ZTE1+45Hs6MZ6hZwbfED9w4sIhNX8kn0v1pg/277jg6DsP3ls1mzB3lbVQHtD8EEeC4DBfjnD4nelzjHXTzI0qUvsQ5hY0Wj/TD+wUzP5GPHIiEVnHB+D/M8W+8NMDcKu+5JU+PBsJ2qjcMGTn0JBL2OE4fTomeTzPRB8A5+q6qJGfMgwMebQK+dcIaZtLqBQdLAT2+pVRn1V7oL3o0Wktge9W6ioEKxdhLhOrbnfuok/pPpi7A= 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: List-Subscribe: List-Unsubscribe: When exiting write_cache_pages early due to a non-integrity write failure, wbc->nr_to_write currently doesn't account for the folio we just failed to write. This doesn't matter because the callers always ingore the value on a failure, but moving the update to common code will allow to simplify the code, so do it. Signed-off-by: Christoph Hellwig Reviewed-by: Brian Foster Reviewed-by: Jan Kara Acked-by: Dave Chinner --- mm/page-writeback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 2679176da316b3..abbee369405a83 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2473,6 +2473,7 @@ int write_cache_pages(struct address_space *mapping, trace_wbc_writepage(wbc, inode_to_bdi(mapping->host)); error = writepage(folio, wbc, data); nr = folio_nr_pages(folio); + wbc->nr_to_write -= nr; if (unlikely(error)) { /* * Handle errors according to the type of @@ -2506,7 +2507,6 @@ int write_cache_pages(struct address_space *mapping, * we tagged for writeback prior to entering this loop. */ done_index = folio->index + nr; - wbc->nr_to_write -= nr; if (wbc->nr_to_write <= 0 && wbc->sync_mode == WB_SYNC_NONE) { done = 1;