Skip to content

Commit

Permalink
zdb: fix BRT dump (openzfs#16335)
Browse files Browse the repository at this point in the history
BRT refcounts are stored as eight uint8_ts rather than a single
uint64_t. This means that za_first_integer is only the first byte, so
max 256. This fixes it by doing a lookup for the whole value.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.

Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
  • Loading branch information
robn authored and tonyhutter committed Nov 5, 2024
1 parent bb946ff commit 25ec9a9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cmd/zdb/zdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2208,8 +2208,13 @@ dump_brt(spa_t *spa)
for (zap_cursor_init(&zc, brt->brt_mos, brtvd->bv_mos_entries);
zap_cursor_retrieve(&zc, &za) == 0;
zap_cursor_advance(&zc)) {
uint64_t offset = *(uint64_t *)za.za_name;
uint64_t refcnt = za.za_first_integer;
uint64_t refcnt;
VERIFY0(zap_lookup_uint64(brt->brt_mos,
brtvd->bv_mos_entries,
(const uint64_t *)za.za_name, 1,
za.za_integer_length, za.za_num_integers, &refcnt));

uint64_t offset = *(const uint64_t *)za.za_name;

snprintf(dva, sizeof (dva), "%" PRIu64 ":%llx", vdevid,
(u_longlong_t)offset);
Expand Down

0 comments on commit 25ec9a9

Please sign in to comment.