(1)bool blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async)——启动硬件队列派发IO请求
//启动硬件队列派发IO请求,可以同步/异步执行;如果队列不在静默状态(quiesced)且有IO请求pending,则启动派发
bool blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async)
{
int srcu_idx;
bool need_run;
/*
* When queue is quiesced, we may be switching io scheduler, or
* updating nr_hw_queues, or other things, and we can't run queue
* any more, even __blk_mq_hctx_has_pending() can't be called safely.
*
* And queue will be rerun in blk_mq_unquiesce_queue() if it is
* quiesced.
*/
hctx_lock(hctx, &srcu_idx);
need_run = !blk_queue_quiesced(hctx->queue) &&
blk_mq_hctx_has_pending(hctx);
hctx_unlock(hctx, srcu_idx);
if (need_run) {
__blk_mq_delay_run_hw_queue(hctx, async, 0);
return true;
}
return false;
}
2、static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)——派发IO请求