Skip to content

Commit e0dff41

Browse files
author
Ming Lei
committed
block: move ELEVATOR_FLAG_DISABLE_WBT a request queue flag
JIRA: https://issues.redhat.com/browse/RHEL-106845 commit 56dee46 Author: Ming Lei <ming.lei@redhat.com> Date: Mon May 5 22:17:40 2025 +0800 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> Signed-off-by: Ming Lei <ming.lei@redhat.com>
1 parent 4705cf1 commit e0dff41

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);
@@ -7398,7 +7398,7 @@ static int bfq_init_queue(struct request_queue *q, struct elevator_type *e)
73987398
/* We dispatch from request queue wide instead of hw queue */
73997399
blk_queue_flag_set(QUEUE_FLAG_SQ_SCHED, q);
74007400

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

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
@@ -635,6 +635,7 @@ enum {
635635
QUEUE_FLAG_RQ_ALLOC_TIME, /* record rq->alloc_time_ns */
636636
QUEUE_FLAG_HCTX_ACTIVE, /* at least one blk-mq hctx is active */
637637
QUEUE_FLAG_SQ_SCHED, /* single queue style io dispatch */
638+
QUEUE_FLAG_DISABLE_WBT_DEF, /* for sched to disable/enable wbt */
638639
QUEUE_FLAG_MAX
639640
};
640641

@@ -670,6 +671,8 @@ void blk_queue_flag_clear(unsigned int flag, struct request_queue *q);
670671
#define blk_queue_sq_sched(q) test_bit(QUEUE_FLAG_SQ_SCHED, &(q)->queue_flags)
671672
#define blk_queue_skip_tagset_quiesce(q) \
672673
((q)->limits.features & BLK_FEAT_SKIP_TAGSET_QUIESCE)
674+
#define blk_queue_disable_wbt(q) \
675+
test_bit(QUEUE_FLAG_DISABLE_WBT_DEF, &(q)->queue_flags)
673676

674677
extern void blk_set_pm_only(struct request_queue *q);
675678
extern void blk_clear_pm_only(struct request_queue *q);

0 commit comments

Comments
 (0)