mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 18:43:33 +02:00
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>
This commit is contained in:
parent
7d2197b5dc
commit
4dc1c3d0ae
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user