blk-mq: remove __blk_mq_delay_run_hw_queue
PATCH 1/2 blk-mq: remove __blk_mq_delay_run_hw_queue
Open code the relevant parts of __blk_mq_delay_run_hw_queue in the two callers instead of the convoluted shared helper.
Signed-off-by Christoph Hellwig <[email protected]>
--- block/blk-mq.c | 51 +++++++++++++++++++------------------------------- 1 file changed, 19 insertions(+), 32 deletions(-)
block/blk-mq.c +19 -32
@@ -2025,46 +2025,19 @@ static int blk_mq_hctx_next_cpu(struct blk_mq_hw_ctx *hctx) }/** -* __blk_mq_delay_run_hw_queue - Run (or schedule to run) a hardware queue. +* blk_mq_delay_run_hw_queue - Run a hardware queue asynchronously. * @hctx: Pointer to the hardware queue to run. -* @async: If we want to run the queue asynchronously. * @msecs: Milliseconds of delay to wait before running the queue. * -* If !@async, try to run the queue now. Else, run the queue asynchronously and -* with a delay of @msecs. +* Run a hardware queue asynchronously with a delay of @msecs. */ -static void __blk_mq_delay_run_hw_queue (struct blk_mq_hw_ctx *hctx,bool async, -unsigned long msecs) +void blk_mq_delay_run_hw_queue (struct blk_mq_hw_ctx *hctx,unsigned long msecs) {if (unlikely (blk_mq_hctx_stopped (hctx)))return ; - -if (!async && !(hctx->flags &BLK_MQ_F_BLOCKING )) { -int cpu =get_cpu (); -if (cpumask_test_cpu (cpu, hctx->cpumask)) { -__blk_mq_run_hw_queue (hctx); -put_cpu (); -return ; - } - -put_cpu (); - } -kblockd_mod_delayed_work_on (blk_mq_hctx_next_cpu (hctx), &hctx->run_work,msecs_to_jiffies (msecs)); } - -/** -* blk_mq_delay_run_hw_queue - Run a hardware queue asynchronously. -* @hctx: Pointer to the hardware queue to run. -* @msecs: Milliseconds of delay to wait before running the queue. -* -* Run a hardware queue asynchronously with a delay of @msecs. -*/ -void blk_mq_delay_run_hw_queue (struct blk_mq_hw_ctx *hctx,unsigned long msecs) -{ -__blk_mq_delay_run_hw_queue (hctx, true, msecs); -}EXPORT_SYMBOL (blk_mq_delay_run_hw_queue);/**
@@ -2092,8 +2065,22 @@ void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async) need_run = !blk_queue_quiesced (hctx->queue) && blk_mq_hctx_has_pending(hctx)); -if (need_run) -__blk_mq_delay_run_hw_queue (hctx, async,0 ); +if (!need_run ||unlikely (blk_mq_hctx_stopped (hctx))) +return ; + +if (!async && !(hctx->flags &BLK_MQ_F_BLOCKING )) { +int cpu =get_cpu (); +if (cpumask_test_cpu (cpu, hctx->cpumask)) { +__blk_mq_run_hw_queue (hctx); +put_cpu (); +return ; + } + +put_cpu (); + } + +kblockd_mod_delayed_work_on (blk_mq_hctx_next_cpu (hctx), &hctx->run_work, +0 ); }EXPORT_SYMBOL (blk_mq_run_hw_queue);
Signature · 1 line
2.30.2
PATCH 2/2 block: remove kblockd_mod_delayed_work_on
Just open code the mod_delayed_work{,_on} calls.
Signed-off-by Christoph Hellwig <[email protected]>
--- block/blk-core.c | 9 +-------- block/blk-mq.c | 15 ++++++++------- block/blk.h | 1 + include/linux/blkdev.h | 1 - 4 files changed, 10 insertions(+), 16 deletions(-)
block/blk-core.c +1 -8
@@ -71,7 +71,7 @@ struct kmem_cache *blk_requestq_srcu_cachep;/* * Controlling structure to kblockd */ -static struct workqueue_struct *kblockd_workqueue; +struct workqueue_struct *kblockd_workqueue;/** * blk_queue_flag_set - atomically set a queue flag
@@ -1153,13 +1153,6 @@ int kblockd_schedule_work(struct work_struct *work) }EXPORT_SYMBOL (kblockd_schedule_work); -int kblockd_mod_delayed_work_on (int cpu,struct delayed_work *dwork, -unsigned long delay) -{ -return mod_delayed_work_on (cpu, kblockd_workqueue, dwork, delay); -} -EXPORT_SYMBOL (kblockd_mod_delayed_work_on); -void blk_start_plug_nr_ios (struct blk_plug *plug,unsigned short nr_ios) {struct task_struct *tsk = current;
block/blk-mq.c +8 -7
@@ -1336,15 +1336,15 @@ void blk_mq_add_to_requeue_list(struct request *rq, bool at_head,void blk_mq_kick_requeue_list (struct request_queue *q) { -kblockd_mod_delayed_work_on (WORK_CPU_UNBOUND , &q->requeue_work,0 ); +mod_delayed_work (kblockd_workqueue, &q->requeue_work,0 ); }EXPORT_SYMBOL (blk_mq_kick_requeue_list);void blk_mq_delay_kick_requeue_list (struct request_queue *q,unsigned long msecs) { -kblockd_mod_delayed_work_on (WORK_CPU_UNBOUND , &q->requeue_work, -msecs_to_jiffies (msecs)); +mod_delayed_work (kblockd_workqueue, &q->requeue_work, +msecs_to_jiffies (msecs)); }EXPORT_SYMBOL (blk_mq_delay_kick_requeue_list);
@@ -2035,8 +2035,9 @@ void blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs) {if (unlikely (blk_mq_hctx_stopped (hctx)))return ; -kblockd_mod_delayed_work_on (blk_mq_hctx_next_cpu (hctx), &hctx->run_work, -msecs_to_jiffies (msecs)); + +mod_delayed_work_on (blk_mq_hctx_next_cpu (hctx), kblockd_workqueue, + &hctx->run_work,msecs_to_jiffies (msecs)); }EXPORT_SYMBOL (blk_mq_delay_run_hw_queue);
@@ -2079,8 +2080,8 @@ void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async)put_cpu (); } -kblockd_mod_delayed_work_on (blk_mq_hctx_next_cpu (hctx), &hctx->run_work, -0 ); +mod_delayed_work_on (blk_mq_hctx_next_cpu (hctx), kblockd_workqueue, + &hctx->run_work,0 ); }EXPORT_SYMBOL (blk_mq_run_hw_queue);
block/blk.h +1 -0
@@ -12,6 +12,7 @@ struct elevator_type;/* Max future timer expiry for timeouts */ #define BLK_MAX_TIMEOUT (5 * HZ) +extern struct workqueue_struct *kblockd_workqueue;extern struct dentry *blk_debugfs_root;struct blk_flush_queue {
include/linux/blkdev.h +0 -1
@@ -1167,7 +1167,6 @@ static inline unsigned int block_size(struct block_device *bdev) }int kblockd_schedule_work (struct work_struct *work); -int kblockd_mod_delayed_work_on (int cpu,struct delayed_work *dwork,unsigned long delay);#define MODULE_ALIAS_BLOCKDEV (major,minor) \ MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor))
Signature · 1 line
2.30.2