Re: [f2fs-dev] [PATCH v2 03/20] f2fs: extend f2fs_folio_state for subpage blocks

From: Chao Yu

Date: Tue Nov 17 2026 - 03:54:16 EST


On 11/16/26 12:08, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@xxxxxxxxxx>
>
> With subpage blocks, even an order-0 folio holds several blocks, so
> track uptodate and dirty state per block for any folio that holds more
> than one block, not only for large folios.
>
> - Identify the folio state by a magic number. An order-0 folio can carry
> one now, so folio_test_large() no longer tells it apart from the
> context of a compressed page, which folio->private can also point to.
> Carry the page private flags over when the state is attached.
> - Make the uptodate and dirty helpers take block indices, and attach the
> state on demand in them. Some of their callers cannot return an error,
> e.g. f2fs_set_link() and f2fs_delete_entry() once a directory folio
> holds several blocks, so allocate the state with __GFP_NOFAIL, as
> ifs_alloc() does in iomap, and drop the allocation failure handling
> of the callers. The write paths attach the state before a folio is
> dirtied, so writeback does not normally have to allocate it.
> - Handle per-block state in invalidation, dirtying and writeback.
> - Clear PAGECACHE_TAG_TOWRITE as well as PAGECACHE_TAG_DIRTY in
> f2fs_clear_page_cache_dirty_tag().
>
> Some of these changes also apply to large folios when the block size
> equals PAGE_SIZE.
>
> Signed-off-by: Daeho Jeong <daehojeong@xxxxxxxxxx>
Reviewed-by: Chao Yu <chao@xxxxxxxxxx>

Thanks,