From patchwork Fri Dec 22 15:08:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 182701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp1133961dyi; Fri, 22 Dec 2023 07:22:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IGCFMzNvIYVkJI6dH6RdFaNEG4xQiihUIjAwQye3UIsXESKM/JyKhgvcII4f9F0kwQ8Nhpf X-Received: by 2002:a17:907:2cf4:b0:a1f:a0ac:ab3a with SMTP id hz20-20020a1709072cf400b00a1fa0acab3amr848927ejc.129.1703258528006; Fri, 22 Dec 2023 07:22:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703258527; cv=none; d=google.com; s=arc-20160816; b=mIt9Q4B3P7Fe5/F0oGEMFr21DS3nXCn9Il9iLpCLH0PJt4gYa7e8qABum8gZTLNgc7 FRH1Upgy6JTpzlawlTLfcXkdBi3aLe8D8v3EoXVjYnUMro2LUZENju+GtNYA0yWoPLhk 4FinpYJVdNYbFkleGjY2zFee04xwH5qZoa0eDCmjo9FIQ7PgemlBLYP3yY4tuqAlqmGM isevl2GcRxkMEF2guxwbQe51hRFvceapJrdsD75kFAh39/1RYvoqCYmknZJ4L0g+PYhT KR2Mhs2hmparhyDa48vgURqOOwfOozrsUqOfSPt0fyMvq31j6/3F54hv8jKrm+FqNKFw Dc8g== ARC-Message-Signature: i=1; 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=fN/ppIDjf8llE1R2IP9HkDxKkqwH+tE6Rl+QLZ2/TEU=; fh=hzpEVxJ05G9gyZL9WVyKgOEGxITvmFSuTcKyr2ByStg=; b=ALMpAgX81aAMmOGADkGrIdnQqQc7h/fsmXcLUlZZtRqtLGEB0VzoPYgyhARoS/24G/ epP4vUgJtK2KMSoqONfEo7EftJoiTSMw4bKy2KwO0t4LBLIDBdxxG5VVHWEH5vj799HT 9Vb8loOHp21vi4OEcRykkw7tRVuscYEzjPiHnLC3TsjeSCY5h4W9ldWByGfzA9ZgHeHk 5eJzDfqH2QLi6LepmcDdiy+6GGR1s5gC0WlW+cHtkcjfOR3N91+Jkhnvbp30N2JqD2Rw LKtW7NzWSKdrCnL1VjyOD4zYrOr9DPOLL2JecIArsvBRMCybx7DVWQIqbpEUlxO3zt3y hQTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=eW2Uy2m7; spf=pass (google.com: domain of linux-kernel+bounces-9831-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9831-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id e25-20020a170906249900b00a2349eee2b0si1928099ejb.636.2023.12.22.07.22.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 07:22:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9831-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=eW2Uy2m7; spf=pass (google.com: domain of linux-kernel+bounces-9831-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9831-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 12BD61F27968 for ; Fri, 22 Dec 2023 15:14:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CC4F1241F7; Fri, 22 Dec 2023 15:09:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="eW2Uy2m7" X-Original-To: linux-kernel@vger.kernel.org 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 26F5723741; Fri, 22 Dec 2023 15:09:23 +0000 (UTC) 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=fN/ppIDjf8llE1R2IP9HkDxKkqwH+tE6Rl+QLZ2/TEU=; b=eW2Uy2m7FBO5xaNthhnztdQcks hrr4l0624Om9pIxbz9CvVT6F8/8GtvMNoXbmwGlCDFF8nGnq5VDQOhY68QwmxCcNbw02AiezjLC+h LciBMuT9iTN3DQKZJHLpSWtmgUBo1N6gBdfQ80vxoMRYMIFbnLv7rZkdvcE13PbK+RLrfJxZ6V/Wm NaEoaC6tJ3nXJN0Gfu7VKwYethnw5imyEeNqEF8c7//UPkIYO6NwJMsmMjN2v5/e76lJMEddiOmLy RQMKELa4SOwk1keLw5zIhtdwJ6WKunryCLuXgV9j0hnVCbu+3sDisXU0HwhYEHJuIKUDxvODk0o+Z CSzgEfwA==; 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.96 #2 (Red Hat Linux)) id 1rGh8a-006BM3-0e; Fri, 22 Dec 2023 15:08:32 +0000 From: Christoph Hellwig To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , Jan Kara , David Howells , Brian Foster , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kara , Dave Chinner Subject: [PATCH 02/17] writeback: also update wbc->nr_to_write on writeback failure Date: Fri, 22 Dec 2023 16:08:12 +0100 Message-Id: <20231222150827.1329938-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231222150827.1329938-1-hch@lst.de> References: <20231222150827.1329938-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785996014006955175 X-GMAIL-MSGID: 1785996014006955175 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: 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 b13ea243edb6b2..8e312d73475646 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;