Skip to content

Commit

Permalink
md: set rotational bit
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Shaohua Li <[email protected]>
  • Loading branch information
shligit committed Oct 3, 2016
1 parent 099b548 commit bb086a8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit bb086a8

Please sign in to comment.