linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] md: set rotational bit
@ 2016-09-30 16:45 Shaohua Li
  2016-10-01 10:50 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Shaohua Li @ 2016-09-30 16:45 UTC (permalink / raw)
  To: linux-raid; +Cc: Kernel-team

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.

Signed-off-by: Shaohua Li <shli@fb.com>
---
 drivers/md/md.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 457b538..eac84d8 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;
 	}
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] md: set rotational bit
  2016-09-30 16:45 [PATCH] md: set rotational bit Shaohua Li
@ 2016-10-01 10:50 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2016-10-01 10:50 UTC (permalink / raw)
  To: Shaohua Li; +Cc: linux-raid, Kernel-team

On Fri, Sep 30, 2016 at 09:45:40AM -0700, Shaohua Li wrote:
> 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.
> 
> Signed-off-by: Shaohua Li <shli@fb.com>

FWIW,

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-01 10:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-30 16:45 [PATCH] md: set rotational bit Shaohua Li
2016-10-01 10:50 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).