Skip to content

Commit 56dee46

Browse files
Ming Leiaxboe
authored andcommitted
block: move ELEVATOR_FLAG_DISABLE_WBT a request queue flag
ELEVATOR_FLAG_DISABLE_WBT is only used by BFQ to disallow wbt when BFQ is in use. The flag is set in BFQ's init(), and cleared in BFQ's exit(). Making it as request queue flag, so that we can avoid to deal with elevator switch race. Also it isn't graceful to checking one scheduler flag in wbt_enable_default(). Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Nilay Shroff <nilay@linux.ibm.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20250505141805.2751237-3-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent f24d47e commit 56dee46

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

block/bfq-iosched.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7210,7 +7210,7 @@ static void bfq_exit_queue(struct elevator_queue *e)
72107210
#endif
72117211

72127212
blk_stat_disable_accounting(bfqd->queue);
7213-
clear_bit(ELEVATOR_FLAG_DISABLE_WBT, &e->flags);
7213+
blk_queue_flag_clear(QUEUE_FLAG_DISABLE_WBT_DEF, bfqd->queue);
72147214
wbt_enable_default(bfqd->queue->disk);
72157215

72167216
kfree(bfqd);
@@ -7397,7 +7397,7 @@ static int bfq_init_queue(struct request_queue *q, struct elevator_type *e)
73977397
/* We dispatch from request queue wide instead of hw queue */
73987398
blk_queue_flag_set(QUEUE_FLAG_SQ_SCHED, q);
73997399

7400-
set_bit(ELEVATOR_FLAG_DISABLE_WBT, &eq->flags);
7400+
blk_queue_flag_set(QUEUE_FLAG_DISABLE_WBT_DEF, q);
74017401
wbt_disable_default(q->disk);
74027402
blk_stat_enable_accounting(q);
74037403

block/blk-mq-debugfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ static const char *const blk_queue_flag_name[] = {
9393
QUEUE_FLAG_NAME(RQ_ALLOC_TIME),
9494
QUEUE_FLAG_NAME(HCTX_ACTIVE),
9595
QUEUE_FLAG_NAME(SQ_SCHED),
96+
QUEUE_FLAG_NAME(DISABLE_WBT_DEF),
9697
};
9798
#undef QUEUE_FLAG_NAME
9899

block/blk-wbt.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,8 +704,7 @@ void wbt_enable_default(struct gendisk *disk)
704704
struct rq_qos *rqos;
705705
bool enable = IS_ENABLED(CONFIG_BLK_WBT_MQ);
706706

707-
if (q->elevator &&
708-
test_bit(ELEVATOR_FLAG_DISABLE_WBT, &q->elevator->flags))
707+
if (blk_queue_disable_wbt(q))
709708
enable = false;
710709

711710
/* Throttling already enabled? */

block/elevator.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ struct elevator_queue
121121
};
122122

123123
#define ELEVATOR_FLAG_REGISTERED 0
124-
#define ELEVATOR_FLAG_DISABLE_WBT 1
125124

126125
/*
127126
* block elevator interface

include/linux/blkdev.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ enum {
641641
QUEUE_FLAG_RQ_ALLOC_TIME, /* record rq->alloc_time_ns */
642642
QUEUE_FLAG_HCTX_ACTIVE, /* at least one blk-mq hctx is active */
643643
QUEUE_FLAG_SQ_SCHED, /* single queue style io dispatch */
644+
QUEUE_FLAG_DISABLE_WBT_DEF, /* for sched to disable/enable wbt */
644645
QUEUE_FLAG_MAX
645646
};
646647

@@ -676,6 +677,8 @@ void blk_queue_flag_clear(unsigned int flag, struct request_queue *q);
676677
#define blk_queue_sq_sched(q) test_bit(QUEUE_FLAG_SQ_SCHED, &(q)->queue_flags)
677678
#define blk_queue_skip_tagset_quiesce(q) \
678679
((q)->limits.features & BLK_FEAT_SKIP_TAGSET_QUIESCE)
680+
#define blk_queue_disable_wbt(q) \
681+
test_bit(QUEUE_FLAG_DISABLE_WBT_DEF, &(q)->queue_flags)
679682

680683
extern void blk_set_pm_only(struct request_queue *q);
681684
extern void blk_clear_pm_only(struct request_queue *q);

0 commit comments

Comments
 (0)