Message ID | dd9f9b5930072bfb64b727f5e2380f37f4fb46fb.1611627788.git.naohiro.aota@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: zoned block device support | expand |
On 1/26/2021 10:24 AM, Naohiro Aota wrote: > The implementation of fitrim is depending on space cache, which is not used > and disabled for zoned btrfs' extent allocator. So the current code does > not work with zoned btrfs. In the future, we can implement fitrim for zoned > btrfs by enabling space cache (but, only for fitrim) or scanning the extent > tree at fitrim time. But, for now, disallow fitrim in ZONED mode. > > Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> > Reviewed-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Thanks, Anand > --- > fs/btrfs/ioctl.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c > index 7f2935ea8d3a..f05b0b8b1595 100644 > --- a/fs/btrfs/ioctl.c > +++ b/fs/btrfs/ioctl.c > @@ -527,6 +527,14 @@ static noinline int btrfs_ioctl_fitrim(struct btrfs_fs_info *fs_info, > if (!capable(CAP_SYS_ADMIN)) > return -EPERM; > > + /* > + * btrfs_trim_block_group() is depending on space cache, which is > + * not available in ZONED mode. So, disallow fitrim in ZONED mode > + * for now. > + */ > + if (btrfs_is_zoned(fs_info)) > + return -EOPNOTSUPP; > + > /* > * If the fs is mounted with nologreplay, which requires it to be > * mounted in RO mode as well, we can not allow discard on free space >
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 7f2935ea8d3a..f05b0b8b1595 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -527,6 +527,14 @@ static noinline int btrfs_ioctl_fitrim(struct btrfs_fs_info *fs_info, if (!capable(CAP_SYS_ADMIN)) return -EPERM; + /* + * btrfs_trim_block_group() is depending on space cache, which is + * not available in ZONED mode. So, disallow fitrim in ZONED mode + * for now. + */ + if (btrfs_is_zoned(fs_info)) + return -EOPNOTSUPP; + /* * If the fs is mounted with nologreplay, which requires it to be * mounted in RO mode as well, we can not allow discard on free space