Skip to content

Commit

Permalink
btrfs-progs: check: handle compressed extents when checking tree log
Browse files Browse the repository at this point in the history
Use the correct address and size when looking for the csums for a
compressed extent in the tree log.

Signed-off-by: Mark Harmstone <[email protected]>
  • Loading branch information
maharmstone authored and adam900710 committed Oct 20, 2024
1 parent f6dc0e8 commit 175cbfc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions check/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 175cbfc

Please sign in to comment.