Re: [PATCH 09/12] writeback: Factor writeback_iter_next() out of write_cache_pages()

From: Jan Kara
Date: Wed Jun 28 2023 - 05:27:48 EST


On Tue 27-06-23 16:31:17, Matthew Wilcox wrote:
> > > + if (error == AOP_WRITEPAGE_ACTIVATE) {
> > > + folio_unlock(folio);
> > > + error = 0;
> >
> > Note there really shouldn't be any need for this in outside of the
> > legacy >writepage case. But it might make sense to delay the removal
> > until after ->writepage is gone to avoid bugs in conversions.
>
> ext4_journalled_writepage_callback() still returns
> AOP_WRITEPAGE_ACTIVATE, and that's used by a direct call to
> write_cache_pages().

Yeah. For record ext4_journalled_writepage_callback() is a bit of an abuse
of writeback code by ext4 data=journal path but it seemed like a lesser
evil than duplicating write_cache_pages() code. Essentially we need to
iterate all dirty folios and call page_mkclean() on them (to stop folio
modifications through mmap while transaction commit code is writing these
pages to the journal). If we exported from page writeback code enough
helpers for dirty page iteration, we could get rid of
ext4_journalled_writepage_callback() and its AOP_WRITEPAGE_ACTIVATE usage
as well.

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR