Linux driver-IO 派发

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.

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

早日实现财富自由-2025

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值