[PATCH] md: improve read speed to raid10 arrays using 'far copies'

raid10 has two different layouts. One uses near-copies (so multiple
copies of a block are at the same or similar offsets of different
devices) and the other uses far-copies (so multiple copies of a block
are stored a greatly different offsets on different devices). The point
of far-copies is that it allows the first section (normally first half)
to be layed out in normal raid0 style, and thus provide raid0 sequential
read performance.

Unfortunately, the read balancing in raid10 makes some poor decisions
for far-copies arrays and you don't get the desired performance. So
turn off that bad bit of read_balance for far-copies arrays.

With this patch, read speed of an 'f2' array is comparable with a raid0
with the same number of devices, though write speed is ofcourse still
very slow.

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

NeilBrown and committed by
Linus Torvalds
22dfdf52 20c5ab68

+5 -1
+5 -1
drivers/md/raid10.c
··· 552 552 !test_bit(In_sync, &rdev->flags)) 553 553 continue; 554 554 555 - if (!atomic_read(&rdev->nr_pending)) { 555 + /* This optimisation is debatable, and completely destroys 556 + * sequential read speed for 'far copies' arrays. So only 557 + * keep it for 'near' arrays, and review those later. 558 + */ 559 + if (conf->near_copies > 1 && !atomic_read(&rdev->nr_pending)) { 556 560 disk = ndisk; 557 561 slot = nslot; 558 562 break;