IO派发流程
blk_mq_sched_dispatch_requests函数定义在block/blk-mq-sched.c,用于派发各种队列的request
派发最终都是调用blk_mq_dispatch_rq_list(),该函数最终还是执行块设备驱动注册的queue_rq函数,将request请求发往块设备驱动层,块设备驱动不繁忙直接启动request传输,繁忙的话则把剩余的request转移到hctx->dispatch队列,然后启动异步传输。

IO timeout流程
IO request派发到磁盘过程,执行函数blk_start_request
启动一个IO请求超时派发定时器,函数 blk_mq_timeout_work
blk_mq_timeout_work遍历request_queue下的所有req,判断其是否已达到超时时间
blk_mq_check_expired检查request_queue下的每一个req,对于已经到了超时时间的req调用超时处理,超时处理完成后,如果满足释放条件(req引用计数为0),则释放req
blk_mq_rq_timed_out处理超时req,调用对应的mq_ops->timeout
最后打印调用函数nvme_timeout
一般系统默认
cat /sys/module/nvme_core/parameters/io_timeout :30
cat /sys/module/nvme_core/parameters/admin_timeout: 60

Shutdown immediately if controller times out while starting. The reset work will see the pci device disabled when it gets the forced cancellation error. All outstanding requests are completed on shutdown, so we return BLK_EH_DONE.
The aborted req will be completed on receiving the abort req. We enable the timer again. If hit twice, it'll cause a device reset, as the device then is in a faulty state.
Shutdown the controller immediately and schedule a reset if the command was already aborted once before and still hasn't been returned to the driver, or if this is the admin queue.


991

被折叠的 条评论
为什么被折叠?



