diff options
author | NeilBrown <neilb@suse.com> | 2016-06-02 16:19:52 +1000 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2016-06-13 11:54:17 -0700 |
commit | 854abd75841413f7966bc4fed83b36e78a1c285c (patch) | |
tree | 05072822e6f84375ca4e6bbbdd2de2c93ba1bfdb /drivers/md/raid1.c | |
parent | e5872d58f5ad179fc03267f12257bee4159aace6 (diff) | |
download | linux-854abd75841413f7966bc4fed83b36e78a1c285c.tar.gz linux-854abd75841413f7966bc4fed83b36e78a1c285c.tar.bz2 linux-854abd75841413f7966bc4fed83b36e78a1c285c.zip |
md/raid1: small code cleanup in end_sync_write
'mirror' is only used to find 'rdev', several times.
So just find 'rdev' once, and use it instead.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 588608dcb780..60c293df03f1 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1709,11 +1709,9 @@ static void end_sync_write(struct bio *bio) struct r1bio *r1_bio = bio->bi_private; struct mddev *mddev = r1_bio->mddev; struct r1conf *conf = mddev->private; - int mirror=0; sector_t first_bad; int bad_sectors; - - mirror = find_bio_disk(r1_bio, bio); + struct md_rdev *rdev = conf->mirrors[find_bio_disk(r1_bio, bio)].rdev; if (!uptodate) { sector_t sync_blocks = 0; @@ -1726,16 +1724,12 @@ static void end_sync_write(struct bio *bio) s += sync_blocks; sectors_to_go -= sync_blocks; } while (sectors_to_go > 0); - set_bit(WriteErrorSeen, - &conf->mirrors[mirror].rdev->flags); - if (!test_and_set_bit(WantReplacement, - &conf->mirrors[mirror].rdev->flags)) + set_bit(WriteErrorSeen, &rdev->flags); + if (!test_and_set_bit(WantReplacement, &rdev->flags)) set_bit(MD_RECOVERY_NEEDED, & mddev->recovery); set_bit(R1BIO_WriteError, &r1_bio->state); - } else if (is_badblock(conf->mirrors[mirror].rdev, - r1_bio->sector, - r1_bio->sectors, + } else if (is_badblock(rdev, r1_bio->sector, r1_bio->sectors, &first_bad, &bad_sectors) && !is_badblock(conf->mirrors[r1_bio->read_disk].rdev, r1_bio->sector, |