dm table: simplify dm_table_determine_type()
Use a single loop instead of two loops to determine whether or not all_blk_mq has to be set. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
Родитель
301fc3f5ef
Коммит
5b8c01f74c
|
@ -871,7 +871,7 @@ static int dm_table_determine_type(struct dm_table *t)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
unsigned bio_based = 0, request_based = 0, hybrid = 0;
|
unsigned bio_based = 0, request_based = 0, hybrid = 0;
|
||||||
bool verify_blk_mq = false;
|
unsigned sq_count = 0, mq_count = 0;
|
||||||
struct dm_target *tgt;
|
struct dm_target *tgt;
|
||||||
struct dm_dev_internal *dd;
|
struct dm_dev_internal *dd;
|
||||||
struct list_head *devices = dm_table_get_devices(t);
|
struct list_head *devices = dm_table_get_devices(t);
|
||||||
|
@ -966,20 +966,15 @@ verify_rq_based:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (q->mq_ops)
|
if (q->mq_ops)
|
||||||
verify_blk_mq = true;
|
mq_count++;
|
||||||
|
else
|
||||||
|
sq_count++;
|
||||||
}
|
}
|
||||||
|
if (sq_count && mq_count) {
|
||||||
if (verify_blk_mq) {
|
DMERR("table load rejected: not all devices are blk-mq request-stackable");
|
||||||
/* verify _all_ devices in the table are blk-mq devices */
|
|
||||||
list_for_each_entry(dd, devices, list)
|
|
||||||
if (!bdev_get_queue(dd->dm_dev->bdev)->mq_ops) {
|
|
||||||
DMERR("table load rejected: not all devices"
|
|
||||||
" are blk-mq request-stackable");
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
t->all_blk_mq = mq_count > 0;
|
||||||
t->all_blk_mq = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (t->type == DM_TYPE_MQ_REQUEST_BASED && !t->all_blk_mq) {
|
if (t->type == DM_TYPE_MQ_REQUEST_BASED && !t->all_blk_mq) {
|
||||||
DMERR("table load rejected: all devices are not blk-mq request-stackable");
|
DMERR("table load rejected: all devices are not blk-mq request-stackable");
|
||||||
|
|
Загрузка…
Ссылка в новой задаче