Received: by 2002:a05:7412:8d06:b0:f9:332d:97f1 with SMTP id bj6csp11105rdb; Mon, 18 Dec 2023 07:38:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFvsZUohLFzxhG0SCJ2AtlccqSaW3IdH4g9x2kuOoA7eYSxWYWn8yqtN04rvnltOLvfH1Fv X-Received: by 2002:a05:6a20:7da5:b0:187:c496:898b with SMTP id v37-20020a056a207da500b00187c496898bmr9871433pzj.3.1702913905564; Mon, 18 Dec 2023 07:38:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702913905; cv=none; d=google.com; s=arc-20160816; b=f6CLGChiqigpwFqNnkumLTnRxGz8D/pGLmg3q/3b/2CcTqF7HuX2trGXfkKB5mbOAy 71XjRt9DkcVL2bl6rtd44Na5GPO2tScjYZXN+xxVKwe/k8+iQd62PVskdxycCKRfUMD/ Gu9wnTUYaK55LuVxtCvl6YjWUnzgAY6y14Kdam65ITEEsnhlGgrONMg7g+Q2jL7AKd5y Qr4SmY1nrEY8gsZOs9wIC+X8fpIdLTyXGpIjfgSaRSeLmBr1CH7OjYdBlhvJHxcMPxYf ISTbgSG0w4wn7J5WmTzZxSakPN/0WW1tM9ps1O9pPPDpcryE4pwkrWcoMcb0lvUQt2/Q qlOQ== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=RI7QSWqpW/rXOSRWmDYPC2oSmh16kWQUwrhbSyLEfQE=; fh=m0HBXuwgOCKat7wyuY7vstPypqMqxNmINnjBv5+EUjU=; b=kYjOk9kUb0fmJVpJ3q18LBdxcVg1tpIfSTR7MMyhKlyl4DNNcowefhEvGYAG6iHWdF 9LzWnIwUl9A8HwCPwhfkqvPHNXGAUemgWPOwpEhwvVJsf27p10ERPKWLzKtm+p0v7jyf 6dQIQAwh7Wf4WuajUR7egR4UQdX1Bx6wXxjteIECyriWQ4Df/uUJFrgc/fOl9Qp9TMih FdbMJVbIdiDSn48GXI18IqqFtemeLsJHuuaSkCZsyun8akb3BOIzCVjjHoLzkqc+gKHz oKxQWU60gYFdoLVHOue0EQ/CBryp895117c7t0owM8ipD139wWCfCRe/LCvvthbkULKo b2lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=hr8byNok; spf=pass (google.com: domain of linux-kernel+bounces-3943-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3943-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id e17-20020a056a001a9100b006cbee3a0c06si18107745pfv.6.2023.12.18.07.38.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 07:38:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3943-linux.lists.archive=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=hr8byNok; spf=pass (google.com: domain of linux-kernel+bounces-3943-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3943-linux.lists.archive=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 CA82DB2297F for ; Mon, 18 Dec 2023 15:36:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E0BA749886; Mon, 18 Dec 2023 15:36:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="hr8byNok" 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 D8C6A3D557; Mon, 18 Dec 2023 15:36:00 +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:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=RI7QSWqpW/rXOSRWmDYPC2oSmh16kWQUwrhbSyLEfQE=; b=hr8byNokwE2STMeHvc1D6nVSD7 HY4KMjQkEHSA6KKAYU3EMbGbDd61EizaOitfi2q47tbqkHkCXMJvKKra6kGOwnE6FM5JWNNqwb7Wq sKxXqwePDIeAq75ju43zRv8/f3XKuI4OYwY2uv35FyDQAeWHR/ARBjgHp0xeqFbBYVSJvxGwoBOto uJli+WJtw1f+u3NbdclmwVazKFxCxW3XAg6xP9rMED7G49LKm8WOzb6GSpqF3n651wQwRgz8sd0Yq XfrTinM8CzSi1KYt0hMdjpIKESyAB/6MGND/n4Ivl1V7dYFG5swW0Fbhf1i9YRJEy0dhZxLVpvmOF yzYTtEww==; 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 1rFFes-00BEFW-2N; Mon, 18 Dec 2023 15:35:55 +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: Convert write_cache_pages() to an iterator v3 Date: Mon, 18 Dec 2023 16:35:36 +0100 Message-Id: <20231218153553.807799-1-hch@lst.de> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Hi all, this is basically a evolution of the series Matthew Wilcox originally set in June. Based on comments from Jan a Brian this now actually untangles some of the more confusing conditional in the writeback code before refactoring it into the iterator. Because of that all the later patches need a fair amount of rebasing and I've not carried any reviewed-by over. The original cover letter is below: Dave Howells doesn't like the indirect function call imposed by write_cache_pages(), so refactor it into an iterator. I took the opportunity to add the ability to iterate a folio_batch without having an external variable. This is against next-20230623. If you try to apply it on top of a tree which doesn't include the pagevec removal series, IT WILL CRASH because it won't reinitialise folio_batch->i and the iteration will index out of bounds. I have a feeling the 'done' parameter could have a better name, but I can't think what it might be. Diffstat: include/linux/pagevec.h | 18 ++ include/linux/writeback.h | 19 ++ mm/page-writeback.c | 333 +++++++++++++++++++++++++--------------------- 3 files changed, 220 insertions(+), 150 deletions(-)