sdb
sdb copied to clipboard
Add blkptr command to sdb
= 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
I see that my bitfield operators can go into zfs/init.py so let me do some refactoring on that.
Pushed changes - eliminated lookup tables that we can get from zfs itself, and put bitfield operations in init.py
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?