From 6cc93ccde70dfe4c732600fd7787ca95a36f48f5 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 1e5ab59eb4..68b9076141 100644 --- a/module/zfs/spa_misc.c +++ b/module/zfs/spa_misc.c @@ -1837,7 +1837,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); /*