sdb icon indicating copy to clipboard operation
sdb copied to clipboard

Add blkptr command to sdb

Open PaulZ-98 opened this issue 4 years ago • 3 comments

= Problem

sdb does not interpret the bitfields within ZFS block pointers in order to generate a proper display

= Solution

Implement the blkptr command in sdb. It might have been possible to include some of the ZFS C code into python for this. However it seemed the most straightforward to just port the functionality into python.

This was mostly porting C macros, but pylint guided the coding to have some object oriented content.

Closes #27

PaulZ-98 avatar Aug 24 '21 18:08 PaulZ-98

I see that my bitfield operators can go into zfs/init.py so let me do some refactoring on that.

PaulZ-98 avatar Sep 30 '21 17:09 PaulZ-98

Pushed changes - eliminated lookup tables that we can get from zfs itself, and put bitfield operations in init.py

PaulZ-98 avatar Oct 07 '21 18:10 PaulZ-98

sdb> echo 0xffff98c0bdc630c0 | cast zio_t* | member io_bp | blkptr
DVA[0]=<5:98d7fd2000:20000> [L0 ZIL intent log] zilog2 uncompressed unencrypted LE contiguous unique single 20000L/20000P birth=102888885L/102888885P fill=0 cksum=31f21b5d88444753:eb8c9d829c60c5f6:17bb3:33e

I was able to use this on a crash dump.. so while I haven't checked the code, it seems to be working for me, and is useful.. so I'm going to approve it..

@sdimitro @ahrens do either of you want to give this a look? maybe we can get it integrated?

prakashsurya avatar Nov 16 '22 20:11 prakashsurya