Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp448372rdb; Thu, 15 Feb 2024 05:21:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXfW/OWCX8cI13sJIugZVjBiV0LZMIxSP893OPI+UuNjBRLJX15TDj/DPGK4lcTK/fgG2Hh/2+fWZmpRiouy59FXkWNPT43WuP10HCt5A== X-Google-Smtp-Source: AGHT+IFcf777itSfiPMnI1+wStL/NB4awRyyOw1WN0YkFY1fd6AG/LYm/FfN8XAVwJyeeqEARhw2 X-Received: by 2002:a05:6a20:889d:b0:19e:cd5d:8903 with SMTP id d29-20020a056a20889d00b0019ecd5d8903mr1528851pzf.24.1708003299032; Thu, 15 Feb 2024 05:21:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708003299; cv=pass; d=google.com; s=arc-20160816; b=RWxL82biXlOfoLKWujJYb6pXbiRGm0GTd0Y865dcuieRl1eWCeSZ4yxRjrPd7ODeQb xm8k824ecmgx2n+ShZXSdGvSvN9nTiCwcVMWAOmSB9GTWy158USkQ32+ZigLh0p/AQ74 NosgEQKkYaeQQltlATqmSPbe64fxdDzVCrAmj8to2mylUJ/XCkxjRRKXdrUiSYv7P3qZ W145QNMqujk8DYb7AIRm9JT2vqC2FYZ71RJLEGHFP0tgTxigaEKLETb3olnlO6oBKWBH OgFloODuo+UNenjV1OtxFRXw2CbD4vLFkMfvEEPrbgd9VnU1dVXVGFssxAac6c2UXL4/ QstA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=VFSwwvxPq8YqSy1LhT+7I32BZPWfWyPm9+xgXvBp1QY=; fh=fHt1epEEG4CBzP1AZFY/UQTnQHCnTLYuOY60rKPEgb0=; b=Hd5dmd/qrYyclbGyGjHg0BARoAMMzsICS14pe4stl4eEt+6x4g+vNQRBmEqpfuSdv9 qwCaCqJ+YHJhC87R7HoIXrdVisSGIyawjnzPJbm1yllLm521bXDdDkRXLkSjFe0KD7VJ pYmrjGXaAYz/EN1Ik2e+Bt+Zawyk8SZduIB936gzK9t+7HkuFlCnp6mhnWMti072pLqO R3rsLbrTcONSu9Iig53YceoSTnwholyaQJrMU3GpZujvECY/540+9OnKEquW+uo238R3 Ms+j3YUgMSVMP+LSwl/J2LkhwG+YJ7XlaYwVMLZ9JLRYahOKcvZZqfovA8sgQ/HuvqWw Casg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=uCBSVVuE; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-66327-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66327-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id l7-20020a633e07000000b005d7a78810acsi1094715pga.278.2024.02.15.05.21.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 05:21:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66327-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=uCBSVVuE; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-66327-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66327-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1123FB2919E for ; Thu, 15 Feb 2024 06:38:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2AB0E1426B; Thu, 15 Feb 2024 06:37:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="uCBSVVuE" Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15A2113AEC; Thu, 15 Feb 2024 06:37:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707979033; cv=none; b=SvHM8md2AkDONth0ONfkBrwvj54kaj7qiNuRqPsVUkztaRA+IZPGdfuxP4+dekUaS25EaIWcuTa6jrp/ccY/ruN46v7ZPW9k59dSBb2sGsvYwacXzaCzQc2JoowvfOdbZPMXeJ/l5kgyNL6ZtJPB85GqU9TDfnjaxJ6TPVseLVU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707979033; c=relaxed/simple; bh=RhfViJ7IIYoEM1bRFlrSqvruUGRWl+Igsb0ymAYJQv4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GPvG0I1mgwRnRVZBw2kXNDSia+3otIB0KQRHxmHk/h4+/+n+GxRwgXnjvefZFEvfShNxU7xsSe2X77RsMptapzFaa7gZwv1eEMQzJL43rBnRqBfT76M2LRnDmS5efMR2cLY9n45RTnxmnM5lPnXXPNptEAA91LajVjjoDGZ0iiU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=uCBSVVuE; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html 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; -- 2.39.2