From 294d5fb28de8587d39c921852c67fd2aacefe149 Mon Sep 17 00:00:00 2001 From: Joseph Qi Date: Wed, 10 Jun 2020 17:40:57 +0800 Subject: [PATCH 1380/2944] alinux: blk-mq: remove QUEUE_FLAG_POLL from default MQ flags fix #28528017 In case of virtio-blk device, checking /sys/block//queue/io_poll will show 1 and user can't disable it. Actually virtio-blk doesn't support poll yet, so it will confuse end user. The root cause is mq initialization will default set bit QUEUE_FLAG_POLL. This fix takes ideas from the following upstream commits: 6544d229bf43 ("block: enable polling by default if a poll map is initalized") 6e0de61107f0 ("blk-mq: remove QUEUE_FLAG_POLL from default MQ flags") Since we don't want to get HCTX_TYPE_POLL related logic involved, so just check mq_ops->poll and then set QUEUE_FLAG_POLL. Signed-off-by: Joseph Qi Reviewed-by: Xiaoguang Wang --- block/blk-mq.c | 2 ++ include/linux/blkdev.h | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index cf03ee7..fb20919 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2707,6 +2707,8 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set, q->nr_queues = nr_cpu_ids; q->queue_flags |= QUEUE_FLAG_MQ_DEFAULT; + if (q->mq_ops->poll) + queue_flag_set_unlocked(QUEUE_FLAG_POLL, q); if (!(set->flags & BLK_MQ_F_SG_MERGE)) queue_flag_set_unlocked(QUEUE_FLAG_NO_SG_MERGE, q); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 2a05852..d180dee 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -728,8 +728,7 @@ struct request_queue { (1 << QUEUE_FLAG_ADD_RANDOM)) #define QUEUE_FLAG_MQ_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ - (1 << QUEUE_FLAG_SAME_COMP) | \ - (1 << QUEUE_FLAG_POLL)) + (1 << QUEUE_FLAG_SAME_COMP)) void blk_queue_flag_set(unsigned int flag, struct request_queue *q); void blk_queue_flag_clear(unsigned int flag, struct request_queue *q); -- 1.8.3.1