提交 4693c966 编写于 作者: M Mandeep Singh Baines 提交者: Alasdair G Kergon

dm table: propagate non rotational flag

Allow QUEUE_FLAG_NONROT to propagate up the device stack if all
underlying devices are non-rotational.  Tools like ureadahead will
schedule IOs differently based on the rotational flag.

With this patch, I see boot time go from 7.75 s to 7.46 s on my device.
Suggested-by: NJ. Richard Barnette <jrbarnette@chromium.org>
Signed-off-by: NMandeep Singh Baines <msb@chromium.org>
Signed-off-by: NMike Snitzer <snitzer@redhat.com>
Cc: Neil Brown <neilb@suse.de>
Cc: Jens Axboe <jaxboe@fusionio.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: dm-devel@redhat.com
Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
上级 c3b92c87
...@@ -1299,6 +1299,31 @@ static bool dm_table_discard_zeroes_data(struct dm_table *t) ...@@ -1299,6 +1299,31 @@ static bool dm_table_discard_zeroes_data(struct dm_table *t)
return 1; return 1;
} }
static int device_is_nonrot(struct dm_target *ti, struct dm_dev *dev,
sector_t start, sector_t len, void *data)
{
struct request_queue *q = bdev_get_queue(dev->bdev);
return q && blk_queue_nonrot(q);
}
static bool dm_table_is_nonrot(struct dm_table *t)
{
struct dm_target *ti;
unsigned i = 0;
/* Ensure that all underlying device are non-rotational. */
while (i < dm_table_get_num_targets(t)) {
ti = dm_table_get_target(t, i++);
if (!ti->type->iterate_devices ||
!ti->type->iterate_devices(ti, device_is_nonrot, NULL))
return 0;
}
return 1;
}
void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
struct queue_limits *limits) struct queue_limits *limits)
{ {
...@@ -1324,6 +1349,11 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, ...@@ -1324,6 +1349,11 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
if (!dm_table_discard_zeroes_data(t)) if (!dm_table_discard_zeroes_data(t))
q->limits.discard_zeroes_data = 0; q->limits.discard_zeroes_data = 0;
if (dm_table_is_nonrot(t))
queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q);
else
queue_flag_clear_unlocked(QUEUE_FLAG_NONROT, q);
dm_table_set_integrity(t); dm_table_set_integrity(t);
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册