]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: disable FITRIM for zoned RT devices
authorChristoph Hellwig <hch@lst.de>
Sun, 17 Nov 2024 05:23:16 +0000 (06:23 +0100)
committerChristoph Hellwig <hch@lst.de>
Mon, 3 Feb 2025 04:49:10 +0000 (05:49 +0100)
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>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
fs/xfs/xfs_discard.c

index 3f2403a7b49ca3bf8062436dbad01e20d224f497..c1a306268ae439e439da0445429366beca8ef6fc 100644 (file)
@@ -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)