Re: [f2fs-dev] [PATCH v2] f2fs: support resizable tail section and unify pinned allocation

From: Chao Yu

Date: Wed Aug 26 2026 - 21:11:27 EST


On 8/26/26 23:36, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@xxxxxxxxxx>
>
> Currently, zoned block devices restrict pinned file allocations to
> conventional zones at the beginning of the storage (before
> first_seq_zone_segno), triggering range GC when conventional space is
> exhausted.
>
> On regular block devices, when preparing for future online filesystem
> resizing (e.g. partition shrinking), pinned files must not be allocated
> in the tail area that will be truncated, as pinned files cannot be
> relocated by GC. Specifying the resizable tail area size (in sections)
> allows uniform mount configuration across devices of different storage
> capacities.
>
> To support this, introduce a unified `pinned_area_max_secno` boundary
> abstraction in `f2fs_sb_info`:
> 1. Add `-o resizable_tail_secno=%u` mount option to specify the number
> of sections at the tail of the filesystem reserved for resizing.
> 2. In `f2fs_fill_super()`, initialize `sbi->pinned_area_max_secno` as:
> min(MAIN_SECS(sbi) - resizable_tail_sec, zoned_max_sec).
> 3. In `get_new_segment()`, restrict segment allocation for pinned files
> (`pinning == true`) to `0 .. sbi->pinned_area_max_secno - 1`. If no
> free section is available in the pinned area, return -EAGAIN.
> 4. In `f2fs_allocate_pinning_section()`, unify the range GC trigger to
> run `f2fs_gc_range()` up to `sbi->pinned_area_max_secno` whenever
> `sbi->pinned_area_max_secno < MAIN_SECS(sbi)` and allocation
> returns -EAGAIN.
> 5. Expose `/sys/fs/f2fs/<dev>/pinned_area_max_secno` as a read-only
> sysfs node.
>
> Signed-off-by: Daeho Jeong <daehojeong@xxxxxxxxxx>
> Signed-off-by: Sunmin Jeong <s_min.jeong@xxxxxxxxxxx>
Reviewed-by: Chao Yu <chao@xxxxxxxxxx>

Thanks,