Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2324573rdb; Mon, 12 Feb 2024 00:19:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVKJOpJKDA5Y4/do7HkqvON4NBU4Pl05BDCXx4vD1tYJU7n6uKEAXARMsiCBlipsaI28Jd95Bj8On+4wANRBFjQZt9ot2Re63Kiqz1cMw== X-Google-Smtp-Source: AGHT+IEDKpTaQ70vkfYDmHFntPLu3OGb2g3E4tGI83qJ8hBewqwqc3PDI2rqAbcbEj/OUzI8ltj5 X-Received: by 2002:a17:90a:17a7:b0:296:d85:d3d2 with SMTP id q36-20020a17090a17a700b002960d85d3d2mr3096542pja.34.1707725995282; Mon, 12 Feb 2024 00:19:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707725995; cv=pass; d=google.com; s=arc-20160816; b=Hw/3BEY75nSkGU1QKSFJMGJxdlCZNjxOcp60VA2GwvObAupTd9RcxoAyqOR7BMWmI8 RGH/vdUv61u5cy/dZV0XpxBsa96/vp2LJErKtbZHFtHsUaMiRV29H3APpNdF0lv933GQ eSXXJ9SYyowPcct0ZC2cCwDGXl4VX0mIy6Se67bXRJqpPxpBicHZLH6mzOHc24462GAz I0h7zOh+pLFVPBvijQiS0IzaqpqhnQBWYvQsk8sIsHyUKSFLuUeQdDljRr7E77sUsiGd LmHPYQ4mGCA2PU2AzUINei7HTMlLko0Qbgk0Fu4MkfTK7Q7G94ohrzsN+nCOR968TMU1 b5AQ== 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=2QW1YOpfZggQarO2hJ9pUOEEOVq5PMz3pyBHLyK4cac=; fh=79i95HUcnWhNWE60CsS2mrhSvNVb/oCo6bLWySb+F9Q=; b=Jv+BkESdgUg2EcoJQ2xpbi6ht0oPk/yqcJUSh4HP3lsUTyyyxRyuXLOBuTmSqhA8Nf I1XrtHfZ0Iqw0sm/fBlk0Rcbbs2S0DeMmC8sSnK17bNiqbL/8EXQAIjSB/jzff5EGE2n mvaeCzXe4POK8uUapd0ceNLXxp/Hjh+QWlklsFS0YHg/2fBmqc5/9T5eavD+H19eplu9 GCfJWc2zJMEzJYC7NQXwBghFiv4AycYRxRsuHMBw4bWHeFLaHMDwLbVodZhNEc+D3pGj 3oBtHESmlRh251X6jQ1llmU2OgyM1GwSnGxjMjplhwepx2R2ko1ogzrQQY9u+Ys2gLnn ckyg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=dJIvNT8i; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-61130-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61130-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCVPjKwdyRRB7A2koqbUq1vtdhJeoLYravCFctWz102PG/2ONazrN/h80MOOi04qEosmcK7aiWb9rPropWIeP71O9/QKBqZAorMXj2+bFg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l14-20020a17090ac58e00b00296fb137edbsi5870214pjt.57.2024.02.12.00.19.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 00:19:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61130-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=dJIvNT8i; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-61130-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61130-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 13F7C285D24 for ; Mon, 12 Feb 2024 07:15:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 157B112B89; Mon, 12 Feb 2024 07:14:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="dJIvNT8i" 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 E71F91119F; Mon, 12 Feb 2024 07:14:12 +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=1707722054; cv=none; b=CKfGHveq/6Gr/Sy4His1NWDbRY/hqLLxrFoVJPKcSUggytalHG8B4TTduHPtP2uPDjml4NLFqjXcjMQuxi1TmODTwcRniczNALWMgzhaj7EOOOOIXCHVoAQIuZJSYL2T1xLmuyfeQTKJdSs5h8W4WOvpZ6bQdZmtNx1XTW3IP2c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707722054; c=relaxed/simple; bh=GL1mB2qr1ND5+ILCIRB0lCKQZDgTWyOuUcvG6Wq3oDI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=vFbZowERhwS4NcupDOy2eX8nLRSf5URhhQJ3BRHQ113/KbHuyedvaJcd+dKikIq3r/iDuYV+M1h5COI19IWSW1aqAI5WokMH+DeerjNiG1Vr96u3ld0OlPpDwmIan9qonUpoGMZ0WR7vymQvhFc9WjaF8SGFzWmJb4IdVG7VyiY= 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=dJIvNT8i; 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=2QW1YOpfZggQarO2hJ9pUOEEOVq5PMz3pyBHLyK4cac=; b=dJIvNT8iPWSyPAEA1cLuE0R6F/ +MI3j0k2PaFmoed7PIV31w4cjyiO/A9tRJ1wuYiDzg0P6+2xn9yGpkqkoU84H/uyqGDD8/8PxBBfQ AFkG/svjPlhqN9q9KovsSyxhMQnnhYP6eKBcGdGQ7cpErALum72bOaABOLi3nWI08NNWV6YIRTDM4 XaZWfmZtuFb7tRrSdMIatAztr8Wku7CuRHPn8WD52iMGkhxkDKK2RFyyLSDnYhpbrmDbaWIBV1wEY EM+HyvMdvT7MosOnjNsAmMCaAYPWgIVZa2GMzHwxyB+/wjpNd1Fa1LR87khgeDjw5xO/CjND/s9mR /fh/xOzA==; Received: from [2001:4bb8:190:6eab:75e9:7295:a6e3:c35d] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZQW1-00000004Sqd-1p3o; Mon, 12 Feb 2024 07:14: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: Mon, 12 Feb 2024 08:13:38 +0100 Message-Id: <20240212071348.1369918-5-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240212071348.1369918-1-hch@lst.de> References: <20240212071348.1369918-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 aa3b432f77e37a..06afba8f078515 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