diff options
| author | Filipe Manana <fdmanana@suse.com> | 2025-09-15 11:09:10 +0100 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2025-09-23 08:49:22 +0200 |
| commit | 4dc1c3d0ae6fbfaf8ce5727d1ae098275eb276c6 (patch) | |
| tree | 2410d06c85850dfe354a4eb67975cc67a1f9d165 /fs/btrfs/print-tree.c | |
| parent | 7d2197b5dc0cd02e9758fd4dd0d1e7e3707dfbe7 (diff) | |
btrfs: print-tree: print range information for extent csum items
Currently we don't print anything for extent csum items other than the
generic line with the key, item offset and item size. While one can still
determine the range the extent csum covers by doing a few simple
computations, it makes it more time consuming to analyse a leaf dump.
So add a line that prints information about the range covered by the
checksum using the same format as btrfs-progs. This is useful when
debugging log tree issues since we log extent csum items for new extents.
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/print-tree.c')
| -rw-r--r-- | fs/btrfs/print-tree.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c index a66aced1d29c..c2898fa6d4ba 100644 --- a/fs/btrfs/print-tree.c +++ b/fs/btrfs/print-tree.c @@ -325,6 +325,18 @@ static void print_dir_log_index_item(const struct extent_buffer *eb, int i) pr_info("\t\tdir log end %llu\n", btrfs_dir_log_end(eb, dlog)); } +static void print_extent_csum(const struct extent_buffer *eb, int i) +{ + const struct btrfs_fs_info *fs_info = eb->fs_info; + const u32 size = btrfs_item_size(eb, i); + const u32 csum_bytes = (size / fs_info->csum_size) * fs_info->sectorsize; + struct btrfs_key key; + + btrfs_item_key_to_cpu(eb, &key, i); + pr_info("\t\trange start %llu end %llu length %u\n", + key.offset, key.offset + csum_bytes, csum_bytes); +} + void btrfs_print_leaf(const struct extent_buffer *l) { struct btrfs_fs_info *fs_info; @@ -373,6 +385,9 @@ void btrfs_print_leaf(const struct extent_buffer *l) case BTRFS_DIR_LOG_INDEX_KEY: print_dir_log_index_item(l, i); break; + case BTRFS_EXTENT_CSUM_KEY: + print_extent_csum(l, i); + break; case BTRFS_ROOT_ITEM_KEY: ri = btrfs_item_ptr(l, i, struct btrfs_root_item); pr_info("\t\troot data bytenr %llu refs %u\n", |