Taught zdb -bb to print metadata totals
People often want estimates of how much of their pool is occupied by metadata, but they end up using lots of text processing on zdb's output to get it. So let's just...provide it for them. Now, zdb -bbbs will output something like: Blocks LSIZE PSIZE ASIZE avg comp %Total Type [...] 68 1.06M 272K 544K 8K 4.00 0.00 L6 Total 1.71K 212M 6.85M 13.7M 8K 30.91 0.00 L5 Total 1.71K 212M 6.85M 13.7M 8K 30.91 0.00 L4 Total 1.73K 214M 6.92M 13.8M 8K 30.89 0.00 L3 Total 18.7K 2.29G 111M 221M 11.8K 21.19 0.00 L2 Total 3.56M 454G 28.4G 56.9G 16.0K 15.97 0.19 L1 Total 308M 36.8T 28.2T 28.6T 95.1K 1.30 99.80 L0 Total 311M 37.3T 28.3T 28.6T 94.2K 1.32 100.00 Total 50.4M 774G 113G 291G 5.77K 6.85 0.99 Metadata Total Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rich Ercolani <rincebrain@gmail.com> Closes #14746
This commit is contained in:
parent
81a2b2e6a6
commit
6b6aaf6dc2
@ -6812,12 +6812,15 @@ dump_block_stats(spa_t *spa)
|
|||||||
|
|
||||||
if (dump_opt['b'] >= 2) {
|
if (dump_opt['b'] >= 2) {
|
||||||
int l, t, level;
|
int l, t, level;
|
||||||
|
char csize[32], lsize[32], psize[32], asize[32];
|
||||||
|
char avg[32], gang[32];
|
||||||
(void) printf("\nBlocks\tLSIZE\tPSIZE\tASIZE"
|
(void) printf("\nBlocks\tLSIZE\tPSIZE\tASIZE"
|
||||||
"\t avg\t comp\t%%Total\tType\n");
|
"\t avg\t comp\t%%Total\tType\n");
|
||||||
|
|
||||||
|
zfs_blkstat_t *mdstats = umem_zalloc(sizeof (zfs_blkstat_t),
|
||||||
|
UMEM_NOFAIL);
|
||||||
|
|
||||||
for (t = 0; t <= ZDB_OT_TOTAL; t++) {
|
for (t = 0; t <= ZDB_OT_TOTAL; t++) {
|
||||||
char csize[32], lsize[32], psize[32], asize[32];
|
|
||||||
char avg[32], gang[32];
|
|
||||||
const char *typename;
|
const char *typename;
|
||||||
|
|
||||||
/* make sure nicenum has enough space */
|
/* make sure nicenum has enough space */
|
||||||
@ -6860,6 +6863,15 @@ dump_block_stats(spa_t *spa)
|
|||||||
if (zb->zb_asize == 0)
|
if (zb->zb_asize == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (level != ZB_TOTAL && t < DMU_OT_NUMTYPES &&
|
||||||
|
(level > 0 || DMU_OT_IS_METADATA(t))) {
|
||||||
|
mdstats->zb_count += zb->zb_count;
|
||||||
|
mdstats->zb_lsize += zb->zb_lsize;
|
||||||
|
mdstats->zb_psize += zb->zb_psize;
|
||||||
|
mdstats->zb_asize += zb->zb_asize;
|
||||||
|
mdstats->zb_gangs += zb->zb_gangs;
|
||||||
|
}
|
||||||
|
|
||||||
if (dump_opt['b'] < 3 && level != ZB_TOTAL)
|
if (dump_opt['b'] < 3 && level != ZB_TOTAL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -6905,6 +6917,24 @@ dump_block_stats(spa_t *spa)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
zdb_nicenum(mdstats->zb_count, csize,
|
||||||
|
sizeof (csize));
|
||||||
|
zdb_nicenum(mdstats->zb_lsize, lsize,
|
||||||
|
sizeof (lsize));
|
||||||
|
zdb_nicenum(mdstats->zb_psize, psize,
|
||||||
|
sizeof (psize));
|
||||||
|
zdb_nicenum(mdstats->zb_asize, asize,
|
||||||
|
sizeof (asize));
|
||||||
|
zdb_nicenum(mdstats->zb_asize / mdstats->zb_count, avg,
|
||||||
|
sizeof (avg));
|
||||||
|
zdb_nicenum(mdstats->zb_gangs, gang, sizeof (gang));
|
||||||
|
|
||||||
|
(void) printf("%6s\t%5s\t%5s\t%5s\t%5s"
|
||||||
|
"\t%5.2f\t%6.2f\t",
|
||||||
|
csize, lsize, psize, asize, avg,
|
||||||
|
(double)mdstats->zb_lsize / mdstats->zb_psize,
|
||||||
|
100.0 * mdstats->zb_asize / tzb->zb_asize);
|
||||||
|
(void) printf("%s\n", "Metadata Total");
|
||||||
|
|
||||||
/* Output a table summarizing block sizes in the pool */
|
/* Output a table summarizing block sizes in the pool */
|
||||||
if (dump_opt['b'] >= 2) {
|
if (dump_opt['b'] >= 2) {
|
||||||
|
Loading…
Reference in New Issue
Block a user