From patchwork Mon Feb 12 07:13:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13552744 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 A3C41C48297 for ; Mon, 12 Feb 2024 07:14:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3DEDA6B0078; Mon, 12 Feb 2024 02:14:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 38E816B007B; Mon, 12 Feb 2024 02:14:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 22FF76B007E; Mon, 12 Feb 2024 02:14:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 1568D6B0078 for ; Mon, 12 Feb 2024 02:14:10 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id BFC5916092B for ; Mon, 12 Feb 2024 07:14:09 +0000 (UTC) X-FDA: 81782287818.07.2B57470 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf08.hostedemail.com (Postfix) with ESMTP id 28C01160009 for ; Mon, 12 Feb 2024 07:14:07 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=hQnFDH25; dmarc=none; spf=none (imf08.hostedemail.com: domain of BATV+56c964bc8172c8a9ee6e+7477+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+56c964bc8172c8a9ee6e+7477+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=1707722048; 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=64fRIZ4p3xI47I0UjDfQWbOQW89h4igNM/M4APDkPmk=; b=zStkI3pUgKJss0vdVbBWb+7Xn/SgTC9xWQKj7rEzHoBdX3H3gYbIBUzEgjNGjQL3Y0Fbdr hKdjZ6FQIwlh37Qj/HZJHNEUb38ViSuzz2IWYU+gXmP03XLqSmnITSYJx7jPsDDpkKAdYc 7OGblc9hqnUFMWsIMJSogCGgDZ8UWv0= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=hQnFDH25; dmarc=none; spf=none (imf08.hostedemail.com: domain of BATV+56c964bc8172c8a9ee6e+7477+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+56c964bc8172c8a9ee6e+7477+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707722048; a=rsa-sha256; cv=none; b=xukHRctIkKPStabHDvchCh00I9YzsVmYaVW5vOgC9ZSiCzGOX1Gj4CyiNfwTlVxVzm6ZD6 VBsdpboLGkXZ97/7fuotvmN5RTWwV1g5sGdFuINZZ5pQN0uLWXz66Z2f3Pr3FhKVz8gWDr YOjDX1deY25/EgPo2HiBBul/Ya40R8s= 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=64fRIZ4p3xI47I0UjDfQWbOQW89h4igNM/M4APDkPmk=; b=hQnFDH252tFU20hQNpYyUplf2R jumeUc/X4ZUzuexuSNHm/zyXaPRqcggyQGFdoyLASrp+lMWu36MwQwZda9DfA0i/tGTxurxcVuYk2 7vQX8a5ep+6PGO+lgk/7ZmNu31DToIMDnMWWY+Inpo4BxJEsJm3nuNY2w1S2m/Udr5dnhsz4m+w3g hzaOAlGV33RWtrmBE7qG4n77S7sz8swMFa3bkYWn2FVEhrxmydbyy+8dvY+/NHpSd8nKTnUt5B4MC VAQhbSlVmXb6BrgLz0ZDBvn5840bRz3glHriIl64SpSG9IT83gI/0PvG0Y+zfo6FPqO9mOGthd9Ck GyUqemog==; Received: from [2001:4bb8:190:6eab:75e9:7295:a6e3:c35d] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZQVw-00000004SpN-2Uys; Mon, 12 Feb 2024 07:14: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: Mon, 12 Feb 2024 08:13:37 +0100 Message-Id: <20240212071348.1369918-4-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240212071348.1369918-1-hch@lst.de> References: <20240212071348.1369918-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-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 28C01160009 X-Stat-Signature: nytp3mn3pppc7mdq45uuu7m8d6ozmk3y X-HE-Tag: 1707722047-850174 X-HE-Meta: U2FsdGVkX1/aRV0X9Y5F2XQKje2OLi6qpo/fqVQyLyBWiENXxjjdCgyB60usIOmWyFdkNkVDlC7W8sYLU6fN4GssYXmM4pJlKQW2p6PE7WVsKIA3Vxv8NpF30/4l5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/7I8n+gDrHAt4HGRt//hXmQMYZrR/6HEDTLUgBi9sFQdLksCnaC85KRzqEU1ZoySJU3y2EhJMCTQFAYtixRH+Cn/YH+XM/ojKLVSBFdyqf0J+JRNY0+wS/XItIio2bv05W87WA8mZFmcd92w3MgPalnpKdSNgRbyIGZJabNQPTrppsy4Nic5c1V4xF9V4VdQ0rAueOtqHWhHUWAoZg0qfXgxjpE/e6Ip5ffNJUdlrzpTJoko6Q7kh02fXA+K6DjcCyAgbb4OgaSs54GKM7HIshByoaIAI= 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 62901fa905f01e..aa3b432f77e37a 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) {