/** * blk_complete_request - end I/O on a request * @req: the request being processed * * Description: * Ends all I/O on a request. It does not handle partial completions, * unless the driver actually implements this in its completion callback * through requeueing. The actual completion happens out-of-order, * through a softirq handler. The user must have registered a completion * callback through blk_queue_softirq_done(). **/ void blk_complete_request(struct request *req) { /* Linux允许程序员通过注入错误的方式来模拟故障,来检查程序对故障的处理是否完善 */ if (unlikely(blk_should_fake_timeout(req->q))) /* 检查注入错误 */ return; if (!blk_mark_rq_complete(req)) /* 原子地设置REQ_ATOM_COMPLETE */ __blk_complete_request(req); }
/** * blk_complete_request - end I/O on a request * @req: the request being processed * * Description: * Ends all I/O on a request. It does not handle partial completions, * unless the driver actually implements this in its completion callback * through requeueing. The actual completion happens out-of-order, * through a softirq handler. The user must have registered a completion * callback through blk_queue_softirq_done(). **/ void blk_complete_request(struct request *req) { if (unlikely(blk_should_fake_timeout(req->q))) return; if (!blk_mark_rq_complete(req)) __blk_complete_request(req); }
/** * blk_complete_request - end I/O on a request * @req: the request being processed * * Description: * Ends all I/O on a request. It does not handle partial completions, * unless the driver actually implements this in its completion callback * through requeueing. The actual completion happens out-of-order, * through a softirq handler. The user must have registered a completion * callback through blk_queue_softirq_done(). **/ void blk_complete_request(struct request *req) { if (unlikely(blk_should_fake_timeout(req->q))) return; #ifdef CONFIG_HISI_IO_LATENCY_TRACE req_latency_check(req,REQ_PROC_STAGE_COMPLETE); #endif if (!blk_mark_rq_complete(req)) __blk_complete_request(req); }