nicholasbishop / ext4-view-rs

Rust library for reading ext2/ext4 filesystems
https://crates.io/crates/ext4-view
Apache License 2.0
8 stars 2 forks source link

Fix block_from_file_block for extents with non-zero start #247

Closed nicholasbishop closed 1 month ago

nicholasbishop commented 1 month ago

The test disk has experienced relatively few operations compared to a real-world filesystem, so it doesn't have much fragmentation. In particular, all of its directory tree inodes currently have a single extent with a relative offset of 0. This allowed the tests to miss that the arithmetic for converting from a file block to an absolute block was slightly off: the extents relative start must be subtractred from the relative block.

Also add a test case that manually constructs some extents to better exercise this code.