From 45ec8201526deef9824a0ba2894ba9b615576eb2 Mon Sep 17 00:00:00 2001 From: Keld Simonsen Date: Tue, 4 Mar 2008 14:29:34 -0800 Subject: [PATCH] --- yaml --- r: 86846 b: refs/heads/master c: 8ed3a19563b6c05b7625649b1769ddb063d53253 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/md/raid10.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 6d1902762650..4a27c0c79ab4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 27c529bb8e906d5d692152bc127cc09477d3629e +refs/heads/master: 8ed3a19563b6c05b7625649b1769ddb063d53253 diff --git a/trunk/drivers/md/raid10.c b/trunk/drivers/md/raid10.c index 5de42d87bf4e..6c486d839c99 100644 --- a/trunk/drivers/md/raid10.c +++ b/trunk/drivers/md/raid10.c @@ -537,7 +537,8 @@ static int read_balance(conf_t *conf, r10bio_t *r10_bio) current_distance = abs(r10_bio->devs[slot].addr - conf->mirrors[disk].head_position); - /* Find the disk whose head is closest */ + /* Find the disk whose head is closest, + * or - for far > 1 - find the closest to partition beginning */ for (nslot = slot; nslot < conf->copies; nslot++) { int ndisk = r10_bio->devs[nslot].devnum; @@ -557,8 +558,13 @@ static int read_balance(conf_t *conf, r10bio_t *r10_bio) slot = nslot; break; } - new_distance = abs(r10_bio->devs[nslot].addr - - conf->mirrors[ndisk].head_position); + + /* for far > 1 always use the lowest address */ + if (conf->far_copies > 1) + new_distance = r10_bio->devs[nslot].addr; + else + new_distance = abs(r10_bio->devs[nslot].addr - + conf->mirrors[ndisk].head_position); if (new_distance < current_distance) { current_distance = new_distance; disk = ndisk;