diff --git a/include/sys/ddt.h b/include/sys/ddt.h index a153540576..39cffeb366 100644 --- a/include/sys/ddt.h +++ b/include/sys/ddt.h @@ -89,9 +89,6 @@ typedef struct ddt_key { #define DDK_GET_CRYPT(ddk) BF64_GET((ddk)->ddk_prop, 39, 1) #define DDK_SET_CRYPT(ddk, x) BF64_SET((ddk)->ddk_prop, 39, 1, x) -#define DDE_GET_NDVAS(dde) (DDK_GET_CRYPT(&dde->dde_key) \ - ? SPA_DVAS_PER_BP - 1 : SPA_DVAS_PER_BP) - typedef struct ddt_phys { dva_t ddp_dva[SPA_DVAS_PER_BP]; uint64_t ddp_refcnt; diff --git a/module/zfs/ddt_stats.c b/module/zfs/ddt_stats.c index 05d0c22f92..1f1a1188f9 100644 --- a/module/zfs/ddt_stats.c +++ b/module/zfs/ddt_stats.c @@ -49,7 +49,9 @@ ddt_stat_generate(ddt_t *ddt, ddt_entry_t *dde, ddt_stat_t *dds) if (ddp->ddp_phys_birth == 0) continue; - for (int d = 0; d < DDE_GET_NDVAS(dde); d++) + int ndvas = DDK_GET_CRYPT(&dde->dde_key) ? + SPA_DVAS_PER_BP - 1 : SPA_DVAS_PER_BP; + for (int d = 0; d < ndvas; d++) dsize += dva_get_dsize_sync(spa, &ddp->ddp_dva[d]); dds->dds_blocks += 1;