diff options
author | Zhao Lei <zhaolei@cn.fujitsu.com> | 2015-12-09 08:03:49 -0500 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2016-01-19 21:43:40 -0500 |
commit | 94a97dfeb61e32a213ca5519b063076c5201c5b2 (patch) | |
tree | 4a2e88f9eceb7c8f0e3277629a227d84b31c72af /fs | |
parent | f04b772bfc17f502703794f4d100d12155c1a1a9 (diff) |
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: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/volumes.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 91bd948d600b..7a769ca04f3f 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -5379,35 +5379,33 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw, | |||
5379 | * target drive. | 5379 | * target drive. |
5380 | */ | 5380 | */ |
5381 | for (i = 0; i < tmp_num_stripes; i++) { | 5381 | for (i = 0; i < tmp_num_stripes; i++) { |
5382 | if (tmp_bbio->stripes[i].dev->devid == srcdev_devid) { | 5382 | if (tmp_bbio->stripes[i].dev->devid != srcdev_devid) |
5383 | /* | 5383 | continue; |
5384 | * In case of DUP, in order to keep it | 5384 | |
5385 | * simple, only add the mirror with the | 5385 | /* |
5386 | * lowest physical address | 5386 | * In case of DUP, in order to keep it simple, only add |
5387 | */ | 5387 | * the mirror with the lowest physical address |
5388 | if (found && | 5388 | */ |
5389 | physical_of_found <= | 5389 | if (found && |
5390 | tmp_bbio->stripes[i].physical) | 5390 | physical_of_found <= tmp_bbio->stripes[i].physical) |
5391 | continue; | 5391 | continue; |
5392 | index_srcdev = i; | 5392 | |
5393 | found = 1; | 5393 | index_srcdev = i; |
5394 | physical_of_found = | 5394 | found = 1; |
5395 | tmp_bbio->stripes[i].physical; | 5395 | physical_of_found = tmp_bbio->stripes[i].physical; |
5396 | } | ||
5397 | } | 5396 | } |
5398 | 5397 | ||
5399 | if (found) { | 5398 | btrfs_put_bbio(tmp_bbio); |
5400 | mirror_num = index_srcdev + 1; | 5399 | |
5401 | patch_the_first_stripe_for_dev_replace = 1; | 5400 | if (!found) { |
5402 | physical_to_patch_in_first_stripe = physical_of_found; | ||
5403 | } else { | ||
5404 | WARN_ON(1); | 5401 | WARN_ON(1); |
5405 | ret = -EIO; | 5402 | ret = -EIO; |
5406 | btrfs_put_bbio(tmp_bbio); | ||
5407 | goto out; | 5403 | goto out; |
5408 | } | 5404 | } |
5409 | 5405 | ||
5410 | btrfs_put_bbio(tmp_bbio); | 5406 | mirror_num = index_srcdev + 1; |
5407 | patch_the_first_stripe_for_dev_replace = 1; | ||
5408 | physical_to_patch_in_first_stripe = physical_of_found; | ||
5411 | } else if (mirror_num > map->num_stripes) { | 5409 | } else if (mirror_num > map->num_stripes) { |
5412 | mirror_num = 0; | 5410 | mirror_num = 0; |
5413 | } | 5411 | } |