Re: [PATCH v7] f2fs: support dynamic reserve/release for device aliasing
From: Daeho Jeong
Date: Thu Aug 20 2026 - 17:02:14 EST
On Thu, Aug 20, 2026 at 1:30 PM Christophe JAILLET
<christophe.jaillet@xxxxxxxxxx> wrote:
>
> Le 06/08/2026 à 03:48, Daeho Jeong a écrit :
> > 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>
>
> Hi,
>
> this patch has already reached -next, but 2 comments below, should they
> make any sense.
>
> > diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> > index cac03b8e91a1..8c3b57987f6c 100644
> > --- a/fs/f2fs/namei.c
> > +++ b/fs/f2fs/namei.c
> > @@ -425,6 +425,9 @@ static int f2fs_link(struct dentry *old_dentry, struct inode *dir,
> > if (!f2fs_is_checkpoint_ready(sbi))
> > return -ENOSPC;
> >
> > + if (IS_DEVICE_ALIASING(inode))
> > + return -EPERM;
> > +
> > err = fscrypt_prepare_link(old_dentry, dir, dentry);
> > if (err)
> > return err;
> > @@ -568,6 +571,9 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
> >
> > trace_f2fs_unlink_enter(dir, dentry);
> >
> > + if (IS_DEVICE_ALIASING(inode))
> > + return -EPERM;
> > +
>
> Based on surrounding goto, should this one be:
> err = -EPERM
> goto out;
> ?
>
> > if (unlikely(f2fs_cp_error(sbi))) {
> > err = -EIO;
> > goto out;
> > @@ -946,6 +952,9 @@ static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
> > bool old_is_dir = S_ISDIR(old_inode->i_mode);
> > int err;
> >
> > + if (IS_DEVICE_ALIASING(old_inode))
> > + return -EPERM;
> > +
> > if (unlikely(f2fs_cp_error(sbi)))
> > return -EIO;
> > if (!f2fs_is_checkpoint_ready(sbi))
> > @@ -1016,6 +1025,8 @@ static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
> > }
> >
> > if (new_inode) {
> > + if (IS_DEVICE_ALIASING(new_inode))
> > + return -EPERM;
>
> Based on surrounding goto, should this one be:
> err = -EPERM
> goto out_dir;
> ?
Oh, right. Thank you for letting me know this.
>
> >
> > err = -ENOTEMPTY;
> > if (old_is_dir && !f2fs_empty_dir(new_inode))
> > @@ -1143,6 +1154,9 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
> > int old_nlink = 0, new_nlink = 0;
> > int err;
> >
> > + if (IS_DEVICE_ALIASING(old_inode) || IS_DEVICE_ALIASING(new_inode))
> > + return -EPERM;
> > +
> > if (unlikely(f2fs_cp_error(sbi)))
> > return -EIO;
> > if (!f2fs_is_checkpoint_ready(sbi))
> [...]
>
> CJ