Introduce dedupused/dedupsaved pool properties

Currently there is only a dedup ratio reported via pool properties.
If dedup is enabled only for some datasets, it is impossible to say
how much space the ratio actually covers.  Fix this by introducing
dedupused/dedupsaved pool properties, similar to earlier added
block cloning ones.  Combined with work to expose allocation classes
stats, it should give user-space enough visibility to correlate
`zpool list` and `zfs list` space numbers.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Ryan Moeller <ryan.moeller@klarasystems.com>
Signed-off-by: Alexander Motin <alexander.motin@TrueNAS.com>
Closes #18245
This commit is contained in:
Alexander Motin
2026-02-25 09:41:38 -05:00
committed by GitHub
parent 3408332d71
commit 991fc56fae
10 changed files with 53 additions and 3 deletions
+15
View File
@@ -297,6 +297,21 @@ ddt_get_dedup_dspace(spa_t *spa)
return (spa->spa_dedup_dspace);
}
uint64_t
ddt_get_dedup_used(spa_t *spa)
{
ddt_stat_t dds_total = { 0 };
ddt_get_dedup_stats(spa, &dds_total);
return (dds_total.dds_dsize);
}
uint64_t
ddt_get_dedup_saved(spa_t *spa)
{
return (ddt_get_dedup_dspace(spa));
}
uint64_t
ddt_get_pool_dedup_ratio(spa_t *spa)
{
+4
View File
@@ -483,6 +483,10 @@ spa_prop_get_config(spa_t *spa, nvlist_t *nv)
spa_prop_add_list(nv, ZPOOL_PROP_DEDUPRATIO, NULL,
ddt_get_pool_dedup_ratio(spa), src);
spa_prop_add_list(nv, ZPOOL_PROP_DEDUPUSED, NULL,
ddt_get_dedup_used(spa), src);
spa_prop_add_list(nv, ZPOOL_PROP_DEDUPSAVED, NULL,
ddt_get_dedup_saved(spa), src);
spa_prop_add_list(nv, ZPOOL_PROP_BCLONEUSED, NULL,
brt_get_used(spa), src);
spa_prop_add_list(nv, ZPOOL_PROP_BCLONESAVED, NULL,