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.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
Miao Xie 2010-07-13 09:18:04 +00:00 committed by Chris Mason
parent 4e64e05c6b
commit b4d668ee6b
1 changed files with 3 additions and 1 deletions

View File

@ -212,7 +212,9 @@ again:
read_extent_buffer(leaf, &ri, offset, sizeof(ri)); read_extent_buffer(leaf, &ri, offset, sizeof(ri));
buf = read_tree_block(tree_root_scan, buf = read_tree_block(tree_root_scan,
btrfs_root_bytenr(&ri), btrfs_root_bytenr(&ri),
tree_root_scan->leafsize, 0); btrfs_level_size(tree_root_scan,
btrfs_root_level(&ri)),
0);
switch(found_key.objectid) { switch(found_key.objectid) {
case BTRFS_ROOT_TREE_OBJECTID: case BTRFS_ROOT_TREE_OBJECTID:
if (!skip) if (!skip)