Re: Convert write_cache_pages() to an iterator v3

From: Dave Chinner
Date: Mon Dec 18 2023 - 16:01:11 EST


On Mon, Dec 18, 2023 at 04:35:36PM +0100, Christoph Hellwig wrote:
> 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(-)

I've just done a quick scan of the code - nothing stands out to me
as problematic, and I like how much cleaner the result is.

Acked-by: Dave Chinner <dchinner@xxxxxxxxxx>

--
Dave Chinner
david@xxxxxxxxxxxxx