From patchwork Thu Feb 15 06:36: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: 13557437 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 107C7C48BEB for ; Thu, 15 Feb 2024 06:37:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 910126B00A7; Thu, 15 Feb 2024 01:37:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 898BF6B00AC; Thu, 15 Feb 2024 01:37:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6EB616B00AD; Thu, 15 Feb 2024 01:37:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 55BE56B00A7 for ; Thu, 15 Feb 2024 01:37:09 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 360CAA0856 for ; Thu, 15 Feb 2024 06:37:09 +0000 (UTC) X-FDA: 81793080978.04.C1F7FB1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf16.hostedemail.com (Postfix) with ESMTP id B7AED18000A for ; Thu, 15 Feb 2024 06:37:07 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=S4NXeWjC; spf=none (imf16.hostedemail.com: domain of BATV+a252b21bd4a653ddb6e6+7480+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+a252b21bd4a653ddb6e6+7480+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=1707979027; 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=kSMXi3gz5VM6F2g1+TWrPGgNlolETTCiIJzlQ/AveA4=; b=fRz3SWZqlOwxL0yeaDBSsh+LHoVYdYtwH7rtrYJ3RIYYHZA3QSAHObePzU8e0mSNp4dyWM Zr/mrvpfpYVgDcaWQCRTiGo1lE5mwpulpM7VMOpJA8qE75KHtZO7c4Fjrcxzvo/+I4migN LPPWY6aCG2luKOH8sBfcPhDzfA9GLyQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707979027; a=rsa-sha256; cv=none; b=EQs85hPVe8q9GMVTZmZJ7Koz5mfy8S9c7YDrHaSDXUbiWTvBi0eKrVh9XlC6vKHTmgD6j4 TLprVs+wLtKFeSRPgDQmuVVDe82pdbCt45VrqiIRIeHfBzYlSGw2QcO9b99VtvuHExGZ+P MV0zqXWyN4mR2LTulTpVxz1g6Ht3bTA= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=S4NXeWjC; spf=none (imf16.hostedemail.com: domain of BATV+a252b21bd4a653ddb6e6+7480+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+a252b21bd4a653ddb6e6+7480+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=kSMXi3gz5VM6F2g1+TWrPGgNlolETTCiIJzlQ/AveA4=; b=S4NXeWjCQySPi/zq4OM137aJ+6 vVdn/P9suTKm0us/wsY/Fv8b/20hUhILA19+5Ue3hWr6rBBb3U7kL8pSAoAkwjXWcMicNhajbI6xX EbgO3XefR/t34tuSkYHtTd9Njp4hIN9viDPkgVx74GlSP8t3vk871RskDSii5HkIODE7I8U2HXivd o/kmDk4nmPf+yzU7vIYhIPxU9+NPRtsDIfpHNcjVE6BikfhfOu8KASo0OeOoQJP4XMhW44VXabbct 6X7hYud0O18iDSb5usFsuDLPYY3c3E3ig71IflA7KenkTFNVBQ5bRbt0FEFfg19bw7GFC3u334/MT eleLva4A==; 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.97.1 #2 (Red Hat Linux)) id 1raVMo-0000000F6rf-2Dq1; Thu, 15 Feb 2024 06:37:06 +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 03/14] writeback: fix done_index when hitting the wbc->nr_to_write Date: Thu, 15 Feb 2024 07:36:38 +0100 Message-Id: <20240215063649.2164017-4-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215063649.2164017-1-hch@lst.de> References: <20240215063649.2164017-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-Rspamd-Queue-Id: B7AED18000A X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: ksm1ccsekes9krhrpccegcq5xcehxkwj X-HE-Tag: 1707979027-380863 X-HE-Meta: U2FsdGVkX184qWHd1liWTOeQfFNWb+nr3g3gSOHBWYzEYRI7DN8OqBikFN14bktPmnuJZhveKJePmlFEW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yKLVxH8LCK1LVI79DreQQ+zdaMmigHHO/cvH+L7QH9M6Rc1Wxdtceo5aoQ== 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 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 703e83c69ffe08..2679176da316b3 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) {