From patchwork Fri Dec 22 15:08:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 182686 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp1125720dyi; Fri, 22 Dec 2023 07:10:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IG36PJHYM/9qA1krzn3aOZQ245PW38aCYyzGYABDnn8/fkCgZFM2Xy54dd10HErTiKn1xeX X-Received: by 2002:a05:6a20:325b:b0:191:520b:6d91 with SMTP id hm27-20020a056a20325b00b00191520b6d91mr1597549pzc.40.1703257820099; Fri, 22 Dec 2023 07:10:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703257820; cv=none; d=google.com; s=arc-20160816; b=g5SPr4mPpEKFckEkk9XWgZe5Ai8wF8e9T8+z7zVEREOD9a6OMN56eELGn7y4iA3zfp Vna7ZoOK1wUPG6GJIHvYt+/tCh5ec2ZSRnREAAOr1Um+t82MSQ4XBXdPaXIt0vAGTiAf r4IVh9tfeeZoqgy3fm+fD11KDcvLTU6VQWlRT1tKI1g0lm9Z8QIw7b/DgxaCwwp5uQ4n O4dYG+0F6bB3Pdz3mUxusjeypU2VSIAsY32d8Ff5j8UWzCn40kx425XczBfX7JvGHZTD Qm5Ot105rIXsW2Z+r2KpP0zezujInuhDuobcXa+IWN2cQZJ/tQUb1zoZBojDbOEIvwAa eyBg== 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=UHLYB53YtGsTugfyc+sHmLVVrbGg0LS55c68Xz8vbHU=; fh=hzpEVxJ05G9gyZL9WVyKgOEGxITvmFSuTcKyr2ByStg=; b=SHHpaWSG5ZSLzy1Mlk/HwlZONECEi6arxmatZUdgTsfcXE3yinaFAk2eSY5wHrWm1y /l/xQLV0I5ZvXn9pWD4OnRaGr519LAAqjNGDPiUWqO7cYINpcpUVYWQdl0SPKgbIOfEs gmTZce5apWsSiCopVXdFQDHrK9SGxF775QG8hPL+z8Hhy+ExTYwKdBrmXmMJXB9x8DlF sPivXsHdd1PJLyqwftB/jf/ddlFJgfhWJ3UTXDJgXFaCossy4xi8RQ4Ur1u8FF7LJoQ6 LduRPscd9cvkyg408RZlKefiQLIW6oFXhsxwzwR9vSizeg3S8N7Cy5EsK+JpSEu6n7pl zoGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=sS1lzdSK; spf=pass (google.com: domain of linux-kernel+bounces-9812-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9812-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id p29-20020aa79e9d000000b006d5aa09b7casi3290932pfq.396.2023.12.22.07.10.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 07:10:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9812-ouuuleilei=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=sS1lzdSK; spf=pass (google.com: domain of linux-kernel+bounces-9812-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9812-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E8CFDB23551 for ; Fri, 22 Dec 2023 15:09:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 29926241FF; Fri, 22 Dec 2023 15:08:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="sS1lzdSK" 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 0574A23741; Fri, 22 Dec 2023 15:08:34 +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=UHLYB53YtGsTugfyc+sHmLVVrbGg0LS55c68Xz8vbHU=; b=sS1lzdSKCtbDDt5pryAreVWTDH SjkKoxC7B15xtfkczw8hl1mfsQbLTllwOTvsAXunotk3Fp2hLQPGqlwbaVRFgsU0ZaAcyw6VQH9k1 kk2oEtaDSk0x88fUWX7NBy3ajJmxXiSLpCr+H/7QvpWjlhwAweh5KmPWDZEljN1iFlOqxQ2VknBah Wlr233mRp7xfWL07mAdOfNycfh9hy4Vmab1nwypZqdomhnN5QFuas6w8rM6D0zdOlQYfkuS1eN4g4 xf7tOIbwqPtd8oS5XwjiPBQoJYrMUK5MnXGVXxw9sfXfr8TzwUqZ5dVcUotykFxtw2mfLOg0vKZON E8ZhJhkw==; 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 1rGh8X-006BLb-2P; Fri, 22 Dec 2023 15:08:30 +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 01/17] writeback: fix done_index when hitting the wbc->nr_to_write Date: Fri, 22 Dec 2023 16:08:11 +0100 Message-Id: <20231222150827.1329938-2-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: 1785995271537447305 X-GMAIL-MSGID: 1785995271537447305 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: 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 ee2fd6a6af4072..b13ea243edb6b2 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) {