|
@@ -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;
|