Skip to content

Commit

Permalink
[PATCH] md: fix minor error in raid10 read-balancing calculation.
Browse files Browse the repository at this point in the history
'this_sector' is a virtual (array) address while 'head_position' is a physical
(device) address, so substraction doesn't make any sense.  devs[slot].addr
should be used instead of this_sector.

However, this patch doesn't make much practical different to the read
balancing due to the effects of later code.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Sep 9, 2005
1 parent 486a153 commit 3ec67ac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/md/raid10.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,8 @@ static int read_balance(conf_t *conf, r10bio_t *r10_bio)
}


current_distance = abs(this_sector - conf->mirrors[disk].head_position);
current_distance = abs(r10_bio->devs[slot].addr -
conf->mirrors[disk].head_position);

/* Find the disk whose head is closest */

Expand Down

0 comments on commit 3ec67ac

Please sign in to comment.