Skip to content

Commit 7d49ffc

Browse files
committed
Read from the first device when an area is resyncing
set choose_first true for cluster read in read balance when the area is resyncing. Signed-off-by: Lidong Zhong <lzhong@suse.com> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
1 parent 589a1c4 commit 7d49ffc

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎drivers/md/raid1.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,13 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect
539539
has_nonrot_disk = 0;
540540
choose_next_idle = 0;
541541

542-
choose_first = (conf->mddev->recovery_cp < this_sector + sectors);
542+
if ((conf->mddev->recovery_cp < this_sector + sectors) ||
543+
(mddev_is_clustered(conf->mddev) &&
544+
md_cluster_ops->area_resyncing(conf->mddev, this_sector,
545+
this_sector + sectors)))
546+
choose_first = 1;
547+
else
548+
choose_first = 0;
543549

544550
for (disk = 0 ; disk < conf->raid_disks * 2 ; disk++) {
545551
sector_t dist;

0 commit comments

Comments
 (0)