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(-)