diff options
author | Ming Lei <tom.leiming@gmail.com> | 2017-03-16 17:12:30 +0100 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2017-03-24 18:41:37 +0100 |
commit | d8c84c4f8becc1fb993911e18c8aef5ecf7a72ac (patch) | |
tree | 5ae08c614e39143118950507f38f074c21eb5c31 /drivers/md | |
parent | block: introduce bio_copy_data_partial (diff) | |
download | linux-d8c84c4f8becc1fb993911e18c8aef5ecf7a72ac.tar.xz linux-d8c84c4f8becc1fb993911e18c8aef5ecf7a72ac.zip |
md: raid1: move 'offset' out of loop
The 'offset' local variable can't be changed inside the loop, so
move it out.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/raid1.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index d27b84666884..64bf2005f082 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1294,6 +1294,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio) int first_clone; int sectors_handled; int max_sectors; + sector_t offset; /* * Register the new request and wait if the reconstruction @@ -1439,13 +1440,13 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio) atomic_set(&r1_bio->behind_remaining, 0); first_clone = 1; + + offset = r1_bio->sector - bio->bi_iter.bi_sector; for (i = 0; i < disks; i++) { struct bio *mbio = NULL; - sector_t offset; if (!r1_bio->bios[i]) continue; - offset = r1_bio->sector - bio->bi_iter.bi_sector; if (first_clone) { /* do behind I/O ? |