md/raid10: reset the 'first' at the end of loop
authorGuoqing Jiang <gqjiang@suse.com>
Thu, 6 Apr 2017 01:12:18 +0000 (09:12 +0800)
committerShaohua Li <shli@fb.com>
Mon, 10 Apr 2017 17:41:50 +0000 (10:41 -0700)
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>
drivers/md/raid10.c

index 0f13d57ef6468aa14b072393945ee18e63fec533..e055ec94b9a80dada24b9914ed9702c721c4fa88 100644 (file)
@@ -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) {
@@ -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)