diff options
Diffstat (limited to 'fs/btrfs/print-tree.c')
-rw-r--r-- | fs/btrfs/print-tree.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c index c1acbdcb476c..569205e651c7 100644 --- a/fs/btrfs/print-tree.c +++ b/fs/btrfs/print-tree.c | |||
@@ -44,7 +44,7 @@ static void print_dev_item(struct extent_buffer *eb, | |||
44 | static void print_extent_data_ref(struct extent_buffer *eb, | 44 | static void print_extent_data_ref(struct extent_buffer *eb, |
45 | struct btrfs_extent_data_ref *ref) | 45 | struct btrfs_extent_data_ref *ref) |
46 | { | 46 | { |
47 | pr_info("\t\textent data backref root %llu objectid %llu offset %llu count %u\n", | 47 | pr_cont("extent data backref root %llu objectid %llu offset %llu count %u\n", |
48 | btrfs_extent_data_ref_root(eb, ref), | 48 | btrfs_extent_data_ref_root(eb, ref), |
49 | btrfs_extent_data_ref_objectid(eb, ref), | 49 | btrfs_extent_data_ref_objectid(eb, ref), |
50 | btrfs_extent_data_ref_offset(eb, ref), | 50 | btrfs_extent_data_ref_offset(eb, ref), |
@@ -63,6 +63,7 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type) | |||
63 | u32 item_size = btrfs_item_size_nr(eb, slot); | 63 | u32 item_size = btrfs_item_size_nr(eb, slot); |
64 | u64 flags; | 64 | u64 flags; |
65 | u64 offset; | 65 | u64 offset; |
66 | int ref_index = 0; | ||
66 | 67 | ||
67 | if (item_size < sizeof(*ei)) { | 68 | if (item_size < sizeof(*ei)) { |
68 | #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 | 69 | #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 |
@@ -104,12 +105,20 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type) | |||
104 | iref = (struct btrfs_extent_inline_ref *)ptr; | 105 | iref = (struct btrfs_extent_inline_ref *)ptr; |
105 | type = btrfs_extent_inline_ref_type(eb, iref); | 106 | type = btrfs_extent_inline_ref_type(eb, iref); |
106 | offset = btrfs_extent_inline_ref_offset(eb, iref); | 107 | offset = btrfs_extent_inline_ref_offset(eb, iref); |
108 | pr_info("\t\tref#%d: ", ref_index++); | ||
107 | switch (type) { | 109 | switch (type) { |
108 | case BTRFS_TREE_BLOCK_REF_KEY: | 110 | case BTRFS_TREE_BLOCK_REF_KEY: |
109 | pr_info("\t\ttree block backref root %llu\n", offset); | 111 | pr_cont("tree block backref root %llu\n", offset); |
110 | break; | 112 | break; |
111 | case BTRFS_SHARED_BLOCK_REF_KEY: | 113 | case BTRFS_SHARED_BLOCK_REF_KEY: |
112 | pr_info("\t\tshared block backref parent %llu\n", offset); | 114 | pr_cont("shared block backref parent %llu\n", offset); |
115 | /* | ||
116 | * offset is supposed to be a tree block which | ||
117 | * must be aligned to nodesize. | ||
118 | */ | ||
119 | if (!IS_ALIGNED(offset, eb->fs_info->nodesize)) | ||
120 | pr_info("\t\t\t(parent %llu is NOT ALIGNED to nodesize %llu)\n", | ||
121 | offset, (unsigned long long)eb->fs_info->nodesize); | ||
113 | break; | 122 | break; |
114 | case BTRFS_EXTENT_DATA_REF_KEY: | 123 | case BTRFS_EXTENT_DATA_REF_KEY: |
115 | dref = (struct btrfs_extent_data_ref *)(&iref->offset); | 124 | dref = (struct btrfs_extent_data_ref *)(&iref->offset); |
@@ -117,12 +126,18 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type) | |||
117 | break; | 126 | break; |
118 | case BTRFS_SHARED_DATA_REF_KEY: | 127 | case BTRFS_SHARED_DATA_REF_KEY: |
119 | sref = (struct btrfs_shared_data_ref *)(iref + 1); | 128 | sref = (struct btrfs_shared_data_ref *)(iref + 1); |
120 | pr_info("\t\tshared data backref parent %llu count %u\n", | 129 | pr_cont("shared data backref parent %llu count %u\n", |
121 | offset, btrfs_shared_data_ref_count(eb, sref)); | 130 | offset, btrfs_shared_data_ref_count(eb, sref)); |
131 | /* | ||
132 | * offset is supposed to be a tree block which | ||
133 | * must be aligned to nodesize. | ||
134 | */ | ||
135 | if (!IS_ALIGNED(offset, eb->fs_info->nodesize)) | ||
136 | pr_info("\t\t\t(parent %llu is NOT ALIGNED to nodesize %llu)\n", | ||
137 | offset, (unsigned long long)eb->fs_info->nodesize); | ||
122 | break; | 138 | break; |
123 | default: | 139 | default: |
124 | btrfs_err(eb->fs_info, | 140 | pr_cont("(extent %llu has INVALID ref type %d)\n", |
125 | "extent %llu has invalid ref type %d", | ||
126 | eb->start, type); | 141 | eb->start, type); |
127 | return; | 142 | return; |
128 | } | 143 | } |