diff options
author | Zhao Lei <zhaolei@cn.fujitsu.com> | 2015-02-12 02:42:16 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2015-02-16 12:48:44 -0500 |
commit | 08da757d3f29e9d33480ae1c44b557a2514d70c5 (patch) | |
tree | d4a3b2df5f7766cbf5fe066f1d21869ff9e4be4f /fs | |
parent | a688a04aab72a775e07fe460f563b46f7791cfc1 (diff) |
btrfs: cleanup: use for() loop in btrfs_map_bio()
for() is obviously better in these code block, and remove noused
init-value to reduce about 6 bytes binary size.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/volumes.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 30c6074f3d00..d7d1dde5f2ff 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -5820,8 +5820,8 @@ int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio, | |||
5820 | u64 length = 0; | 5820 | u64 length = 0; |
5821 | u64 map_length; | 5821 | u64 map_length; |
5822 | int ret; | 5822 | int ret; |
5823 | int dev_nr = 0; | 5823 | int dev_nr; |
5824 | int total_devs = 1; | 5824 | int total_devs; |
5825 | struct btrfs_bio *bbio = NULL; | 5825 | struct btrfs_bio *bbio = NULL; |
5826 | 5826 | ||
5827 | length = bio->bi_iter.bi_size; | 5827 | length = bio->bi_iter.bi_size; |
@@ -5862,11 +5862,10 @@ int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio, | |||
5862 | BUG(); | 5862 | BUG(); |
5863 | } | 5863 | } |
5864 | 5864 | ||
5865 | while (dev_nr < total_devs) { | 5865 | for (dev_nr = 0; dev_nr < total_devs; dev_nr++) { |
5866 | dev = bbio->stripes[dev_nr].dev; | 5866 | dev = bbio->stripes[dev_nr].dev; |
5867 | if (!dev || !dev->bdev || (rw & WRITE && !dev->writeable)) { | 5867 | if (!dev || !dev->bdev || (rw & WRITE && !dev->writeable)) { |
5868 | bbio_error(bbio, first_bio, logical); | 5868 | bbio_error(bbio, first_bio, logical); |
5869 | dev_nr++; | ||
5870 | continue; | 5869 | continue; |
5871 | } | 5870 | } |
5872 | 5871 | ||
@@ -5879,7 +5878,6 @@ int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio, | |||
5879 | ret = breakup_stripe_bio(root, bbio, first_bio, dev, | 5878 | ret = breakup_stripe_bio(root, bbio, first_bio, dev, |
5880 | dev_nr, rw, async_submit); | 5879 | dev_nr, rw, async_submit); |
5881 | BUG_ON(ret); | 5880 | BUG_ON(ret); |
5882 | dev_nr++; | ||
5883 | continue; | 5881 | continue; |
5884 | } | 5882 | } |
5885 | 5883 | ||
@@ -5894,7 +5892,6 @@ int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio, | |||
5894 | submit_stripe_bio(root, bbio, bio, | 5892 | submit_stripe_bio(root, bbio, bio, |
5895 | bbio->stripes[dev_nr].physical, dev_nr, rw, | 5893 | bbio->stripes[dev_nr].physical, dev_nr, rw, |
5896 | async_submit); | 5894 | async_submit); |
5897 | dev_nr++; | ||
5898 | } | 5895 | } |
5899 | btrfs_bio_counter_dec(root->fs_info); | 5896 | btrfs_bio_counter_dec(root->fs_info); |
5900 | return 0; | 5897 | return 0; |