btrfs-progs: check: handle compressed extents when checking tree log

Use the correct address and size when looking for the csums for a
compressed extent in the tree log.

Signed-off-by: Mark Harmstone <maharmstone@fb.com>
This commit is contained in:
Mark Harmstone 2024-10-04 15:49:58 +01:00 committed by Qu Wenruo
parent f6dc0e860f
commit 175cbfc5a2
1 changed files with 8 additions and 3 deletions

View File

@ -9807,9 +9807,14 @@ static int check_log_root(struct btrfs_root *root, struct cache_tree *root_cache
if (btrfs_file_extent_type(leaf, fi) != BTRFS_FILE_EXTENT_REG)
goto next;
addr = btrfs_file_extent_disk_bytenr(leaf, fi) +
btrfs_file_extent_offset(leaf, fi);
length = btrfs_file_extent_num_bytes(leaf, fi);
if (btrfs_file_extent_compression(leaf, fi)) {
addr = btrfs_file_extent_disk_bytenr(leaf, fi);
length = btrfs_file_extent_disk_num_bytes(leaf, fi);
} else {
addr = btrfs_file_extent_disk_bytenr(leaf, fi) +
btrfs_file_extent_offset(leaf, fi);
length = btrfs_file_extent_num_bytes(leaf, fi);
}
ret = check_log_csum(root, addr, length);
if (ret < 0) {