Re: [f2fs-dev] [PATCH v2 08/20] f2fs: adapt range operations and mmap for subpage blocks
From: Chao Yu
Date: Tue Nov 17 2026 - 06:05:10 EST
On 11/16/26 12:08, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@xxxxxxxxxx>
>
> - A writable PTE covers the whole folio, so page_mkwrite prepares
> every block of the folio up to EOF and dirties only those blocks. It
> reserves them only where it may allocate, i.e. not for a pinned file
> or a compressed cluster.
> - Align zero range, punch hole, preallocation and truncation to the
> block size instead of PAGE_SIZE. When i_size grows, write-protect the
> folio straddling the old EOF so that stores to its new blocks fault
> into page_mkwrite.
> - Update i_size of an extending direct write in ->end_io(), before
> iomap invalidates the page cache of the written range, as ext4 does.
> Otherwise, a read in between zero-fills the blocks beyond the old
> i_size in the folio straddling it and marks them uptodate, which hides
> the data just written.
> - Unmap every base page overlapping a punched or zeroed range, and
> truncate the page cache without truncate_pagecache_range(), whose
> unmap underflows for a range ending in the first page.
> - For SEEK_DATA, treat a NEW_ADDR block as data only if the block
> itself is dirty.
> - When truncation zeroes the tail of a page, mark only the block
> holding the new EOF dirty, not the blocks after it.
>
> The SEEK_DATA change also applies to large folios when the block size
> equals PAGE_SIZE. The direct write change applies to any block size, so
> i_size is also updated before the sync of an O_DSYNC direct write.
>
> Signed-off-by: Daeho Jeong <daehojeong@xxxxxxxxxx>
Reviewed-by: Chao Yu <chao@xxxxxxxxxx>
Thanks,