From fc3d34bd08d81f9189fd06ac641da4e2d82a56c7 Mon Sep 17 00:00:00 2001 From: Bi11 Date: Tue, 13 Feb 2024 05:53:33 +0800 Subject: [PATCH] BRT: Fix slop space calculation with block cloning Similar to deduplication, the size of data duplicated by block cloning should not be included in the slop space calculation. Reviewed-by: Brian Behlendorf Reviewed-by: Alexander Motin Signed-off-by: Yuxin Wang Closes #15874 --- module/zfs/spa_misc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c index 72b690162..24f038ad7 100644 --- a/module/zfs/spa_misc.c +++ b/module/zfs/spa_misc.c @@ -1822,7 +1822,8 @@ spa_get_slop_space(spa_t *spa) * deduplicated data, so since it's not useful to reserve more * space with more deduplicated data, we subtract that out here. */ - space = spa_get_dspace(spa) - spa->spa_dedup_dspace; + space = + spa_get_dspace(spa) - spa->spa_dedup_dspace - brt_get_dspace(spa); slop = MIN(space >> spa_slop_shift, spa_max_slop); /*