Skip to content

Commit 7a7c5e7

Browse files
damien-lemoalaxboe
authored andcommitted
block: Fix elv_support_iosched()
A BIO based request queue does not have a tag_set, which prevent testing for the flag BLK_MQ_F_NO_SCHED indicating that the queue does not require an elevator. This leads to an incorrect initialization of a default elevator in some cases such as BIO based null_blk (queue_mode == BIO) with zoned mode enabled as the default elevator in this case is mq-deadline instead of "none". Fix this by testing for a NULL queue mq_ops field which indicates that the queue is BIO based and should not have an elevator. Reported-by: Shinichiro Kawasaki <[email protected]> Reviewed-by: Bob Liu <[email protected]> Signed-off-by: Damien Le Moal <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 7adf4ea commit 7a7c5e7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

block/elevator.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,8 @@ int elevator_switch_mq(struct request_queue *q,
616616

617617
static inline bool elv_support_iosched(struct request_queue *q)
618618
{
619-
if (q->tag_set && (q->tag_set->flags & BLK_MQ_F_NO_SCHED))
619+
if (!q->mq_ops ||
620+
(q->tag_set && (q->tag_set->flags & BLK_MQ_F_NO_SCHED)))
620621
return false;
621622
return true;
622623
}

0 commit comments

Comments
 (0)