diff options
| author | Bart Van Assche <bart.vanassche@sandisk.com> | 2016-11-15 15:33:16 -0800 |
|---|---|---|
| committer | Mike Snitzer <snitzer@redhat.com> | 2016-11-21 09:52:11 -0500 |
| commit | db1c06dc2edd242146e25d38b1af61b681d49253 (patch) | |
| tree | 1c8902c4a6f1096fca038e784f8db4fffa650903 | |
| parent | 6599c84e4ce6e428180f9958c7c40aa4202d8072 (diff) | |
| download | linux-dm-db1c06dc2edd242146e25d38b1af61b681d49253.tar.gz | |
dm table: simplify dm_table_determine_type()
Notice: this object is not reachable from any branch.
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>
Notice: this object is not reachable from any branch.
| -rw-r--r-- | drivers/md/dm-table.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index c4b53b332607b..8b013eae86467 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -871,7 +871,7 @@ static int dm_table_determine_type(struct dm_table *t) { unsigned i; 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_dev_internal *dd; struct list_head *devices = dm_table_get_devices(t); @@ -959,20 +959,15 @@ verify_rq_based: } if (q->mq_ops) - verify_blk_mq = true; + mq_count++; + else + sq_count++; } - - if (verify_blk_mq) { - /* 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; - } - - t->all_blk_mq = true; + if (sq_count && mq_count) { + DMERR("table load rejected: not all devices are blk-mq request-stackable"); + return -EINVAL; } + t->all_blk_mq = mq_count > 0; return 0; } |
