提交 d8c84c4f 编写于 作者: M Ming Lei 提交者: Shaohua Li

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: NMing Lei <tom.leiming@gmail.com>
Signed-off-by: NShaohua Li <shli@fb.com>
上级 6f880285
...@@ -1294,6 +1294,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio) ...@@ -1294,6 +1294,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio)
int first_clone; int first_clone;
int sectors_handled; int sectors_handled;
int max_sectors; int max_sectors;
sector_t offset;
/* /*
* Register the new request and wait if the reconstruction * 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,13 +1440,13 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio)
atomic_set(&r1_bio->behind_remaining, 0); atomic_set(&r1_bio->behind_remaining, 0);
first_clone = 1; first_clone = 1;
offset = r1_bio->sector - bio->bi_iter.bi_sector;
for (i = 0; i < disks; i++) { for (i = 0; i < disks; i++) {
struct bio *mbio = NULL; struct bio *mbio = NULL;
sector_t offset;
if (!r1_bio->bios[i]) if (!r1_bio->bios[i])
continue; continue;
offset = r1_bio->sector - bio->bi_iter.bi_sector;
if (first_clone) { if (first_clone) {
/* do behind I/O ? /* do behind I/O ?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册