Skip to content

Commit bb086a8

Browse files
committed
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>
1 parent 099b548 commit bb086a8

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎drivers/md/md.c‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5297,6 +5297,21 @@ int md_run(struct mddev *mddev)
52975297
return err;
52985298
}
52995299
if (mddev->queue) {
5300+
bool nonrot = true;
5301+
5302+
rdev_for_each(rdev, mddev) {
5303+
if (rdev->raid_disk >= 0 &&
5304+
!blk_queue_nonrot(bdev_get_queue(rdev->bdev))) {
5305+
nonrot = false;
5306+
break;
5307+
}
5308+
}
5309+
if (mddev->degraded)
5310+
nonrot = false;
5311+
if (nonrot)
5312+
queue_flag_set_unlocked(QUEUE_FLAG_NONROT, mddev->queue);
5313+
else
5314+
queue_flag_clear_unlocked(QUEUE_FLAG_NONROT, mddev->queue);
53005315
mddev->queue->backing_dev_info.congested_data = mddev;
53015316
mddev->queue->backing_dev_info.congested_fn = md_congested;
53025317
}

0 commit comments

Comments
 (0)