diff --git a/module/zfs/ddt_stats.c b/module/zfs/ddt_stats.c index 4ef6c3a07..af5365a1d 100644 --- a/module/zfs/ddt_stats.c +++ b/module/zfs/ddt_stats.c @@ -132,6 +132,9 @@ ddt_get_dedup_object_stats(spa_t *spa, ddt_object_t *ddo_total) /* Sum the statistics we cached in ddt_object_sync(). */ for (enum zio_checksum c = 0; c < ZIO_CHECKSUM_FUNCTIONS; c++) { ddt_t *ddt = spa->spa_ddt[c]; + if (!ddt) + continue; + for (ddt_type_t type = 0; type < DDT_TYPES; type++) { for (ddt_class_t class = 0; class < DDT_CLASSES; class++) { @@ -156,7 +159,10 @@ ddt_get_dedup_histogram(spa_t *spa, ddt_histogram_t *ddh) { for (enum zio_checksum c = 0; c < ZIO_CHECKSUM_FUNCTIONS; c++) { ddt_t *ddt = spa->spa_ddt[c]; - for (ddt_type_t type = 0; type < DDT_TYPES && ddt; type++) { + if (!ddt) + continue; + + for (ddt_type_t type = 0; type < DDT_TYPES; type++) { for (ddt_class_t class = 0; class < DDT_CLASSES; class++) { ddt_histogram_add(ddh,