Make zpool status dedup table support raw bytes -p output

Check if -p flag is enabled, and if so print dedup table with raw
bytes. Restructure the logic in zutil_pool to check if -p flag is
enabled before printing either the bytes or raw numbers.

Calls to print the data for DDT now all use
zfs_nicenum_format(). Increased DDT histogram column buffers
to 32 bytes to prevent truncation when -p is enabled.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Adi Gollamudi <adigollamudi@gmail.com>
Closes #11626
Closes #17926
This commit is contained in:
Aditya Gollamudi
2026-03-13 09:53:56 -07:00
committed by GitHub
parent 4d78b14c14
commit b481a8bbbf
5 changed files with 40 additions and 21 deletions
+4 -3
View File
@@ -2144,7 +2144,8 @@ dump_ddt_object(ddt_t *ddt, ddt_type_t type, ddt_class_t class)
(void) printf("%s: object=%llu\n", name,
(u_longlong_t)ddt->ddt_object[type][class]);
zpool_dump_ddt(NULL, &ddt->ddt_histogram[type][class]);
zpool_dump_ddt(NULL, &ddt->ddt_histogram[type][class],
dump_opt['P'] > 0);
if (dump_opt['D'] < 4)
return;
@@ -2221,7 +2222,7 @@ dump_all_ddts(spa_t *spa)
if (dump_opt['D'] > 1) {
(void) printf("DDT histogram (aggregated over all DDTs):\n");
ddt_get_dedup_histogram(spa, &ddh_total);
zpool_dump_ddt(&dds_total, &ddh_total);
zpool_dump_ddt(&dds_total, &ddh_total, dump_opt['P'] > 0);
}
dump_dedup_ratio(&dds_total);
@@ -8118,7 +8119,7 @@ dump_simulated_ddt(spa_t *spa)
(void) printf("Simulated DDT histogram:\n");
zpool_dump_ddt(&dds_total, &ddh_total);
zpool_dump_ddt(&dds_total, &ddh_total, dump_opt['P'] > 0);
dump_dedup_ratio(&dds_total);
}