Re: [f2fs-dev] [PATCH v2 07/20] f2fs: support subpage blocks in data write path and writeback

From: Chao Yu

Date: Tue Nov 17 2026 - 05:43:44 EST


On 11/16/26 12:08, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@xxxxxxxxxx>
>
> With blocks smaller than PAGE_SIZE, a folio holds several blocks, so
> write_begin, write_end and writeback have to handle individual blocks
> instead of the whole folio.
>
> - Read, zero and reserve the blocks touched by a write per block in
> write_begin, and mark only the written blocks dirty in write_end.
> - Write back only the dirty blocks of a multi-block folio and complete
> write I/O per block. In subpage mode every inode is written back by
> f2fs_write_cache_folios(), which now handles dentry and quota folios
> and checkpoint errors as f2fs_write_single_data_page() does. Both use
> the new f2fs_cp_controlled_inode() and f2fs_wb_folio_action() helpers
> for these rules.
> It also resets the error for each folio, so that the remaining folios
> are still written back after an error, as writeback_iter() expects
> for integrity writeback, instead of redirtying them.
> f2fs_write_folio_dirty_range() cleans up each block where it is
> written or skipped, and advances last_disk_size only up to the last
> block it submitted. On an error, it clears the dirty state of the
> blocks before the failed one, so that only the failed block and the
> ones after it are written again.
> - Count inode dirty blocks from the dirty bits of the folio state, and
> count every block of a folio dirtied without one, e.g. after a read
> of the whole folio or through folio_mark_dirty(). Attaching a folio
> state to a dirty folio converts its count to the dirty bits, so the
> counter stays balanced.
> - ->dirty_folio() does not know which blocks were modified, so it marks
> the uptodate blocks of the folio within EOF dirty. Otherwise, a folio
> dirtied by mm after writeback cleared its dirty bits, e.g. through a
> pinned page, is cleaned without being written. The updates made by
> f2fs mark only the blocks they modify and dirty the folio with
> f2fs_folio_mark_dirty(), which keeps the other blocks clean.
> - Compressed and atomic files are not supported yet in subpage mode:
> write_begin returns -EOPNOTSUPP for them. Inline data is converted
> first.
>
> 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,