forked from Mirrors/btrfs-progs
btrfs-progs: drop blocksize from read_tree_block
Signed-off-by: David Sterba <dsterba@suse.com>master
parent
1fa9653dc8
commit
98909c21d7
|
@ -450,8 +450,7 @@ static int __add_missing_keys(struct btrfs_fs_info *fs_info,
|
||||||
if (ref->key_for_search.type)
|
if (ref->key_for_search.type)
|
||||||
continue;
|
continue;
|
||||||
BUG_ON(!ref->wanted_disk_byte);
|
BUG_ON(!ref->wanted_disk_byte);
|
||||||
eb = read_tree_block(fs_info, ref->wanted_disk_byte,
|
eb = read_tree_block(fs_info, ref->wanted_disk_byte, 0);
|
||||||
fs_info->nodesize, 0);
|
|
||||||
if (!extent_buffer_uptodate(eb)) {
|
if (!extent_buffer_uptodate(eb)) {
|
||||||
free_extent_buffer(eb);
|
free_extent_buffer(eb);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
@ -804,8 +803,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
|
||||||
ref->level == 0) {
|
ref->level == 0) {
|
||||||
struct extent_buffer *eb;
|
struct extent_buffer *eb;
|
||||||
|
|
||||||
eb = read_tree_block(fs_info, ref->parent,
|
eb = read_tree_block(fs_info, ref->parent, 0);
|
||||||
fs_info->nodesize, 0);
|
|
||||||
if (!extent_buffer_uptodate(eb)) {
|
if (!extent_buffer_uptodate(eb)) {
|
||||||
free_extent_buffer(eb);
|
free_extent_buffer(eb);
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
|
|
|
@ -168,7 +168,7 @@ static int corrupt_keys_in_block(struct btrfs_fs_info *fs_info, u64 bytenr)
|
||||||
{
|
{
|
||||||
struct extent_buffer *eb;
|
struct extent_buffer *eb;
|
||||||
|
|
||||||
eb = read_tree_block(fs_info, bytenr, fs_info->nodesize, 0);
|
eb = read_tree_block(fs_info, bytenr, 0);
|
||||||
if (!extent_buffer_uptodate(eb))
|
if (!extent_buffer_uptodate(eb))
|
||||||
return -EIO;;
|
return -EIO;;
|
||||||
|
|
||||||
|
@ -297,7 +297,6 @@ static void btrfs_corrupt_extent_tree(struct btrfs_trans_handle *trans,
|
||||||
struct extent_buffer *next;
|
struct extent_buffer *next;
|
||||||
|
|
||||||
next = read_tree_block(fs_info, btrfs_node_blockptr(eb, i),
|
next = read_tree_block(fs_info, btrfs_node_blockptr(eb, i),
|
||||||
fs_info->nodesize,
|
|
||||||
btrfs_node_ptr_generation(eb, i));
|
btrfs_node_ptr_generation(eb, i));
|
||||||
if (!extent_buffer_uptodate(next))
|
if (!extent_buffer_uptodate(next))
|
||||||
continue;
|
continue;
|
||||||
|
@ -765,7 +764,7 @@ static int corrupt_metadata_block(struct btrfs_fs_info *fs_info, u64 block,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
eb = read_tree_block(fs_info, block, fs_info->nodesize, 0);
|
eb = read_tree_block(fs_info, block, 0);
|
||||||
if (!extent_buffer_uptodate(eb)) {
|
if (!extent_buffer_uptodate(eb)) {
|
||||||
fprintf(stderr, "Couldn't read in tree block %s\n", field);
|
fprintf(stderr, "Couldn't read in tree block %s\n", field);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
@ -149,7 +149,7 @@ static int change_extents_uuid(struct btrfs_fs_info *fs_info)
|
||||||
goto next;
|
goto next;
|
||||||
|
|
||||||
bytenr = key.objectid;
|
bytenr = key.objectid;
|
||||||
eb = read_tree_block(fs_info, bytenr, fs_info->nodesize, 0);
|
eb = read_tree_block(fs_info, bytenr, 0);
|
||||||
if (IS_ERR(eb)) {
|
if (IS_ERR(eb)) {
|
||||||
error("failed to read tree block: %llu", bytenr);
|
error("failed to read tree block: %llu", bytenr);
|
||||||
ret = PTR_ERR(eb);
|
ret = PTR_ERR(eb);
|
||||||
|
|
27
cmds-check.c
27
cmds-check.c
|
@ -2190,8 +2190,7 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
|
||||||
if (!next || !btrfs_buffer_uptodate(next, ptr_gen)) {
|
if (!next || !btrfs_buffer_uptodate(next, ptr_gen)) {
|
||||||
free_extent_buffer(next);
|
free_extent_buffer(next);
|
||||||
reada_walk_down(root, cur, path->slots[*level]);
|
reada_walk_down(root, cur, path->slots[*level]);
|
||||||
next = read_tree_block(root->fs_info, bytenr,
|
next = read_tree_block(root->fs_info, bytenr, ptr_gen);
|
||||||
fs_info->nodesize, ptr_gen);
|
|
||||||
if (!extent_buffer_uptodate(next)) {
|
if (!extent_buffer_uptodate(next)) {
|
||||||
struct btrfs_key node_key;
|
struct btrfs_key node_key;
|
||||||
|
|
||||||
|
@ -2304,8 +2303,7 @@ static int walk_down_tree_v2(struct btrfs_root *root, struct btrfs_path *path,
|
||||||
if (!next || !btrfs_buffer_uptodate(next, ptr_gen)) {
|
if (!next || !btrfs_buffer_uptodate(next, ptr_gen)) {
|
||||||
free_extent_buffer(next);
|
free_extent_buffer(next);
|
||||||
reada_walk_down(root, cur, path->slots[*level]);
|
reada_walk_down(root, cur, path->slots[*level]);
|
||||||
next = read_tree_block(fs_info, bytenr,
|
next = read_tree_block(fs_info, bytenr, ptr_gen);
|
||||||
fs_info->nodesize, ptr_gen);
|
|
||||||
if (!extent_buffer_uptodate(next)) {
|
if (!extent_buffer_uptodate(next)) {
|
||||||
struct btrfs_key node_key;
|
struct btrfs_key node_key;
|
||||||
|
|
||||||
|
@ -7683,7 +7681,7 @@ static int run_next_block(struct btrfs_root *root,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fixme, get the real parent transid */
|
/* fixme, get the real parent transid */
|
||||||
buf = read_tree_block(root->fs_info, bytenr, size, gen);
|
buf = read_tree_block(root->fs_info, bytenr, gen);
|
||||||
if (!extent_buffer_uptodate(buf)) {
|
if (!extent_buffer_uptodate(buf)) {
|
||||||
record_bad_block_io(root->fs_info,
|
record_bad_block_io(root->fs_info,
|
||||||
extent_cache, bytenr, size);
|
extent_cache, bytenr, size);
|
||||||
|
@ -9796,8 +9794,7 @@ static int deal_root_from_list(struct list_head *list,
|
||||||
rec = list_entry(list->next,
|
rec = list_entry(list->next,
|
||||||
struct root_item_record, list);
|
struct root_item_record, list);
|
||||||
last = 0;
|
last = 0;
|
||||||
buf = read_tree_block(root->fs_info,
|
buf = read_tree_block(root->fs_info, rec->bytenr, 0);
|
||||||
rec->bytenr, rec->level_size, 0);
|
|
||||||
if (!extent_buffer_uptodate(buf)) {
|
if (!extent_buffer_uptodate(buf)) {
|
||||||
free_extent_buffer(buf);
|
free_extent_buffer(buf);
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
|
@ -10441,7 +10438,7 @@ static int query_tree_block_level(struct btrfs_fs_info *fs_info, u64 bytenr)
|
||||||
btrfs_release_path(&path);
|
btrfs_release_path(&path);
|
||||||
|
|
||||||
/* Get level from tree block as an alternative source */
|
/* Get level from tree block as an alternative source */
|
||||||
eb = read_tree_block(fs_info, bytenr, fs_info->nodesize, transid);
|
eb = read_tree_block(fs_info, bytenr, transid);
|
||||||
if (!extent_buffer_uptodate(eb)) {
|
if (!extent_buffer_uptodate(eb)) {
|
||||||
free_extent_buffer(eb);
|
free_extent_buffer(eb);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
@ -10494,7 +10491,7 @@ static int check_tree_block_backref(struct btrfs_fs_info *fs_info, u64 root_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read out the tree block to get item/node key */
|
/* Read out the tree block to get item/node key */
|
||||||
eb = read_tree_block(fs_info, bytenr, root->fs_info->nodesize, 0);
|
eb = read_tree_block(fs_info, bytenr, 0);
|
||||||
if (!extent_buffer_uptodate(eb)) {
|
if (!extent_buffer_uptodate(eb)) {
|
||||||
err |= REFERENCER_MISSING;
|
err |= REFERENCER_MISSING;
|
||||||
free_extent_buffer(eb);
|
free_extent_buffer(eb);
|
||||||
|
@ -10595,7 +10592,7 @@ static int check_shared_block_backref(struct btrfs_fs_info *fs_info,
|
||||||
int found_parent = 0;
|
int found_parent = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
eb = read_tree_block(fs_info, parent, fs_info->nodesize, 0);
|
eb = read_tree_block(fs_info, parent, 0);
|
||||||
if (!extent_buffer_uptodate(eb))
|
if (!extent_buffer_uptodate(eb))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
@ -10748,7 +10745,7 @@ static int check_shared_data_backref(struct btrfs_fs_info *fs_info,
|
||||||
int found_parent = 0;
|
int found_parent = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
eb = read_tree_block(fs_info, parent, fs_info->nodesize, 0);
|
eb = read_tree_block(fs_info, parent, 0);
|
||||||
if (!extent_buffer_uptodate(eb))
|
if (!extent_buffer_uptodate(eb))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
@ -11510,8 +11507,7 @@ static int traverse_tree_block(struct btrfs_root *root,
|
||||||
* As a btrfs tree has most 8 levels (0..7), so it's quite safe
|
* As a btrfs tree has most 8 levels (0..7), so it's quite safe
|
||||||
* to call the function itself.
|
* to call the function itself.
|
||||||
*/
|
*/
|
||||||
eb = read_tree_block(root->fs_info, blocknr,
|
eb = read_tree_block(root->fs_info, blocknr, 0);
|
||||||
root->fs_info->nodesize, 0);
|
|
||||||
if (extent_buffer_uptodate(eb)) {
|
if (extent_buffer_uptodate(eb)) {
|
||||||
ret = traverse_tree_block(root, eb);
|
ret = traverse_tree_block(root, eb);
|
||||||
err |= ret;
|
err |= ret;
|
||||||
|
@ -11695,7 +11691,7 @@ static int pin_down_tree_blocks(struct btrfs_fs_info *fs_info,
|
||||||
* in, but for now this doesn't actually use the root so
|
* in, but for now this doesn't actually use the root so
|
||||||
* just pass in extent_root.
|
* just pass in extent_root.
|
||||||
*/
|
*/
|
||||||
tmp = read_tree_block(fs_info, bytenr, fs_info->nodesize, 0);
|
tmp = read_tree_block(fs_info, bytenr, 0);
|
||||||
if (!extent_buffer_uptodate(tmp)) {
|
if (!extent_buffer_uptodate(tmp)) {
|
||||||
fprintf(stderr, "Error reading root block\n");
|
fprintf(stderr, "Error reading root block\n");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
@ -11714,8 +11710,7 @@ static int pin_down_tree_blocks(struct btrfs_fs_info *fs_info,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = read_tree_block(fs_info, bytenr,
|
tmp = read_tree_block(fs_info, bytenr, 0);
|
||||||
fs_info->nodesize, 0);
|
|
||||||
if (!extent_buffer_uptodate(tmp)) {
|
if (!extent_buffer_uptodate(tmp)) {
|
||||||
fprintf(stderr, "Error reading tree block\n");
|
fprintf(stderr, "Error reading tree block\n");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
|
@ -51,7 +51,7 @@ static void print_extents(struct btrfs_root *root, struct extent_buffer *eb)
|
||||||
for (i = 0; i < nr; i++) {
|
for (i = 0; i < nr; i++) {
|
||||||
next = read_tree_block(root->fs_info,
|
next = read_tree_block(root->fs_info,
|
||||||
btrfs_node_blockptr(eb, i),
|
btrfs_node_blockptr(eb, i),
|
||||||
root->fs_info->nodesize, btrfs_node_ptr_generation(eb, i));
|
btrfs_node_ptr_generation(eb, i));
|
||||||
if (!extent_buffer_uptodate(next))
|
if (!extent_buffer_uptodate(next))
|
||||||
continue;
|
continue;
|
||||||
if (btrfs_is_leaf(next) && btrfs_header_level(eb) != 1) {
|
if (btrfs_is_leaf(next) && btrfs_header_level(eb) != 1) {
|
||||||
|
@ -310,21 +310,15 @@ int cmd_inspect_dump_tree(int argc, char **argv)
|
||||||
|
|
||||||
if (block_only) {
|
if (block_only) {
|
||||||
root = info->chunk_root;
|
root = info->chunk_root;
|
||||||
leaf = read_tree_block(info,
|
leaf = read_tree_block(info, block_only, 0);
|
||||||
block_only,
|
|
||||||
info->nodesize, 0);
|
|
||||||
|
|
||||||
if (extent_buffer_uptodate(leaf) &&
|
if (extent_buffer_uptodate(leaf) &&
|
||||||
btrfs_header_level(leaf) != 0) {
|
btrfs_header_level(leaf) != 0) {
|
||||||
free_extent_buffer(leaf);
|
free_extent_buffer(leaf);
|
||||||
leaf = NULL;
|
leaf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!leaf) {
|
if (!leaf)
|
||||||
leaf = read_tree_block(info,
|
leaf = read_tree_block(info, block_only, 0);
|
||||||
block_only,
|
|
||||||
info->nodesize, 0);
|
|
||||||
}
|
|
||||||
if (!extent_buffer_uptodate(leaf)) {
|
if (!extent_buffer_uptodate(leaf)) {
|
||||||
error("failed to read %llu",
|
error("failed to read %llu",
|
||||||
(unsigned long long)block_only);
|
(unsigned long long)block_only);
|
||||||
|
@ -444,8 +438,7 @@ again:
|
||||||
|
|
||||||
offset = btrfs_item_ptr_offset(leaf, slot);
|
offset = btrfs_item_ptr_offset(leaf, slot);
|
||||||
read_extent_buffer(leaf, &ri, offset, sizeof(ri));
|
read_extent_buffer(leaf, &ri, offset, sizeof(ri));
|
||||||
buf = read_tree_block(info, btrfs_root_bytenr(&ri),
|
buf = read_tree_block(info, btrfs_root_bytenr(&ri), 0);
|
||||||
info->nodesize, 0);
|
|
||||||
if (!extent_buffer_uptodate(buf))
|
if (!extent_buffer_uptodate(buf))
|
||||||
goto next;
|
goto next;
|
||||||
if (tree_id && found_key.objectid != tree_id) {
|
if (tree_id && found_key.objectid != tree_id) {
|
||||||
|
|
|
@ -153,7 +153,6 @@ static int walk_nodes(struct btrfs_root *root, struct btrfs_path *path,
|
||||||
path->slots[level] = i;
|
path->slots[level] = i;
|
||||||
if ((level - 1) > 0 || find_inline) {
|
if ((level - 1) > 0 || find_inline) {
|
||||||
tmp = read_tree_block(root->fs_info, cur_blocknr,
|
tmp = read_tree_block(root->fs_info, cur_blocknr,
|
||||||
nodesize,
|
|
||||||
btrfs_node_ptr_generation(b, i));
|
btrfs_node_ptr_generation(b, i));
|
||||||
if (!extent_buffer_uptodate(tmp)) {
|
if (!extent_buffer_uptodate(tmp)) {
|
||||||
error("failed to read blocknr %llu",
|
error("failed to read blocknr %llu",
|
||||||
|
|
|
@ -1255,7 +1255,7 @@ static struct btrfs_root *open_fs(const char *dev, u64 root_location,
|
||||||
root_location = btrfs_super_root(fs_info->super_copy);
|
root_location = btrfs_super_root(fs_info->super_copy);
|
||||||
generation = btrfs_super_generation(fs_info->super_copy);
|
generation = btrfs_super_generation(fs_info->super_copy);
|
||||||
root->node = read_tree_block(fs_info, root_location,
|
root->node = read_tree_block(fs_info, root_location,
|
||||||
fs_info->nodesize, generation);
|
generation);
|
||||||
if (!extent_buffer_uptodate(root->node)) {
|
if (!extent_buffer_uptodate(root->node)) {
|
||||||
fprintf(stderr, "Error opening tree root\n");
|
fprintf(stderr, "Error opening tree root\n");
|
||||||
close_ctree(root);
|
close_ctree(root);
|
||||||
|
@ -1501,8 +1501,7 @@ int cmd_restore(int argc, char **argv)
|
||||||
|
|
||||||
if (fs_location != 0) {
|
if (fs_location != 0) {
|
||||||
free_extent_buffer(root->node);
|
free_extent_buffer(root->node);
|
||||||
root->node = read_tree_block(root->fs_info, fs_location,
|
root->node = read_tree_block(root->fs_info, fs_location, 0);
|
||||||
root->fs_info->nodesize, 0);
|
|
||||||
if (!extent_buffer_uptodate(root->node)) {
|
if (!extent_buffer_uptodate(root->node)) {
|
||||||
fprintf(stderr, "Failed to read fs location\n");
|
fprintf(stderr, "Failed to read fs location\n");
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
|
1
ctree.c
1
ctree.c
|
@ -650,7 +650,6 @@ struct extent_buffer *read_node_slot(struct btrfs_fs_info *fs_info,
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return read_tree_block(fs_info, btrfs_node_blockptr(parent, slot),
|
return read_tree_block(fs_info, btrfs_node_blockptr(parent, slot),
|
||||||
fs_info->nodesize,
|
|
||||||
btrfs_node_ptr_generation(parent, slot));
|
btrfs_node_ptr_generation(parent, slot));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
15
disk-io.c
15
disk-io.c
|
@ -299,8 +299,7 @@ int read_whole_eb(struct btrfs_fs_info *info, struct extent_buffer *eb, int mirr
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct extent_buffer* read_tree_block(
|
struct extent_buffer* read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
|
||||||
struct btrfs_fs_info *fs_info, u64 bytenr, u32 blocksize,
|
|
||||||
u64 parent_transid)
|
u64 parent_transid)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -308,6 +307,7 @@ struct extent_buffer* read_tree_block(
|
||||||
u64 best_transid = 0;
|
u64 best_transid = 0;
|
||||||
u32 sectorsize = fs_info->sectorsize;
|
u32 sectorsize = fs_info->sectorsize;
|
||||||
u32 nodesize = fs_info->nodesize;
|
u32 nodesize = fs_info->nodesize;
|
||||||
|
u32 blocksize = fs_info->nodesize;
|
||||||
int mirror_num = 0;
|
int mirror_num = 0;
|
||||||
int good_mirror = 0;
|
int good_mirror = 0;
|
||||||
int num_copies;
|
int num_copies;
|
||||||
|
@ -625,8 +625,7 @@ static int find_and_setup_root(struct btrfs_root *tree_root,
|
||||||
|
|
||||||
generation = btrfs_root_generation(&root->root_item);
|
generation = btrfs_root_generation(&root->root_item);
|
||||||
root->node = read_tree_block(fs_info,
|
root->node = read_tree_block(fs_info,
|
||||||
btrfs_root_bytenr(&root->root_item),
|
btrfs_root_bytenr(&root->root_item), generation);
|
||||||
fs_info->nodesize, generation);
|
|
||||||
if (!extent_buffer_uptodate(root->node))
|
if (!extent_buffer_uptodate(root->node))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
|
@ -652,7 +651,6 @@ static int find_and_setup_log_root(struct btrfs_root *tree_root,
|
||||||
BTRFS_TREE_LOG_OBJECTID);
|
BTRFS_TREE_LOG_OBJECTID);
|
||||||
|
|
||||||
log_root->node = read_tree_block(fs_info, blocknr,
|
log_root->node = read_tree_block(fs_info, blocknr,
|
||||||
fs_info->nodesize,
|
|
||||||
btrfs_super_generation(disk_super) + 1);
|
btrfs_super_generation(disk_super) + 1);
|
||||||
|
|
||||||
fs_info->log_root_tree = log_root;
|
fs_info->log_root_tree = log_root;
|
||||||
|
@ -739,8 +737,7 @@ out:
|
||||||
}
|
}
|
||||||
generation = btrfs_root_generation(&root->root_item);
|
generation = btrfs_root_generation(&root->root_item);
|
||||||
root->node = read_tree_block(fs_info,
|
root->node = read_tree_block(fs_info,
|
||||||
btrfs_root_bytenr(&root->root_item),
|
btrfs_root_bytenr(&root->root_item), generation);
|
||||||
fs_info->nodesize, generation);
|
|
||||||
if (!extent_buffer_uptodate(root->node)) {
|
if (!extent_buffer_uptodate(root->node)) {
|
||||||
free(root);
|
free(root);
|
||||||
return ERR_PTR(-EIO);
|
return ERR_PTR(-EIO);
|
||||||
|
@ -997,8 +994,7 @@ int btrfs_setup_all_roots(struct btrfs_fs_info *fs_info, u64 root_tree_bytenr,
|
||||||
generation = btrfs_backup_tree_root_gen(backup);
|
generation = btrfs_backup_tree_root_gen(backup);
|
||||||
}
|
}
|
||||||
|
|
||||||
root->node = read_tree_block(fs_info, root_tree_bytenr, fs_info->nodesize,
|
root->node = read_tree_block(fs_info, root_tree_bytenr, generation);
|
||||||
generation);
|
|
||||||
if (!extent_buffer_uptodate(root->node)) {
|
if (!extent_buffer_uptodate(root->node)) {
|
||||||
fprintf(stderr, "Couldn't read tree root\n");
|
fprintf(stderr, "Couldn't read tree root\n");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
@ -1184,7 +1180,6 @@ int btrfs_setup_chunk_tree_and_device_map(struct btrfs_fs_info *fs_info,
|
||||||
|
|
||||||
fs_info->chunk_root->node = read_tree_block(fs_info,
|
fs_info->chunk_root->node = read_tree_block(fs_info,
|
||||||
chunk_root_bytenr,
|
chunk_root_bytenr,
|
||||||
fs_info->nodesize,
|
|
||||||
generation);
|
generation);
|
||||||
if (!extent_buffer_uptodate(fs_info->chunk_root->node)) {
|
if (!extent_buffer_uptodate(fs_info->chunk_root->node)) {
|
||||||
if (fs_info->ignore_chunk_tree_error) {
|
if (fs_info->ignore_chunk_tree_error) {
|
||||||
|
|
|
@ -115,8 +115,7 @@ static inline u64 btrfs_sb_offset(int mirror)
|
||||||
struct btrfs_device;
|
struct btrfs_device;
|
||||||
|
|
||||||
int read_whole_eb(struct btrfs_fs_info *info, struct extent_buffer *eb, int mirror);
|
int read_whole_eb(struct btrfs_fs_info *info, struct extent_buffer *eb, int mirror);
|
||||||
struct extent_buffer* read_tree_block(
|
struct extent_buffer* read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
|
||||||
struct btrfs_fs_info *fs_info, u64 bytenr, u32 blocksize,
|
|
||||||
u64 parent_transid);
|
u64 parent_transid);
|
||||||
|
|
||||||
int read_extent_data(struct btrfs_fs_info *fs_info, char *data, u64 logical,
|
int read_extent_data(struct btrfs_fs_info *fs_info, char *data, u64 logical,
|
||||||
|
|
|
@ -133,7 +133,7 @@ int btrfs_find_root_search(struct btrfs_fs_info *fs_info,
|
||||||
for (offset = chunk_offset;
|
for (offset = chunk_offset;
|
||||||
offset < chunk_offset + chunk_size;
|
offset < chunk_offset + chunk_size;
|
||||||
offset += nodesize) {
|
offset += nodesize) {
|
||||||
eb = read_tree_block(fs_info, offset, nodesize, 0);
|
eb = read_tree_block(fs_info, offset, 0);
|
||||||
if (!eb || IS_ERR(eb))
|
if (!eb || IS_ERR(eb))
|
||||||
continue;
|
continue;
|
||||||
ret = add_eb_to_result(eb, result, nodesize, filter,
|
ret = add_eb_to_result(eb, result, nodesize, filter,
|
||||||
|
|
|
@ -974,8 +974,7 @@ static int flush_pending(struct metadump_struct *md, int done)
|
||||||
u64 this_read = min((u64)md->root->fs_info->nodesize,
|
u64 this_read = min((u64)md->root->fs_info->nodesize,
|
||||||
size);
|
size);
|
||||||
|
|
||||||
eb = read_tree_block(md->root->fs_info, start,
|
eb = read_tree_block(md->root->fs_info, start, 0);
|
||||||
this_read, 0);
|
|
||||||
if (!extent_buffer_uptodate(eb)) {
|
if (!extent_buffer_uptodate(eb)) {
|
||||||
free(async->buffer);
|
free(async->buffer);
|
||||||
free(async);
|
free(async);
|
||||||
|
@ -1106,8 +1105,7 @@ static int copy_tree_blocks(struct btrfs_root *root, struct extent_buffer *eb,
|
||||||
continue;
|
continue;
|
||||||
ri = btrfs_item_ptr(eb, i, struct btrfs_root_item);
|
ri = btrfs_item_ptr(eb, i, struct btrfs_root_item);
|
||||||
bytenr = btrfs_disk_root_bytenr(eb, ri);
|
bytenr = btrfs_disk_root_bytenr(eb, ri);
|
||||||
tmp = read_tree_block(fs_info, bytenr,
|
tmp = read_tree_block(fs_info, bytenr, 0);
|
||||||
fs_info->nodesize, 0);
|
|
||||||
if (!extent_buffer_uptodate(tmp)) {
|
if (!extent_buffer_uptodate(tmp)) {
|
||||||
error("unable to read log root block");
|
error("unable to read log root block");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
@ -1118,8 +1116,7 @@ static int copy_tree_blocks(struct btrfs_root *root, struct extent_buffer *eb,
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
bytenr = btrfs_node_blockptr(eb, i);
|
bytenr = btrfs_node_blockptr(eb, i);
|
||||||
tmp = read_tree_block(fs_info, bytenr,
|
tmp = read_tree_block(fs_info, bytenr, 0);
|
||||||
fs_info->nodesize, 0);
|
|
||||||
if (!extent_buffer_uptodate(tmp)) {
|
if (!extent_buffer_uptodate(tmp)) {
|
||||||
error("unable to read log root block");
|
error("unable to read log root block");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
|
@ -1313,7 +1313,7 @@ void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *eb, int fol
|
||||||
|
|
||||||
for (i = 0; i < nr; i++) {
|
for (i = 0; i < nr; i++) {
|
||||||
next = read_tree_block(root->fs_info,
|
next = read_tree_block(root->fs_info,
|
||||||
btrfs_node_blockptr(eb, i), root->fs_info->nodesize,
|
btrfs_node_blockptr(eb, i),
|
||||||
btrfs_node_ptr_generation(eb, i));
|
btrfs_node_ptr_generation(eb, i));
|
||||||
if (!extent_buffer_uptodate(next)) {
|
if (!extent_buffer_uptodate(next)) {
|
||||||
fprintf(stderr, "failed to read %llu in tree %llu\n",
|
fprintf(stderr, "failed to read %llu in tree %llu\n",
|
||||||
|
|
|
@ -711,7 +711,7 @@ static int travel_tree(struct btrfs_fs_info *info, struct btrfs_root *root,
|
||||||
// printf("travel_tree: bytenr: %llu\tnum_bytes: %llu\tref_parent: %llu\n",
|
// printf("travel_tree: bytenr: %llu\tnum_bytes: %llu\tref_parent: %llu\n",
|
||||||
// bytenr, num_bytes, ref_parent);
|
// bytenr, num_bytes, ref_parent);
|
||||||
|
|
||||||
eb = read_tree_block(info, bytenr, num_bytes, 0);
|
eb = read_tree_block(info, bytenr, 0);
|
||||||
if (!extent_buffer_uptodate(eb))
|
if (!extent_buffer_uptodate(eb))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue