Skip to contentSkip to conversation

btrfs-progs: fix wrong extent buffer size when reading tree block

PATCH New Miao Xie 1 participant 1 message Jul 13, 2010 Btrfs file system

lore
Share & tools
lore

Miao Xie

author
#0 lore raw

PATCH 1/1 btrfs-progs: fix wrong extent buffer size when reading tree block

the root extent buffer of a tree may not be a leaf, so we must get the right size by its level when reading it.

---
 debug-tree.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
debug-tree.c +3 -1
index 40628e0..cf637ab 100644
@@ -208,7 +208,9 @@ again:
 			read_extent_buffer(leaf, &ri, offset, sizeof(ri));
 			buf = read_tree_block(tree_root_scan,
 					      btrfs_root_bytenr(&ri),
-					      tree_root_scan->leafsize, 0);
+					      btrfs_level_size(tree_root_scan,
+							btrfs_root_level(&ri)),
+					      0);
 			switch(found_key.objectid) {
 			case BTRFS_ROOT_TREE_OBJECTID:
 				if (!skip)
Signature · 1 line
1.7.0.1