Skip to content

Commit e7602bb

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: remove BLK_MQ_F_NO_SCHED
The only queues that really can't support a scheduler are those that do not have a gendisk associated with them, and thus can't be used for non-passthrough commands. In addition to those null_blk can optionally set the flag, which is a bad odd. Replace the null_blk usage with BLK_MQ_F_NO_SCHED_BY_DEFAULT to keep the expected semantics and then remove BLK_MQ_F_NO_SCHED as the non-disk queues never call into elevator_init_mq or blk_register_queue which adds the sysfs attributes. Signed-off-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 68ed451 commit e7602bb

File tree

8 files changed

+3
-29
lines changed

8 files changed

+3
-29
lines changed

block/blk-mq-debugfs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ static const char *const hctx_flag_name[] = {
185185
HCTX_FLAG_NAME(STACKING),
186186
HCTX_FLAG_NAME(TAG_HCTX_SHARED),
187187
HCTX_FLAG_NAME(BLOCKING),
188-
HCTX_FLAG_NAME(NO_SCHED),
189188
HCTX_FLAG_NAME(NO_SCHED_BY_DEFAULT),
190189
};
191190
#undef HCTX_FLAG_NAME

block/bsg-lib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ struct request_queue *bsg_setup_queue(struct device *dev, const char *name,
381381
set->queue_depth = 128;
382382
set->numa_node = NUMA_NO_NODE;
383383
set->cmd_size = sizeof(struct bsg_job) + dd_job_size;
384-
set->flags = BLK_MQ_F_NO_SCHED | BLK_MQ_F_BLOCKING;
384+
set->flags = BLK_MQ_F_BLOCKING;
385385
if (blk_mq_alloc_tag_set(set))
386386
goto out_tag_set;
387387

block/elevator.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -547,14 +547,6 @@ void elv_unregister(struct elevator_type *e)
547547
}
548548
EXPORT_SYMBOL_GPL(elv_unregister);
549549

550-
static inline bool elv_support_iosched(struct request_queue *q)
551-
{
552-
if (!queue_is_mq(q) ||
553-
(q->tag_set->flags & BLK_MQ_F_NO_SCHED))
554-
return false;
555-
return true;
556-
}
557-
558550
/*
559551
* For single queue devices, default to using mq-deadline. If we have multiple
560552
* queues or mq-deadline is not available, default to "none".
@@ -580,9 +572,6 @@ void elevator_init_mq(struct request_queue *q)
580572
struct elevator_type *e;
581573
int err;
582574

583-
if (!elv_support_iosched(q))
584-
return;
585-
586575
WARN_ON_ONCE(blk_queue_registered(q));
587576

588577
if (unlikely(q->elevator))
@@ -714,9 +703,6 @@ void elv_iosched_load_module(struct gendisk *disk, const char *buf,
714703
struct elevator_type *found;
715704
const char *name;
716705

717-
if (!elv_support_iosched(disk->queue))
718-
return;
719-
720706
strscpy(elevator_name, buf, sizeof(elevator_name));
721707
name = strstrip(elevator_name);
722708

@@ -734,9 +720,6 @@ ssize_t elv_iosched_store(struct gendisk *disk, const char *buf,
734720
char elevator_name[ELV_NAME_MAX];
735721
int ret;
736722

737-
if (!elv_support_iosched(disk->queue))
738-
return count;
739-
740723
strscpy(elevator_name, buf, sizeof(elevator_name));
741724
ret = elevator_change(disk->queue, strstrip(elevator_name));
742725
if (!ret)
@@ -751,9 +734,6 @@ ssize_t elv_iosched_show(struct gendisk *disk, char *name)
751734
struct elevator_type *cur = NULL, *e;
752735
int len = 0;
753736

754-
if (!elv_support_iosched(q))
755-
return sprintf(name, "none\n");
756-
757737
if (!q->elevator) {
758738
len += sprintf(name+len, "[none] ");
759739
} else {

drivers/block/null_blk/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,7 +1792,7 @@ static int null_init_global_tag_set(void)
17921792
tag_set.queue_depth = g_hw_queue_depth;
17931793
tag_set.numa_node = g_home_node;
17941794
if (g_no_sched)
1795-
tag_set.flags |= BLK_MQ_F_NO_SCHED;
1795+
tag_set.flags |= BLK_MQ_F_NO_SCHED_BY_DEFAULT;
17961796
if (g_shared_tag_bitmap)
17971797
tag_set.flags |= BLK_MQ_F_TAG_HCTX_SHARED;
17981798
if (g_blocking)
@@ -1817,7 +1817,7 @@ static int null_setup_tagset(struct nullb *nullb)
18171817
nullb->tag_set->queue_depth = nullb->dev->hw_queue_depth;
18181818
nullb->tag_set->numa_node = nullb->dev->home_node;
18191819
if (nullb->dev->no_sched)
1820-
nullb->tag_set->flags |= BLK_MQ_F_NO_SCHED;
1820+
nullb->tag_set->flags |= BLK_MQ_F_NO_SCHED_BY_DEFAULT;
18211821
if (nullb->dev->shared_tag_bitmap)
18221822
nullb->tag_set->flags |= BLK_MQ_F_TAG_HCTX_SHARED;
18231823
if (nullb->dev->blocking)

drivers/nvme/host/apple.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,6 @@ static int apple_nvme_alloc_tagsets(struct apple_nvme *anv)
12511251
anv->admin_tagset.timeout = NVME_ADMIN_TIMEOUT;
12521252
anv->admin_tagset.numa_node = NUMA_NO_NODE;
12531253
anv->admin_tagset.cmd_size = sizeof(struct apple_nvme_iod);
1254-
anv->admin_tagset.flags = BLK_MQ_F_NO_SCHED;
12551254
anv->admin_tagset.driver_data = &anv->adminq;
12561255

12571256
ret = blk_mq_alloc_tag_set(&anv->admin_tagset);

drivers/nvme/host/core.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4564,7 +4564,6 @@ int nvme_alloc_admin_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
45644564
/* Reserved for fabric connect and keep alive */
45654565
set->reserved_tags = 2;
45664566
set->numa_node = ctrl->numa_node;
4567-
set->flags = BLK_MQ_F_NO_SCHED;
45684567
if (ctrl->ops->flags & NVME_F_BLOCKING)
45694568
set->flags |= BLK_MQ_F_BLOCKING;
45704569
set->cmd_size = cmd_size;

drivers/ufs/core/ufshcd.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10412,7 +10412,6 @@ static int ufshcd_add_scsi_host(struct ufs_hba *hba)
1041210412
.nr_hw_queues = 1,
1041310413
.queue_depth = hba->nutmrs,
1041410414
.ops = &ufshcd_tmf_ops,
10415-
.flags = BLK_MQ_F_NO_SCHED,
1041610415
};
1041710416
err = blk_mq_alloc_tag_set(&hba->tmf_tag_set);
1041810417
if (err < 0)

include/linux/blk-mq.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,6 @@ enum {
676676
BLK_MQ_F_STACKING = 1 << 2,
677677
BLK_MQ_F_TAG_HCTX_SHARED = 1 << 3,
678678
BLK_MQ_F_BLOCKING = 1 << 4,
679-
/* Do not allow an I/O scheduler to be configured. */
680-
BLK_MQ_F_NO_SCHED = 1 << 5,
681679

682680
/*
683681
* Select 'none' during queue registration in case of a single hwq

0 commit comments

Comments
 (0)