From bf61a507a276866d691a2b56866302bc42145af3 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Thu, 21 Jul 2022 02:16:29 +0200 Subject: [PATCH] zdb: dump spill block pointer if present Output will look like so: $ sudo zdb -dddd -vv testpool/fs 2 Dataset testpool/fs [ZPL], ID 260, cr_txg 8, 25K, 7 objects, rootbp DVA[0]=<0:1800be00:200> DVA[1]=<0:1c00be00:200> [L0 DMU objset] fletcher4 lz4 unencrypted LE contiguous unique double size=1000L/200P birth=16L/16P fill=7 cksum=d03b396cd:489ca835517:d4b04a4d0a62:1b413aac454d53 Object lvl iblk dblk dsize dnsize lsize %full type 2 1 128K 512 1K 512 512 0.00 ZFS plain file (K=inherit) (Z=inherit=lz4) 192 bonus System attributes dnode flags: USED_BYTES USERUSED_ACCOUNTED USEROBJUSED_ACCOUNTED SPILL_BLKPTR dnode maxblkid: 0 path /testfile uid 0 gid 0 atime Fri Jul 15 12:36:35 2022 mtime Fri Jul 15 12:36:35 2022 ctime Fri Jul 15 12:36:51 2022 crtime Fri Jul 15 12:36:35 2022 gen 10 mode 100600 size 0 parent 34 links 1 pflags 840800000004 SA xattrs: 248 bytes, 2 entries security.selinux = nutanix_u:object_r:unlabeled_t:s0\000 user.foo = xbLQJjyVvEVPGGuRHV/gjkFFO1MdehKnLjjd36ZaoMVaUqtqFoMMYT5Ya9yywHApJNoK/1hNJfO3\012XCJWv9/QUTKamoWW9xVDE7yi8zn166RNw5QUhf84cZ3JNLnw6oN Spill block: 0:10005c00:200 0:14005c00:200 200L/200P F=1 B=16/16 cksum=1cdfac47a4:910c5caa557:195d0493dfe5a:332b6fde6ad547 Indirect blocks: Reviewed-by: Brian Behlendorf Reviewed-by: Allan Jude Signed-off-by: Christian Schwarz Closes #13640 --- cmd/zdb/zdb.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index fff00a64ac..fdf569691c 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -3565,8 +3565,15 @@ dump_object(objset_t *os, uint64_t object, int verbosity, *print_header = B_TRUE; } - if (verbosity >= 5) + if (verbosity >= 5) { + if (dn->dn_phys->dn_flags & DNODE_FLAG_SPILL_BLKPTR) { + char blkbuf[BP_SPRINTF_LEN]; + snprintf_blkptr_compact(blkbuf, sizeof (blkbuf), + DN_SPILL_BLKPTR(dn->dn_phys), B_FALSE); + (void) printf("\nSpill block: %s\n", blkbuf); + } dump_indirect(dn); + } if (verbosity >= 5) { /*