I’ve recently been messing about with blktrace, and needed to quickly and easily look up filenames from block numbers parsed out from blktrace on ext4 systems.
Firing up debugfs from inside Go every time I needed to lookup a block was expensive, so I decided to create my own solution and interface with libext2fs directly.
My use case is currently looking up inodes and data blocks, so that is all that is currently implemented. I also do not use the block iterate functions from the libext2fs library due to the unneeded overhead of looping over extent blocks when you can just make use of the start and computed end lba to compare against the lookup block.
I hope this may be useful to someone.
Open to any feedback or suggestions.