Re: [PATCH 20/43] xfs: disable FITRIM for zoned RT devices

Darrick J. Wong
2024-12-12T22:13:13Z

On Wed, Dec 11, 2024 at 09:54:45AM +0100, Christoph Hellwig wrote:
> The zoned allocator unconditionally issues zone resets or discards after
> emptying an entire zone, so supporting FITRIM for a zoned RT device is
> not useful.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Makes sense,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
> fs/xfs/xfs_discard.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c
> index c4bd145f5ec1..4447c835a373 100644
> --- a/fs/xfs/xfs_discard.c
> +++ b/fs/xfs/xfs_discard.c
> @@ -844,7 +844,8 @@ xfs_ioc_trim(
>
> if (!capable(CAP_SYS_ADMIN))
> return -EPERM;
> - if (mp->m_rtdev_targp &&
> +
> + if (mp->m_rtdev_targp && !xfs_has_zoned(mp) &&
> bdev_max_discard_sectors(mp->m_rtdev_targp->bt_bdev))
> rt_bdev = mp->m_rtdev_targp->bt_bdev;
> if (!bdev_max_discard_sectors(mp->m_ddev_targp->bt_bdev) && !rt_bdev)
> --
> 2.45.2
>
>