On Wed, May 10, 2017 at 12:57:01PM -0700, Shaohua Li wrote: > > --- > > drivers/md/raid1.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > v2: > > updated the title not to include internal defect number :) > > > > diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c > > index a1f3fbe..e7ab3bb 100644 > > --- a/drivers/md/raid1.c > > +++ b/drivers/md/raid1.c > > @@ -628,8 +628,11 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect > > break; > > } > > continue; > > - } else > > + } else { > > + if ((sectors > best_good_sectors) && (best_disk >= 0)) > > + best_disk = disk; > > best_disk = -1 seems better here to me. If this is the only disk, we will > choose in below 'if (best_disk == -1)' check. If there are more disks which > cover the whole range, we will choose the best disk with minimum seek/pending. > Agreed, it's a neater way to fix it. I'll send the patch. Tomek -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html