From patchwork Sat Feb 3 07:11:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13543898 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 18A71C4828F for ; Sat, 3 Feb 2024 07:12:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 980F86B0074; Sat, 3 Feb 2024 02:12:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 90A086B0075; Sat, 3 Feb 2024 02:12:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7FA3C6B0078; Sat, 3 Feb 2024 02:12:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 711526B0074 for ; Sat, 3 Feb 2024 02:12:17 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 4C4CE40204 for ; Sat, 3 Feb 2024 07:12:17 +0000 (UTC) X-FDA: 81749623914.16.383AF85 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf06.hostedemail.com (Postfix) with ESMTP id D76E9180005 for ; Sat, 3 Feb 2024 07:12:15 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=XlUtYVzv; dmarc=none; spf=none (imf06.hostedemail.com: domain of BATV+a0ed29cff9639d748e7e+7468+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+a0ed29cff9639d748e7e+7468+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=1706944335; 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=49fgiBCP04epsyHu4VZLFhJdGCRmLlr7ZEyZXKDtz3E=; b=uQr+90aLq6tJvGcEeQKPkkhckvAlF98QTDd0CrkUGdBfk1/ONNt2FiB1U5Czee48DwmnpR y+42DeFJ8H5knezJmm7I9PjM2gwkyZC3eNCJCine8nWycDXtd28rDi69na1BGPeuLAUWn1 MSi7gFx6jpbXfnLC5+R0vtojUJLiEK0= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=XlUtYVzv; dmarc=none; spf=none (imf06.hostedemail.com: domain of BATV+a0ed29cff9639d748e7e+7468+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+a0ed29cff9639d748e7e+7468+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706944335; a=rsa-sha256; cv=none; b=czIAWpM7Cx//KN8ZIBCdI7QgYr6tXO5HLlim/8BrpahdWgK5RoP5RCu0+aGXSCvK73Fi8f 9nss7IDcNHJdfXrmbypGmGhkYEkSn8F+7TqI1cfqdf/fT09xzEBul2S60fmru4zx3Qo1pq MWNoxLvlaOEhBGwHHkTmZNLQx/lFMUU= 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=49fgiBCP04epsyHu4VZLFhJdGCRmLlr7ZEyZXKDtz3E=; b=XlUtYVzvEHslYCkKcXL+kLKkWh 9WTLKLOLzxgooVTG83weTxXHEkwnSz4ybyLAeTF63d9qpkg5/3QqKB1r0fiaxhUO3cVx09NH+5Eo5 QFGjAEPz/oAvFBpRtC9I0fpdDPAIDkdv9qsZ/o2Yk6jT1RW6Z8Qoa81kLjYtsh7/LoSy3GUxUHyIz MQ0OFbDNGbmshBa1RhuYyufJiFWc9kY5FoAub/R7AI5Ep+JcunFwqr5QsPuqV2eofrvNuVUc7kq0H mfFJrDAX6yoOt/HhTtIfyWWS9UVv6ptOAdSuTkYnPQpb3GhIL9zWe/+GHCh8en4saFjCp4gzKTqae RAaS1RPw==; Received: from [89.144.222.32] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rWACE-0000000Fk0K-0UzU; Sat, 03 Feb 2024 07:12:14 +0000 From: Christoph Hellwig To: linux-mm@kvack.org Cc: Matthew Wilcox , Jan Kara , David Howells , Brian Foster , Christian Brauner , "Darrick J. Wong" , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kara , Dave Chinner Subject: [PATCH 03/13] writeback: also update wbc->nr_to_write on writeback failure Date: Sat, 3 Feb 2024 08:11:37 +0100 Message-Id: <20240203071147.862076-4-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240203071147.862076-1-hch@lst.de> References: <20240203071147.862076-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-Server: rspam09 X-Rspamd-Queue-Id: D76E9180005 X-Stat-Signature: wq7dg9xgzjat5iwoqpqj6xtansswmznt X-Rspam-User: X-HE-Tag: 1706944335-794486 X-HE-Meta: U2FsdGVkX18RCEQSLUDWx+SB30G6WYaPaPcihcLAnNmwSq1VlmVMJPOexmcVv/WCSlpkpqyzoH54Jj2btsfBu53cNa10uir3Jsl2fCexO2lyRoilbII5DW5nVrM1W2s574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fmzBGR6RTgf0hUQ== 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 b4d978f77b0b69..ee9eb347890cd3 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;