Commit 94a97dfe authored by Zhao Lei's avatar Zhao Lei Committed by Chris Mason

btrfs: Small cleanup for get index_srcdev loop

1: Adjust condition in loop to make less TAB
2: Move btrfs_put_bbio()'s line for combine, and makes logic clean.
Signed-off-by: default avatarZhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent f04b772b
...@@ -5379,35 +5379,33 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw, ...@@ -5379,35 +5379,33 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
* target drive. * target drive.
*/ */
for (i = 0; i < tmp_num_stripes; i++) { for (i = 0; i < tmp_num_stripes; i++) {
if (tmp_bbio->stripes[i].dev->devid == srcdev_devid) { if (tmp_bbio->stripes[i].dev->devid != srcdev_devid)
/* continue;
* In case of DUP, in order to keep it
* simple, only add the mirror with the /*
* lowest physical address * In case of DUP, in order to keep it simple, only add
*/ * the mirror with the lowest physical address
if (found && */
physical_of_found <= if (found &&
tmp_bbio->stripes[i].physical) physical_of_found <= tmp_bbio->stripes[i].physical)
continue; continue;
index_srcdev = i;
found = 1; index_srcdev = i;
physical_of_found = found = 1;
tmp_bbio->stripes[i].physical; physical_of_found = tmp_bbio->stripes[i].physical;
}
} }
if (found) { btrfs_put_bbio(tmp_bbio);
mirror_num = index_srcdev + 1;
patch_the_first_stripe_for_dev_replace = 1; if (!found) {
physical_to_patch_in_first_stripe = physical_of_found;
} else {
WARN_ON(1); WARN_ON(1);
ret = -EIO; ret = -EIO;
btrfs_put_bbio(tmp_bbio);
goto out; goto out;
} }
btrfs_put_bbio(tmp_bbio); mirror_num = index_srcdev + 1;
patch_the_first_stripe_for_dev_replace = 1;
physical_to_patch_in_first_stripe = physical_of_found;
} else if (mirror_num > map->num_stripes) { } else if (mirror_num > map->num_stripes) {
mirror_num = 0; mirror_num = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment