@@ -317,14 +317,13 @@ static bool blk_mq_sched_bypass_insert(struct blk_mq_hw_ctx *hctx,
return true;
}
-static void blk_mq_sched_restart_hctx(struct blk_mq_hw_ctx *hctx)
+void blk_mq_sched_restart_hctx(struct blk_mq_hw_ctx *hctx)
{
- if (test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state)) {
- clear_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state);
- if (blk_mq_hctx_has_pending(hctx))
- blk_mq_run_hw_queue(hctx, true);
- }
+ clear_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state);
+ if (blk_mq_hctx_has_pending(hctx))
+ blk_mq_run_hw_queue(hctx, true);
}
+EXPORT_SYMBOL(blk_mq_sched_restart_hctx);
void blk_mq_sched_restart_queues(struct blk_mq_hw_ctx *hctx)
{
@@ -334,9 +333,11 @@ void blk_mq_sched_restart_queues(struct blk_mq_hw_ctx *hctx)
if (test_bit(QUEUE_FLAG_RESTART, &q->queue_flags)) {
if (test_and_clear_bit(QUEUE_FLAG_RESTART, &q->queue_flags)) {
queue_for_each_hw_ctx(q, hctx, i)
- blk_mq_sched_restart_hctx(hctx);
+ if (test_bit(BLK_MQ_S_SCHED_RESTART,
+ &hctx->state))
+ blk_mq_sched_restart_hctx(hctx);
}
- } else {
+ } else if (test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state)) {
blk_mq_sched_restart_hctx(hctx);
}
}
@@ -237,6 +237,7 @@ void blk_mq_stop_hw_queues(struct request_queue *q);
void blk_mq_start_hw_queues(struct request_queue *q);
void blk_mq_start_stopped_hw_queue(struct blk_mq_hw_ctx *hctx, bool async);
void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async);
+void blk_mq_sched_restart_hctx(struct blk_mq_hw_ctx *hctx);
void blk_mq_run_hw_queues(struct request_queue *q, bool async);
void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs);
void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset,
Since a later patch will add a call to this function from the SCSI core, export this function. Move the BLK_MQ_S_SCHED_RESTART bit test from blk_mq_sched_restart_hctx() into the callers of this function. This leads to some code duplication but that will be addressed in another patch in this series. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.com> Cc: Martin K. Petersen <martin.petersen@oracle.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> --- block/blk-mq-sched.c | 17 +++++++++-------- include/linux/blk-mq.h | 1 + 2 files changed, 10 insertions(+), 8 deletions(-)