]> git.proxmox.com Git - mirror_zfs.git/commitdiff
ddt: remove DDE_GET_NDVAS macro
authorRob Norris <rob.norris@klarasystems.com>
Mon, 3 Jul 2023 05:25:06 +0000 (15:25 +1000)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 15 Feb 2024 19:45:10 +0000 (11:45 -0800)
It was a weird and confusing name, because it wasn't actually returning
the number of DVAs in the entry (as in, in the value/phys part) but the
maximum number of possible DVAs in a BP generated from the entry, based
on the encrypt bit in the key. This is unlike the similarly named
BP_GET_NDVAS, which really does return the number of DVAs.

Since its only used in this one place, and for a specific purpose, it
seemed more sensible to just write it in-place and remove the name.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Sponsored-by: Klara, Inc.
Sponsored-by: iXsystems, Inc.
Closes #15887

include/sys/ddt.h
module/zfs/ddt_stats.c

index a15354057683eb94cfbf35ce4ea16c698355eae9..39cffeb366a0fec0759595000a8ba6ad0eb053ac 100644 (file)
@@ -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;
index 05d0c22f92a57f39e6b8eb342269bc3b5191a7a7..1f1a1188f97cfeece4f1e84db48fc77924c3735c 100644 (file)
@@ -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;