mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-01-14 09:12:11 +03:00
zdb: factor out block histogram bin number computation
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name> Closes #16999
This commit is contained in:
parent
968cfc3df2
commit
250e2ec229
@ -6254,35 +6254,39 @@ skipped:
|
||||
*/
|
||||
int bin;
|
||||
|
||||
#define BIN(size) (highbit64(size) - 1)
|
||||
|
||||
switch (block_bin_mode) {
|
||||
case BIN_PSIZE: bin = highbit64(BP_GET_PSIZE(bp)) - 1; break;
|
||||
case BIN_LSIZE: bin = highbit64(BP_GET_LSIZE(bp)) - 1; break;
|
||||
case BIN_ASIZE: bin = highbit64(BP_GET_ASIZE(bp)) - 1; break;
|
||||
case BIN_PSIZE: bin = BIN(BP_GET_PSIZE(bp)); break;
|
||||
case BIN_LSIZE: bin = BIN(BP_GET_LSIZE(bp)); break;
|
||||
case BIN_ASIZE: bin = BIN(BP_GET_ASIZE(bp)); break;
|
||||
case BIN_AUTO: break;
|
||||
default: PANIC("bad block_bin_mode"); abort();
|
||||
}
|
||||
|
||||
if (block_bin_mode == BIN_AUTO)
|
||||
bin = highbit64(BP_GET_PSIZE(bp)) - 1;
|
||||
bin = BIN(BP_GET_PSIZE(bp));
|
||||
|
||||
zcb->zcb_psize_count[bin]++;
|
||||
zcb->zcb_psize_len[bin] += BP_GET_PSIZE(bp);
|
||||
zcb->zcb_psize_total += BP_GET_PSIZE(bp);
|
||||
|
||||
if (block_bin_mode == BIN_AUTO)
|
||||
bin = highbit64(BP_GET_LSIZE(bp)) - 1;
|
||||
bin = BIN(BP_GET_LSIZE(bp));
|
||||
|
||||
zcb->zcb_lsize_count[bin]++;
|
||||
zcb->zcb_lsize_len[bin] += BP_GET_LSIZE(bp);
|
||||
zcb->zcb_lsize_total += BP_GET_LSIZE(bp);
|
||||
|
||||
if (block_bin_mode == BIN_AUTO)
|
||||
bin = highbit64(BP_GET_ASIZE(bp)) - 1;
|
||||
bin = BIN(BP_GET_ASIZE(bp));
|
||||
|
||||
zcb->zcb_asize_count[bin]++;
|
||||
zcb->zcb_asize_len[bin] += BP_GET_ASIZE(bp);
|
||||
zcb->zcb_asize_total += BP_GET_ASIZE(bp);
|
||||
|
||||
#undef BIN
|
||||
|
||||
hist_skipped:
|
||||
if (!do_claim)
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user