Re: [f2fs-dev] [RFC PATCH v2 01/10] f2fs: extend folio state for large folio write path

From: Nanzhe Zhao

Date: Mon Jul 06 2026 - 03:55:05 EST


Hi Chao,

> Yes, this can happen. By design, prepare_large_folio_write_begin() skips
> f2fs_folio_state allocation when the write fully covers the entire large
> folio (i.e., the folio is already uptodate or len == folio_size(folio)).
> This is an optimization for normal buffered writes; I somehow didn't apply
> the same optimization to atomic buffered writes since they are relatively
> rare.
>
> In that case, f2fs_update_dirty_folio() may call folio_set_f2fs_reference()
> on a large folio that does not yet have an ffs, so the flag is stored
> directly in folio->private.
>
> But I agree this is a bit subtle and worth discussing.

This is regarding to

> Why this can happen? allocating large folio from other paths?
>
> referring to:
> if (folio_test_private(folio) && folio_test_f2fs_nonpointer(folio))
> private_flags = (unsigned long)folio->private;

Thanks,
Nanzhe