Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 86846
b: refs/heads/master
c: 8ed3a19
h: refs/heads/master
v: v3
  • Loading branch information
Keld Simonsen authored and Linus Torvalds committed Mar 5, 2008
1 parent 3568750 commit 45ec820
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 27c529bb8e906d5d692152bc127cc09477d3629e
refs/heads/master: 8ed3a19563b6c05b7625649b1769ddb063d53253
12 changes: 9 additions & 3 deletions trunk/drivers/md/raid10.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 45ec820

Please sign in to comment.