range_tree: Provide more debug details upon unexpected add/remove

Sponsored-by: Klara, Inc.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Igor Ostapenko <igor.ostapenko@klarasystems.com>
Closes #17581
This commit is contained in:
Igor Ostapenko
2025-07-31 17:44:42 +03:00
committed by GitHub
parent 2957eabbef
commit cb5e7e097d
13 changed files with 227 additions and 87 deletions
+17 -7
View File
@@ -902,7 +902,9 @@ vdev_trim_thread(void *arg)
ta.trim_vdev = vd;
ta.trim_extent_bytes_max = zfs_trim_extent_bytes_max;
ta.trim_extent_bytes_min = zfs_trim_extent_bytes_min;
ta.trim_tree = zfs_range_tree_create(NULL, ZFS_RANGE_SEG64, NULL, 0, 0);
ta.trim_tree = zfs_range_tree_create_flags(
NULL, ZFS_RANGE_SEG64, NULL, 0, 0,
ZFS_RT_F_DYN_NAME, vdev_rt_name(vd, "trim_tree"));
ta.trim_type = TRIM_TYPE_MANUAL;
ta.trim_flags = 0;
@@ -1305,8 +1307,10 @@ vdev_autotrim_thread(void *arg)
* Allocate an empty range tree which is swapped in
* for the existing ms_trim tree while it is processed.
*/
trim_tree = zfs_range_tree_create(NULL, ZFS_RANGE_SEG64,
NULL, 0, 0);
trim_tree = zfs_range_tree_create_flags(
NULL, ZFS_RANGE_SEG64, NULL, 0, 0,
ZFS_RT_F_DYN_NAME,
vdev_rt_name(vd, "autotrim_tree"));
zfs_range_tree_swap(&msp->ms_trim, &trim_tree);
ASSERT(zfs_range_tree_is_empty(msp->ms_trim));
@@ -1360,8 +1364,10 @@ vdev_autotrim_thread(void *arg)
if (!cvd->vdev_ops->vdev_op_leaf)
continue;
ta->trim_tree = zfs_range_tree_create(NULL,
ZFS_RANGE_SEG64, NULL, 0, 0);
ta->trim_tree = zfs_range_tree_create_flags(
NULL, ZFS_RANGE_SEG64, NULL, 0, 0,
ZFS_RT_F_DYN_NAME,
vdev_rt_name(vd, "autotrim_tree"));
zfs_range_tree_walk(trim_tree,
vdev_trim_range_add, ta);
}
@@ -1600,7 +1606,9 @@ vdev_trim_l2arc_thread(void *arg)
vd->vdev_trim_secure = 0;
ta.trim_vdev = vd;
ta.trim_tree = zfs_range_tree_create(NULL, ZFS_RANGE_SEG64, NULL, 0, 0);
ta.trim_tree = zfs_range_tree_create_flags(
NULL, ZFS_RANGE_SEG64, NULL, 0, 0,
ZFS_RT_F_DYN_NAME, vdev_rt_name(vd, "trim_tree"));
ta.trim_type = TRIM_TYPE_MANUAL;
ta.trim_extent_bytes_max = zfs_trim_extent_bytes_max;
ta.trim_extent_bytes_min = SPA_MINBLOCKSIZE;
@@ -1735,7 +1743,9 @@ vdev_trim_simple(vdev_t *vd, uint64_t start, uint64_t size)
ASSERT(!vd->vdev_top->vdev_rz_expanding);
ta.trim_vdev = vd;
ta.trim_tree = zfs_range_tree_create(NULL, ZFS_RANGE_SEG64, NULL, 0, 0);
ta.trim_tree = zfs_range_tree_create_flags(
NULL, ZFS_RANGE_SEG64, NULL, 0, 0,
ZFS_RT_F_DYN_NAME, vdev_rt_name(vd, "trim_tree"));
ta.trim_type = TRIM_TYPE_SIMPLE;
ta.trim_extent_bytes_max = zfs_trim_extent_bytes_max;
ta.trim_extent_bytes_min = SPA_MINBLOCKSIZE;