On Sat, Apr 01 2017, Guoqing Jiang wrote: > Since the value of first is always '1', we can > set min_offset_diff directly. Alternately, maybe the fact that first is always '1', is a sign of a bug that should be fixed. The calculation of "min_offset_diff" doesn't make much sense now. It is just the last_offset_diff. I think the correct fix is to set "first = 0;" at the end of the rdev_for_each() loop. Thanks for spotting this. NeilBrown > > Signed-off-by: Guoqing Jiang <gqjiang@xxxxxxxx> > --- > drivers/md/raid10.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c > index 0f13d57..edaf8f4 100644 > --- a/drivers/md/raid10.c > +++ b/drivers/md/raid10.c > @@ -3702,7 +3702,6 @@ static int raid10_run(struct mddev *mddev) > struct md_rdev *rdev; > sector_t size; > sector_t min_offset_diff = 0; > - int first = 1; > bool discard_supported = false; > > if (mddev->private == NULL) { > @@ -3758,8 +3757,7 @@ static int raid10_run(struct mddev *mddev) > diff = -diff; > if (diff < 0) > diff = 0; > - if (first || diff < min_offset_diff) > - min_offset_diff = diff; > + min_offset_diff = diff; > > if (mddev->gendisk) > disk_stack_limits(mddev->gendisk, rdev->bdev, > @@ -4140,7 +4138,6 @@ static int raid10_start_reshape(struct mddev *mddev) > > unsigned long before_length, after_length; > sector_t min_offset_diff = 0; > - int first = 1; > struct geom new; > struct r10conf *conf = mddev->private; > struct md_rdev *rdev; > @@ -4169,8 +4166,7 @@ static int raid10_start_reshape(struct mddev *mddev) > diff = -diff; > if (diff < 0) > diff = 0; > - if (first || diff < min_offset_diff) > - min_offset_diff = diff; > + min_offset_diff = diff; > } > } > > -- > 2.6.6
Attachment:
signature.asc
Description: PGP signature