aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorMing Lei <tom.leiming@gmail.com>2017-03-16 12:12:30 -0400
committerShaohua Li <shli@fb.com>2017-03-24 13:41:37 -0400
commitd8c84c4f8becc1fb993911e18c8aef5ecf7a72ac (patch)
tree5ae08c614e39143118950507f38f074c21eb5c31 /drivers/md/raid1.c
parent6f8802852f7e58a12177a86179803b9efaad98e2 (diff)
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/raid1.c')
-rw-r--r--drivers/md/raid1.c5
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)
1294 int first_clone; 1294 int first_clone;
1295 int sectors_handled; 1295 int sectors_handled;
1296 int max_sectors; 1296 int max_sectors;
1297 sector_t offset;
1297 1298
1298 /* 1299 /*
1299 * Register the new request and wait if the reconstruction 1300 * Register the new request and wait if the reconstruction
@@ -1439,13 +1440,13 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio)
1439 atomic_set(&r1_bio->behind_remaining, 0); 1440 atomic_set(&r1_bio->behind_remaining, 0);
1440 1441
1441 first_clone = 1; 1442 first_clone = 1;
1443
1444 offset = r1_bio->sector - bio->bi_iter.bi_sector;
1442 for (i = 0; i < disks; i++) { 1445 for (i = 0; i < disks; i++) {
1443 struct bio *mbio = NULL; 1446 struct bio *mbio = NULL;
1444 sector_t offset;
1445 if (!r1_bio->bios[i]) 1447 if (!r1_bio->bios[i])
1446 continue; 1448 continue;
1447 1449
1448 offset = r1_bio->sector - bio->bi_iter.bi_sector;
1449 1450
1450 if (first_clone) { 1451 if (first_clone) {
1451 /* do behind I/O ? 1452 /* do behind I/O ?