diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index aabbf6830ffc4d55c4ea9dc876f273c6325bed8c..2c473c9b8990898c229a110fda8ba4748f73eccf 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -490,6 +490,18 @@ static inline int blk_mq_request_completed(struct request *rq) return blk_mq_rq_state(rq) == MQ_RQ_COMPLETE; } +/* + * + * Set the state to complete when completing a request from inside ->queue_rq. + * This is used by drivers that want to ensure special complete actions that + * need access to the request are called on failure, e.g. by nvme for + * multipathing. + */ +static inline void blk_mq_set_request_complete(struct request *rq) +{ + WRITE_ONCE(rq->state, MQ_RQ_COMPLETE); +} + void blk_mq_start_request(struct request *rq); void blk_mq_end_request(struct request *rq, blk_status_t error); void __blk_mq_end_request(struct request *rq, blk_status_t error);