From patchwork Mon Feb 12 07:13:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13552745 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 56175C48297 for ; Mon, 12 Feb 2024 07:14:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DCAF86B007B; Mon, 12 Feb 2024 02:14:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D7C5D6B007E; Mon, 12 Feb 2024 02:14:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C42F96B0080; Mon, 12 Feb 2024 02:14:12 -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 B57DA6B007B for ; Mon, 12 Feb 2024 02:14:12 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8BA97C08BB for ; Mon, 12 Feb 2024 07:14:12 +0000 (UTC) X-FDA: 81782287944.22.628DFFB Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf25.hostedemail.com (Postfix) with ESMTP id DC320A0013 for ; Mon, 12 Feb 2024 07:14:10 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=dJIvNT8i; spf=none (imf25.hostedemail.com: domain of BATV+56c964bc8172c8a9ee6e+7477+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+56c964bc8172c8a9ee6e+7477+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707722050; 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=2QW1YOpfZggQarO2hJ9pUOEEOVq5PMz3pyBHLyK4cac=; b=PH6JZaNkfCoSrcCCTTNY9DrHiEU7duQ7JW9qfXnRe5YpVSdWyqYeHXqAvvaqdOCWbvWyOU eY0uys2AhOSJF3kHTcVnu/TO6faoHln/N5dlyDxzCME1++vQ9HOMm9o5ZEaR5ZwFzjNPWL tiOFID5wtn6MLTGsOfDIzlvRpGWIRGg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707722050; a=rsa-sha256; cv=none; b=wav/AHFEHYMX7pNQT/ckV0VHMj6vhaH2tKFQOcDQ0adLb/pTWvuASnkCyawnx1OO/RxDwZ Rw2A961pWj7qk4ZdIGz4tlgg9MooWtVz17e+o0rg2UohHucCAsrUlCsHJ9t6hKY/O/GNoK HaSzZTunUJPkeZ+0TOOgKqB5ocLMAJ8= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=dJIvNT8i; spf=none (imf25.hostedemail.com: domain of BATV+56c964bc8172c8a9ee6e+7477+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+56c964bc8172c8a9ee6e+7477+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none 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> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Stat-Signature: f5apunoknugq71sjarpcdib73i1djqsa X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: DC320A0013 X-Rspam-User: X-HE-Tag: 1707722050-515096 X-HE-Meta: U2FsdGVkX1/I640h/t6dR+uLyH3LyFjQVkPiV8m9GN7/teEsoxFR8lzKprESfPfxliClKYPG7z3DsmhqI1/HbAe30biBa5IxeQsUD278lwV7gRbNDqhOLGZRDjj2rW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PrSAzv4AbLGJdQe3aSWrHNSu3XBY7hTBCt080evBqYmkprWHWsF5cxyfQKUT8hdT5AXkyIx+4JkDSFE01BE39KTH726CpzV6ppoe4L425cal9Y2RCX7wFvNf1W1W/cb3PKeYEZmI3ndXXdBl/ss8f9QU2unYo4p3laU4ebo0ak88o2YDZUEKTMorpRPMxFSjF09QqXcOdh7Tgb37S0UPyM2HtPOY1zQfaC4UlAos5CekeWi3WnYf8eV5+oIuz5QhcWSeAaj2wA34CfiJmBsgAAT15PcunpBc6A= 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 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;