From 175cbfc5a26717575b99fae209c6472842ed1d4c Mon Sep 17 00:00:00 2001 From: Mark Harmstone Date: Fri, 4 Oct 2024 15:49:58 +0100 Subject: [PATCH] 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 --- check/main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/check/main.c b/check/main.c index b3da286a..366bb182 100644 --- a/check/main.c +++ b/check/main.c @@ -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) {