aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMandeep Singh Baines <msb@chromium.org>2011-10-31 16:18:50 -0400
committerAlasdair G Kergon <agk@redhat.com>2011-10-31 16:18:50 -0400
commit4693c9668fdcec229825b3763876b4744f9e6d5e (patch)
tree683d07005d06c3e25bbec25b910567275f0bb9d1 /drivers/md
parentc3b92c8787367a8bb53d57d9789b558f1295cc96 (diff)
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: J. Richard Barnette <jrbarnette@chromium.org> Signed-off-by: Mandeep Singh Baines <msb@chromium.org> Signed-off-by: Mike 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: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-table.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index bc04518e9d8b..81cbbf375bd7 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1299,6 +1299,31 @@ static bool dm_table_discard_zeroes_data(struct dm_table *t)
1299 return 1; 1299 return 1;
1300} 1300}
1301 1301
1302static int device_is_nonrot(struct dm_target *ti, struct dm_dev *dev,
1303 sector_t start, sector_t len, void *data)
1304{
1305 struct request_queue *q = bdev_get_queue(dev->bdev);
1306
1307 return q && blk_queue_nonrot(q);
1308}
1309
1310static bool dm_table_is_nonrot(struct dm_table *t)
1311{
1312 struct dm_target *ti;
1313 unsigned i = 0;
1314
1315 /* Ensure that all underlying device are non-rotational. */
1316 while (i < dm_table_get_num_targets(t)) {
1317 ti = dm_table_get_target(t, i++);
1318
1319 if (!ti->type->iterate_devices ||
1320 !ti->type->iterate_devices(ti, device_is_nonrot, NULL))
1321 return 0;
1322 }
1323
1324 return 1;
1325}
1326
1302void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, 1327void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
1303 struct queue_limits *limits) 1328 struct queue_limits *limits)
1304{ 1329{
@@ -1324,6 +1349,11 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
1324 if (!dm_table_discard_zeroes_data(t)) 1349 if (!dm_table_discard_zeroes_data(t))
1325 q->limits.discard_zeroes_data = 0; 1350 q->limits.discard_zeroes_data = 0;
1326 1351
1352 if (dm_table_is_nonrot(t))
1353 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q);
1354 else
1355 queue_flag_clear_unlocked(QUEUE_FLAG_NONROT, q);
1356
1327 dm_table_set_integrity(t); 1357 dm_table_set_integrity(t);
1328 1358
1329 /* 1359 /*