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 <w...@suse.com> --- disk-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disk-io.c b/disk-io.c index 369592eb7b5c..1736d4a1f94b 100644 --- a/disk-io.c +++ b/disk-io.c @@ -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; -- 2.21.0