btrfs-progs: Move btrfs_num_copies() call out of the loop in read_tree_block()

btrfs_num_copies really only needs to be called once, so move it out of
the verification loop in read_tree_block().

Signed-off-by: Qu Wenruo <wqu@suse.com>
master
Qu Wenruo 2019-03-07 19:31:32 +08:00
parent e8ae577030
commit f76136a8d0
1 changed files with 1 additions and 1 deletions

View File

@ -349,6 +349,7 @@ struct extent_buffer* read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
if (btrfs_buffer_uptodate(eb, parent_transid))
return eb;
num_copies = btrfs_num_copies(fs_info, eb->start, eb->len);
while (1) {
ret = read_whole_eb(fs_info, eb, mirror_num);
if (ret == 0 && csum_tree_block(fs_info, eb, 1) == 0 &&
@ -376,7 +377,6 @@ struct extent_buffer* read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
ret = -EIO;
break;
}
num_copies = btrfs_num_copies(fs_info, eb->start, eb->len);
if (num_copies == 1) {
ignore = 1;
continue;