Re: [f2fs-dev] [PATCH v6] f2fs: support dynamic reserve/release for device aliasing
From: Chao Yu
Date: Wed Aug 05 2026 - 22:43:06 EST
On 8/6/26 00:43, Daeho Jeong wrote:
> On Tue, Aug 4, 2026 at 6:20 PM Chao Yu <chao@xxxxxxxxxx> wrote:
>>
>> On 7/30/26 23:46, Daeho Jeong wrote:
>>> From: Daeho Jeong <daehojeong@xxxxxxxxxx>
>>>
>>> This patch adds a dynamic management feature to the existing device
>>> aliasing functionality. It allows users to dynamically reserve or
>>> release specific devices from the filesystem's free pool at runtime
>>> through new ioctls.
>>>
>>> To support this, three new ioctls are introduced:
>>> - F2FS_IOC_RESERVE_DEV_ALIAS: This reclaims the space occupied by a
>>> device aliasing file. It first performs a capacity check, resets GC
>>> victim information for the target range, marks the segments as in-use
>>> to prevent new allocations, and then triggers GC to migrate existing
>>> valid data out of the range. Finally, it reserves these blocks in the
>>> SIT to effectively exclude the device from the usable capacity.
>>>
>>> - F2FS_IOC_RELEASE_DEV_ALIAS: This releases the reserved space of a
>>> previously reserved device aliasing file. It truncates the blocks
>>> associated with the file, which makes them available for general
>>> filesystem allocation again.
>>>
>>> - F2FS_IOC_GET_DEV_ALIAS_STATUS: This retrieves the current aliasing
>>> status of a device aliasing file, returning whether the file is
>>> released (inactive alias) or reserved (active alias, with blocks
>>> fully allocated on the device).
>>>
>>> Signed-off-by: Daeho Jeong <daehojeong@xxxxxxxxxx>
>> Reviewed-by: Chao Yu <chao@xxxxxxxxxx>
>>
>> Thanks,
>
> Oh, I overlooked that ei.blk includes the segment0_blkaddr offset (the
> metadata area), so `ei.blk % BLKS_PER_SEC(sbi)` incorrectly checked
> alignment from block 0 rather than the segment area start.
Oh, I may missed this...
>
> I am going to fix it using the `GET_SEGOFF_FROM_SEG0()` macro:
> if ((GET_SEGOFF_FROM_SEG0(sbi, ei.blk) % BLKS_PER_SEC(sbi)) ||
> (ei.len % BLKS_PER_SEC(sbi))) {
> ...
> }
Looks fine to me.
Thanks,
>
> Thanks,