diff options
author | Shaohua Li <shli@fb.com> | 2016-09-30 09:45:40 -0700 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2016-10-03 10:20:27 -0700 |
commit | bb086a89a406b5d877ee616f1490fcc81f8e1b2b (patch) | |
tree | d74a8a87ec39992d499e81a98c3de7a456d62486 /drivers/md/md.c | |
parent | 099b548c429217a8306adbd1552d326615c9b903 (diff) | |
download | talos-obmc-linux-bb086a89a406b5d877ee616f1490fcc81f8e1b2b.tar.gz talos-obmc-linux-bb086a89a406b5d877ee616f1490fcc81f8e1b2b.zip |
md: set rotational bit
if all disks in an array are non-rotational, set the array
non-rotational.
This only works for array with all disks populated at startup. Support
for disk hotadd/hotremove could be added later if necessary.
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 457b53863117..eac84d8ff724 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -5297,6 +5297,21 @@ int md_run(struct mddev *mddev) return err; } if (mddev->queue) { + bool nonrot = true; + + rdev_for_each(rdev, mddev) { + if (rdev->raid_disk >= 0 && + !blk_queue_nonrot(bdev_get_queue(rdev->bdev))) { + nonrot = false; + break; + } + } + if (mddev->degraded) + nonrot = false; + if (nonrot) + queue_flag_set_unlocked(QUEUE_FLAG_NONROT, mddev->queue); + else + queue_flag_clear_unlocked(QUEUE_FLAG_NONROT, mddev->queue); mddev->queue->backing_dev_info.congested_data = mddev; mddev->queue->backing_dev_info.congested_fn = md_congested; } |