From patchwork Sat Feb 3 07:11:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 196255 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp987689dyc; Sat, 3 Feb 2024 04:20:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IFxJPfPHS0TJjvbsQLwihDkziK+9UcwucmFAvIR8e/fTfUA2W4ReoQkNoEUZdeJO0wKWUGl X-Received: by 2002:a05:6214:1c4e:b0:68c:928e:a93d with SMTP id if14-20020a0562141c4e00b0068c928ea93dmr1350876qvb.25.1706962812665; Sat, 03 Feb 2024 04:20:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706962812; cv=pass; d=google.com; s=arc-20160816; b=TAYwr2RTRB3u17LLJQjKVGjFd+m8DxodRiGZl22WK66ZvZ5Gqj3ymEpgcBl/PJ6r91 k9bDP/clMvNntqFYh+bqel3z17IaW4llvm7d9h5+sIoup7ZT/ahsQszzxsDGs7tJjqg4 EKJzrxhxGAjkDucXoahnJTyJq4t0yDJydWUm7lrFD3olFpOar7F7dgKHJv2KNVqFctV8 kk16rHZT5furWOPnWRyaaFEPkMgNhxKAnfmzNqfQlpzR6XGtEwUID/LbPljKAwrRTuiW W/Gt/03VB5CeoFmRqGKo8KQWEMLdCAIF+uc0hvsJx3mBEjvuh6iZGe8OcQEOugc9oy6y RBPA== 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=Ir6qdgwpiudHSGvIqZf3UZHrrrbsMgA9iIwYL6Ldf0U=; fh=xhaiu9dvUn4Wt+NSM8sF88dvyr0C0WIiBw5ptGmxj8I=; b=Bu10qxxXipwMhnT+W7uvgsTYhCY8ESZnIEpHfbphs7KYMNTBQKVqQpJ6LyJ6GJn6Jm ht0V+lrzCVYhdfxx/vdT/MOdY+BdK+uVnvrZSjg8x/xWgeNglXeHHBopRJ11R9TbkyVm d87T2U2S934CLXM1B7JkVCy28GnWDT/E5N/f805LcZ4EZp6En8LnqSTb+siv6pMZT2Xn IHFXXwN8PomOnqt4UKUCu5QERlWKLqX/GtvJhlzYXWSM4nj0YjL5u6jRtTozLrgdN6Ba OBAd32Sven5JxEmC+4xoOH/T9lF7vLOh7Glq1rsZ02NbO2J3mxUW99kEHyy6Jm9yzoT8 MIqw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=iE2Qy9x6; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-50951-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50951-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWkOnLo55MSzHmRI3rYMOA2Kf8Y4hBENj9Ma3p7k/7xvq1DLhzjREGc07Fa3hnp/WQ7aiew/bzQmiE6tI5/oMrZEG+f3w== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s2-20020ad44382000000b0068c461ae06fsi4158609qvr.258.2024.02.03.04.20.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 04:20:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50951-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=iE2Qy9x6; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-50951-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50951-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E7A6E1C23D4F for ; Sat, 3 Feb 2024 07:13:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 487104F212; Sat, 3 Feb 2024 07:12:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="iE2Qy9x6" 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 450614E1D3; Sat, 3 Feb 2024 07:12: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=1706944333; cv=none; b=h+tPRjH2v8Fly/Gt55zi2qHggBy5HccHjDs8mFFvW2H2UZKCKLibM8J9b/0jWd66+l1i1UOsSzB8uf/W8Vg+fv1/YKxdYOgoBg6zUpHwuLAg0MFuFU9lNROe+BK8vhncgYYRLGvNaR3y1W25WDDAhLEb6eRPAlLhsikH4PFFMY4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706944333; c=relaxed/simple; bh=fd5z2BBVNn++M9QyH8w4N0hNZ9EZndHdM9R5JVwzQgM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TTsqkzrAWpy99CaWv2HF8oVusngBsOWkQZIER+0e2AbEJ7RmrtIiFCYunBI9zRevuCNXXJi7MeiRWA4RxEXuRyeGVXrMWpCOTrdpSBbZe/iELgMo7bmLouYqIZAEbxYD6PP38dMcZPs1ThTrJU7zQ8+S7ccL7aC16Oqkohcc8FI= 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=iE2Qy9x6; 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=Ir6qdgwpiudHSGvIqZf3UZHrrrbsMgA9iIwYL6Ldf0U=; b=iE2Qy9x6Sg4y+wDEl3bj4dxn64 gCZM+M5CKCFy/pvjW1p2OkT8q39b+HPLnqpeQFtfQGA7LIQT455VsNCXAFevt/ZFQdlwY6+lV/T08 hi9wUOIqd5dzHOSzIBC2F2C1en3bkkET7N+8OxgSq2ZP6UymsXcY5AHMrDYarIBXr43S1FjEAqJwL tnWLV4DaRWtSn8qD6VOyT5NExzUXn7LolYKSrpLFNKsSD9ZMMwOWlGrlASjgnLrSgjA6/9i6nUia2 SO3m5CYQbkwfuUV+eCZiDRKzYLJuG2c9DuxAxC2a3HR2vl2ucCFG25/X7aUlQeXm0S5RF82fcXR7Y 9YjRd9ow==; Received: from [89.144.222.32] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rWAC8-0000000Fjz1-3cgJ; Sat, 03 Feb 2024 07:12:09 +0000 From: Christoph Hellwig To: linux-mm@kvack.org Cc: Matthew Wilcox , Jan Kara , David Howells , Brian Foster , Christian Brauner , "Darrick J. Wong" , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kara , Dave Chinner Subject: [PATCH 02/13] writeback: fix done_index when hitting the wbc->nr_to_write Date: Sat, 3 Feb 2024 08:11:36 +0100 Message-Id: <20240203071147.862076-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240203071147.862076-1-hch@lst.de> References: <20240203071147.862076-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: 1789880238503900174 X-GMAIL-MSGID: 1789880238503900174 When write_cache_pages finishes writing out a folio, it fails to update done_index to account for the number of pages in the folio just written. That means when range_cyclic writeback is restarted, it will be restarted at this folio instead of after it as it should. Fix that by updating done_index before breaking out of the loop. Signed-off-by: Christoph Hellwig Reviewed-by: Brian Foster Reviewed-by: Jan Kara Acked-by: Dave Chinner --- mm/page-writeback.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 02147b61712bc9..b4d978f77b0b69 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2505,6 +2505,7 @@ int write_cache_pages(struct address_space *mapping, * keep going until we have written all the pages * 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) {