Commit 3ec67ac1 authored by NeilBrown's avatar NeilBrown Committed by Linus Torvalds

[PATCH] md: fix minor error in raid10 read-balancing calculation.

'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: default avatarNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 486a153f
...@@ -538,7 +538,8 @@ static int read_balance(conf_t *conf, r10bio_t *r10_bio) ...@@ -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 */ /* Find the disk whose head is closest */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment