Skip to content

Commit

Permalink
md/raid10: reset the 'first' at the end of loop
Browse files Browse the repository at this point in the history
We need to set "first = 0' at the end of rdev_for_each
loop, so we can get the array's min_offset_diff correctly
otherwise min_offset_diff just means the last rdev's
offset diff.

Suggested-by: NeilBrown <neilb@suse.com>
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
  • Loading branch information
Guoqing Jiang authored and Shaohua Li committed Apr 10, 2017
1 parent 7471fb7 commit 6f287ca
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/md/raid10.c
Original file line number Diff line number Diff line change
Expand Up @@ -3769,6 +3769,7 @@ static int raid10_run(struct mddev *mddev)

if (blk_queue_discard(bdev_get_queue(rdev->bdev)))
discard_supported = true;
first = 0;
}

if (mddev->queue) {
Expand Down Expand Up @@ -4172,6 +4173,7 @@ static int raid10_start_reshape(struct mddev *mddev)
if (first || diff < min_offset_diff)
min_offset_diff = diff;
}
first = 0;
}

if (max(before_length, after_length) > min_offset_diff)
Expand Down

0 comments on commit 6f287ca

Please sign in to comment.