openzfs / zfs

OpenZFS on Linux and FreeBSD
https://openzfs.github.io/openzfs-docs
Other
10.69k stars 1.76k forks source link

zdb: add extra -T flag to show histograms of BRT refcounts #16692

Closed robn closed 1 month ago

robn commented 1 month ago

Motivation and Context

I was comparing my local BRT use against what fast dedup might get me[^1], and realised I would like a nice breakdown of refcount distribution. So I made one.

Description

Repurposes -TTT to show histograms. The full per-DVA list is now -TTTT.

How Has This Been Tested?

By hand:

$ ./zdb -TTT crayon
BRT: used 292M; saved 309M; ratio 2.05x
BRT: vdev 0: refcnt 12.2K; used 292M; saved 309M

BRT: vdev 0: DVAs with 2^n refcnts:
             1:  11788 ****************************************
             2:    645 ***
             3:     40 *
             4:      3 *
             5:      1 *

Types of changes

Checklist:

[^1]: Turns out BRT is getting me basically everything I'd get from dedup. dedup would be marginally better at the cost of 11M unique entries. No thanks.

robn commented 1 month ago

Oh ugh, yeah. I meant to be counting DVAs. I'm not quite sure what I was thinking (at 11pm, probably not at all). Pushed what I think I meant.