From patchwork Mon Dec 18 15:35:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13497155 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 EDE05C46CD2 for ; Mon, 18 Dec 2023 15:36:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2F92D8D0001; Mon, 18 Dec 2023 10:36:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A90D8D0009; Mon, 18 Dec 2023 10:36:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1993D8D0001; Mon, 18 Dec 2023 10:36:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 06E048D0009 for ; Mon, 18 Dec 2023 10:36:01 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id CCCE012071C for ; Mon, 18 Dec 2023 15:36:00 +0000 (UTC) X-FDA: 81580339680.24.40D0D58 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf27.hostedemail.com (Postfix) with ESMTP id 7323D4000C for ; Mon, 18 Dec 2023 15:35:58 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="ef/z6OGi"; dmarc=none; spf=none (imf27.hostedemail.com: domain of BATV+09f18f96a25a69770120+7421+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+09f18f96a25a69770120+7421+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702913758; 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=fOpePqIlVODGcmo3HFeeBH3g3RORLTSl2mjzxWXksuo=; b=qvc1SFXeu8yZakZ2JTPsJfDl5hRFFGOwQDRHE/MYYIBpktIflVi8D0B3CfsJN9RHHhfV76 WtAPQrLKG+cKFYR3RTrNW+adkwRpcED6p9Vo1FySwVb+KDZvc7brsARHjdDRjRLZTo8+5r REUcs5xf/TyD1eCejsWyguqL8gmWcIc= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="ef/z6OGi"; dmarc=none; spf=none (imf27.hostedemail.com: domain of BATV+09f18f96a25a69770120+7421+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+09f18f96a25a69770120+7421+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702913758; a=rsa-sha256; cv=none; b=JJp/zVYhYUIRGz6o5H9jIfaj5uUaaJOqWMFV2bIB+BukDJTHjLPf6wn3APZDWTXJK7Dw26 MoFsuKhmop3F5H8Vs2cBLifx8dfzfjpI13a36OeZRvP02fycz6GEO332r7f6QEQRESzlBd sZIqbAzyJhvqlPRxbeyGVQ4olzuYxAQ= 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=fOpePqIlVODGcmo3HFeeBH3g3RORLTSl2mjzxWXksuo=; b=ef/z6OGiym6VMWNndQHzrgSssf EBETFKYXoYJJtNq1C9mH3HuQTgUYIICMzdd+RJk8f+bqPeZKgzvB9r5denj/kjl/6Rx1laQB+QPKl DO3ufG2jER5Chm9x/qyjOt395t6P9gk68QkXovUQH5R59J5O3aMBsHkdqZnw8EXlo+8WSOXh2CyCo mGbZti/G13+GR2IhJD4QsOC5HvnTbrBUPuDxuY/KTbu8mGypWYmtg04XB2h+fqEHuLSDGv7gKBIqB miSSHI1Dm4Q6uZ/1EpT8SkEKNlarqS5kEziIicr0rCyU/RxykqvJqeHnylZgKnTxUOQqQ9FAasDJQ 4J/FaIDg==; 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 1rFFev-00BEH0-0h; Mon, 18 Dec 2023 15:35:57 +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 01/17] writeback: fix done_index when hitting the wbc->nr_to_write Date: Mon, 18 Dec 2023 16:35:37 +0100 Message-Id: <20231218153553.807799-2-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> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Stat-Signature: 49gdjnh9bbafeawgmhpw54cu7f3ecqej X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 7323D4000C X-HE-Tag: 1702913758-498268 X-HE-Meta: U2FsdGVkX191sKgDBksVTnyfU0ymSchtme1F04S9L1Ntfo+J21kEoAZXZOZEdkYiU8qgatvt9/tdc6S2LMXacMzUtnkhSFaskHaybzb+URQ1iK9/wdurFbe2fkrUKZr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tK8fVNFq7sYnRF5/dkhdD8iMCLc2hcG+qA7hidv7XZ7wlujPBXavaCxwDI5oxMDMHxHTIEHlcfFaHg5O5DaUNj76SXBHydcARE0oqS/BcMHm+hvb7kiA+1BVfofMdJI23Zlike34mzFlnCe2l3GTObonhxtQIVOFQmWzKLDUoTQMAORydU++RhYNNBvKKTxt5ByE7Mstr/o4OJc9flJpO/7asKLEutgSrnWuOd6dkSvgK4ZO9K1UqYWhRfOH+h/WAGPdzgtXcvkyIR2V/rOdaM= 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_inde 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 --- 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) {