md/raid10: read balance chooses idlest disk for SSD
authorGuoqing Jiang <gqjiang@suse.com>
Fri, 14 Jun 2019 22:41:11 +0000 (15:41 -0700)
committerJens Axboe <axboe@kernel.dk>
Sat, 15 Jun 2019 07:37:35 +0000 (01:37 -0600)
commit071a84688a85952bcc89348ff75191981b391b9c
treea11ec9c1ea3aa524798929a38158667a81218c3e
parent8f06b1a4cf7ab16b5c636b98ca7c2230a8d72319
md/raid10: read balance chooses idlest disk for SSD

Andy reported that raid10 array with SSD disks has poor
read performance. Compared with raid1, RAID-1 can be 3x
faster than RAID-10 sometimes [1].

The thing is that raid10 chooses the low distance disk
for read request, however, the approach doesn't work
well for SSD device since it doesn't have spindle like
HDD, we should just read from the SSD which has less
pending IO like commit ebe2efe6ffc20 ("md/raid1: read
balance chooses idlest disk for SSD").

So this commit selects the idlest SSD disk for read if
array has none rotational disk, otherwise, read_balance
uses the previous distance priority algorithm. With the
change, the performance of raid10 gets increased largely
per Andy's test [2].

[1]. https://marc.info/?l=linux-raid&m=155915890004761&w=2
[2]. https://marc.info/?l=linux-raid&m=155990654223786&w=2

Tested-by: Andy Smith <andy@strugglers.net>
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/raid10.c