md/raid1: record nonrot rdevs while adding/removing rdevs to conf
authorYu Kuai <yukuai3@huawei.com>
Thu, 29 Feb 2024 09:57:06 +0000 (17:57 +0800)
committerSong Liu <song@kernel.org>
Fri, 1 Mar 2024 06:49:45 +0000 (22:49 -0800)
commit2c27d09d3a76b33629d2e681bf8b774f776ade7f
tree522d44db48c73783e8e6e5dbb2e47629b920e380
parent969d6589abcb369d53d84ec7c9c37f4b23ec1ad9
md/raid1: record nonrot rdevs while adding/removing rdevs to conf

For raid1, each read will iterate all the rdevs from conf and check if
any rdev is non-rotational, then choose rdev with minimal IO inflight
if so, or rdev with closest distance otherwise.

Disk nonrot info can be changed through sysfs entry:

/sys/block/[disk_name]/queue/rotational

However, consider that this should only be used for testing, and user
really shouldn't do this in real life. Record the number of non-rotational
disks in conf, to avoid checking each rdev in IO fast path and simplify
read_balance() a little bit.

Co-developed-by: Paul Luse <paul.e.luse@linux.intel.com>
Signed-off-by: Paul Luse <paul.e.luse@linux.intel.com>
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20240229095714.926789-4-yukuai1@huaweicloud.com
drivers/md/md.h
drivers/md/raid1.c
drivers/md/raid1.h