Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp857607rdb; Fri, 22 Dec 2023 07:09:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IEYUoFpaBOlCCd9Sd8jYiWFNghaRjcCYnTVWoS5lmOQvaCKm7ZqyqnLD4yFI2NtEgrsO3Ow X-Received: by 2002:a05:6a20:daa4:b0:195:47f5:251c with SMTP id iy36-20020a056a20daa400b0019547f5251cmr655218pzb.41.1703257739793; Fri, 22 Dec 2023 07:08:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703257739; cv=none; d=google.com; s=arc-20160816; b=P4R5TYUM8IK8iT4lh1kAz4HMTdTDMb1tw3+lhLWbyACXTttrC+aRItxbZiBu/ic0bS 13Mo/FX0TOOLzZRkBPZiLC4l4VQpVAq7HZdLtJTt45AICoYRvbcq40AWullhjw8yUVkY 1arqJEYeAR9YA7usK9ulYB/rC9TCPAw0ylNznWxAg4yAmgZmHbb9p23JSnQ4fvAscD8M gjVAywZjU+qrm0WIQOggNreG6zyNX1yoxWyvuxyDtG7cZNpAMQN+ntvwCv23nGo1XNeU VW6Bg/pkoKvnWe4IE9C3ASAo7t2nr98P0Nqd5AnNKKAFymo5mUSx1YkMALDApWpdSieR x54w== 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=O59wXtdUMZ0EU5oPQN+2CB6SQXGKJGnzgF8I6DSjZIU=; fh=m0HBXuwgOCKat7wyuY7vstPypqMqxNmINnjBv5+EUjU=; b=dGgUBLMVrA1L+AORpBIAynEMZpr2j1rtA1wXW7j4wuW6FxhylVgUV8FsadXfia81jU MPi2Ii+YDBUyu/8PF8FgLBDvmUQG3SRsVnpTuuizrBv9oL8V7HBsnJ9lN5VAXwmU977o aSx/r5Ri1oXdbW3GSE2Efp6XRWdv57smiRquYGGHNRqq5B9d6lpfvvRzYQP1fZ024pen WeH31wHZjOicKmt8dqaHnJutDmW+hExp84tSOirKh0sUNYDx72UTPP2wqEZQp3vCV0Ng XuggVxroaTHRw3mCatZp6XWW4TKWc3pIj3c6wWmWlp7Rtt6x1mmQ5lEn392zQUr1juhr s7KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=aS5F82fI; spf=pass (google.com: domain of linux-kernel+bounces-9813-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9813-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id i18-20020a63e452000000b005cdcf8f52b8si3441700pgk.414.2023.12.22.07.08.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 07:08:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9813-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=aS5F82fI; spf=pass (google.com: domain of linux-kernel+bounces-9813-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9813-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 4A4EF282381 for ; Fri, 22 Dec 2023 15:08:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AFA5023775; Fri, 22 Dec 2023 15:08:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="aS5F82fI" 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 934C423740; 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:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=O59wXtdUMZ0EU5oPQN+2CB6SQXGKJGnzgF8I6DSjZIU=; b=aS5F82fIeLyqjbDbpruxU1HGcc WQXg7y8/yE0x0IPr7i1D2yBjlFlejXENGDtSDqVKB52aCks5/PMU8iOPnlkrObxPoB03JpzfusjT4 TlTZhcDFBhtJ0CW/P5ng9a1WGaUIiwaynr6LU0Sz4grNjFWydHbArp1lEPeF5h/1de0qq4qcVmC8y BgFQf1BZMLSNpy9QWD0q74jXcJGLglsyebHBjGH39R8mSQzA2z+0v3+XEmEX7Ci44wyADYpMF1yc4 SUtmFOOJlJ1rBkJXKmmem5yHQD/NxZ+EXC5HkgmGRsvDDRCM8EUVu8ZCtpEjLUkqeh2hVnSXzgxZg +g1RIjNQ==; 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 1rGh8V-006BKh-0a; Fri, 22 Dec 2023 15:08:27 +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 v4 Date: Fri, 22 Dec 2023 16:08:10 +0100 Message-Id: <20231222150827.1329938-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. Changes since v3: - various commit log spelling fixes - remove a statement from a commit log that isn't true any more with the changes in v3 - rename a function - merge two helpers Diffstat: include/linux/pagevec.h | 18 ++ include/linux/writeback.h | 19 ++ mm/page-writeback.c | 328 +++++++++++++++++++++++++--------------------- 3 files changed, 215 insertions(+), 150 deletions(-)