Received: by 2002:a05:7412:8d06:b0:f9:332d:97f1 with SMTP id bj6csp11935rdb; Mon, 18 Dec 2023 07:39:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2rA9F+yu0f40QVqnjYNevstPOhg+toF2W0/BjKJpHD3tLJG3GfvUt4lxqyUZ+Mf2zZ3En X-Received: by 2002:a17:90a:bf0f:b0:28b:831f:187 with SMTP id c15-20020a17090abf0f00b0028b831f0187mr1078182pjs.19.1702913982799; Mon, 18 Dec 2023 07:39:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702913982; cv=none; d=google.com; s=arc-20160816; b=Pnv8k3g5JXXTjF+tCzE5g8Y6FXIOETbK1Mj9POClV0XevwhYdTijiKDx+13VidJlbA wIOVMI5T+vIZLxOZiJJnwO9opa6yZCqqzQMheOUBKYohYIAKLrqlfsVs+nQZCt0yBlur lenK88zrvxzpWCI7jpQZIx95+s9DBWhtUksuFrMEne/LK+DtTwbtxqOrQLxG7EBVjYam X8gffU+kBlnA5/+PEjzY/i1LavyIx5kQz4Aq7GriS2GUuMWRnl1SPET5F5r6AGyb+vOo IvkeabPYqO7acrPuh596SyQhuSrJrdY9yvnF85Np4syam0dNKfIY2nfn6dOl1vhcjxHR bjGQ== 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=7163FLdiULRyCtlx5MbrRVNBpAWhlO7V2EZv7W3gfys=; fh=m0HBXuwgOCKat7wyuY7vstPypqMqxNmINnjBv5+EUjU=; b=xKAJX3ZpHD0/8tUQCDTZ1KMaO8D7sj0PB4qFS6EYrZajz4A2T3ucG+syONs7i6Hvy1 HEkjp6gC+lfJgGBC6gO6XKZLoPRasv+L1YGpkgl0Wj7marmbJ171K39HGS2TwvRRx4Fb +1YbYGD3YBTosiuHWXTdZA3jscbNjRVLsfJ3BYZOsLMhI/p6bfkqPNISOsWoCMv8Kxeo 6lWfv63Tgwyva6yOzY+fYUBcZAyhW7sEMqFfykoubNlVhQ2jwjwFLRmlC6byqP/8K/KS b8B7hRAhDXwfSn5bOK7N171FOKTuFVTmYQSLIVxTGjxM7HoYS3wottp967KETKlicer1 AWZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=3ZpRbR4d; spf=pass (google.com: domain of linux-kernel+bounces-3946-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3946-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 m18-20020a17090aab1200b0028af3016cc4si8840489pjq.37.2023.12.18.07.39.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 07:39:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3946-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=3ZpRbR4d; spf=pass (google.com: domain of linux-kernel+bounces-3946-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3946-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 43C6BB23B6D for ; Mon, 18 Dec 2023 15:37:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C3B45A845; Mon, 18 Dec 2023 15:36:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="3ZpRbR4d" 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 99AC34FF7C; Mon, 18 Dec 2023 15:36:07 +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=7163FLdiULRyCtlx5MbrRVNBpAWhlO7V2EZv7W3gfys=; b=3ZpRbR4dzIQW6XHwppDqZ0VacY /+zRsMPUMvnF7Sy5qNbH115aR7DDOQvaHRu710B91NeXzplfp3qTlgw7xfv0KrcyWORdshwnkkTmA wBgJWLmbwKN5wKEgBZ0dNa1dWgFi/CFzWBohlP/g028rqSTZvYH+R18Xwim7yG1K7ATbdoWKJVTTk eYplI3MAGnKoB0nLg8K150hBAhpd9H2ehkExYxakdZNWBLN5nTWldq39fKlzTGSPHfUsFl47/nG4W Kb5D26H9trc75XVfWUbmdH/gddMp2u//JG6HZRNz6kFm7Mt3YMVvl1fA/LFDPemXhHP/apthEfVde SioTXypQ==; 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 1rFFex-00BEI3-2w; Mon, 18 Dec 2023 15:36:00 +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 Subject: [PATCH 02/17] writeback: also update wbc->nr_to_write on writeback failure Date: Mon, 18 Dec 2023 16:35:38 +0100 Message-Id: <20231218153553.807799-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231218153553.807799-1-hch@lst.de> References: <20231218153553.807799-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 simply the code, so do it. Signed-off-by: Christoph Hellwig --- 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; -- 2.39.2