summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2018-10-11 17:44:04 -0400
committerMike Snitzer <snitzer@redhat.com>2018-10-11 17:51:13 -0400
commitcef6f55a9fb4f6d6f9df0f772aa64cf159997466 (patch)
tree1af91945c74ac972da4eba3e558fc72ba7bbf770 /drivers
parent953923c09fe83255ae11845db1c9eb576ba73df8 (diff)
dm table: require that request-based DM be layered on blk-mq devices
Now that request-based DM (multipath) is blk-mq only: this restriction is required while the legacy request-based IO path still exists. Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/dm-table.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index eeea32bb6a3e..618edfc3846f 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -908,10 +908,21 @@ static bool dm_table_supports_dax(struct dm_table *t)
static bool dm_table_does_not_support_partial_completion(struct dm_table *t);
+struct verify_rq_based_data {
+ unsigned sq_count;
+ unsigned mq_count;
+};
+
static int device_is_rq_based(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);
+ struct verify_rq_based_data *v = data;
+
+ if (q->mq_ops)
+ v->mq_count++;
+ else
+ v->sq_count++;
return queue_is_rq_based(q);
}
@@ -920,6 +931,7 @@ static int dm_table_determine_type(struct dm_table *t)
{
unsigned i;
unsigned bio_based = 0, request_based = 0, hybrid = 0;
+ struct verify_rq_based_data v = {.sq_count = 0, .mq_count = 0};
struct dm_target *tgt;
struct list_head *devices = dm_table_get_devices(t);
enum dm_queue_mode live_md_type = dm_get_md_type(t->md);
@@ -1022,10 +1034,14 @@ verify_rq_based:
/* Non-request-stackable devices can't be used for request-based dm */
if (!tgt->type->iterate_devices ||
- !tgt->type->iterate_devices(tgt, device_is_rq_based, NULL)) {
+ !tgt->type->iterate_devices(tgt, device_is_rq_based, &v)) {
DMERR("table load rejected: including non-request-stackable devices");
return -EINVAL;
}
+ if (v.sq_count > 0) {
+ DMERR("table load rejected: not all devices are blk-mq request-stackable");
+ return -EINVAL;
+ }
return 0;
}