[RFC PATCH 14/21] scm_blk: use lib tagset init helper

Chaitanya Kulkarni kch at nvidia.com
Tue Oct 4 20:22:50 PDT 2022


Use the block layer helper to initialize the common fields of tag_set
such as blk_mq_ops, number of h/w queues, queue depth, command size,
numa_node, timeout, BLK_MQ_F_XXX flags, driver data. This initialization
is spread all over the block drivers. This avoids the code repetation of
the inialization code of the tag set in current block drivers and any
future ones.

Signed-off-by: Chaitanya Kulkarni <kch at nvidia.com>
---
 drivers/s390/block/scm_blk.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/s390/block/scm_blk.c b/drivers/s390/block/scm_blk.c
index 0c1df1d5f1ac..4b1653fd71a5 100644
--- a/drivers/s390/block/scm_blk.c
+++ b/drivers/s390/block/scm_blk.c
@@ -450,13 +450,9 @@ int scm_blk_dev_setup(struct scm_blk_dev *bdev, struct scm_device *scmdev)
 	spin_lock_init(&bdev->lock);
 	atomic_set(&bdev->queued_reqs, 0);
 
-	bdev->tag_set.ops = &scm_mq_ops;
-	bdev->tag_set.cmd_size = sizeof(blk_status_t);
-	bdev->tag_set.nr_hw_queues = nr_requests;
-	bdev->tag_set.queue_depth = nr_requests_per_io * nr_requests;
-	bdev->tag_set.flags = BLK_MQ_F_SHOULD_MERGE;
-	bdev->tag_set.numa_node = NUMA_NO_NODE;
-
+	blk_mq_init_tag_set(&bdev->tag_set, nr_requests,
+			nr_requests_per_io * nr_requests, sizeof(blk_status_t),
+			NUMA_NO_NODE, BLK_MQ_F_SHOULD_MERGE, NULL);
 	ret = blk_mq_alloc_tag_set(&bdev->tag_set);
 	if (ret)
 		goto out;
-- 
2.29.0




More information about the linux-mtd mailing list