[RFC PATCH 02/21] loop: use lib tagset init helper

Chaitanya Kulkarni
2022-10-05T16:07:01Z

drivers/block/loop.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index ad92192c7d61..a915f25b4410 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1937,6 +1937,8 @@ static const struct blk_mq_ops loop_mq_ops = {

static int loop_add(int i)
{
+ unsigned int flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_STACKING |
+ BLK_MQ_F_NO_SCHED_BY_DEFAULT;
struct loop_device *lo;
struct gendisk *disk;
int err;
@@ -1967,14 +1969,8 @@ static int loop_add(int i)
goto out_free_dev;
i = err;

- lo->tag_set.ops = &loop_mq_ops;
- lo->tag_set.nr_hw_queues = 1;
- lo->tag_set.queue_depth = hw_queue_depth;
- lo->tag_set.numa_node = NUMA_NO_NODE;
- lo->tag_set.cmd_size = sizeof(struct loop_cmd);
- lo->tag_set.flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_STACKING |
- BLK_MQ_F_NO_SCHED_BY_DEFAULT;
- lo->tag_set.driver_data = lo;
+ blk_mq_init_tag_set(&lo->tag_set, &loop_mq_ops, 1, hw_queue_depth,
+ sizeof(struct loop_cmd), NUMA_NO_NODE, 0, flags, lo);

err = blk_mq_alloc_tag_set(&lo->tag_set);
if (err)
--
2.29.0