diff options
author | Chao Leng <lengchao@huawei.com> | 2021-02-01 06:49:38 +0300 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2021-02-10 18:38:02 +0300 |
commit | 83fba8c8114748a18e20391565cfdfdf8466075c (patch) | |
tree | d7ecd2392807517912b8310e4364a62ed08ab561 /include/linux/blk-mq.h | |
parent | f720a8edbc6470fad8b47d0d4ae092a6c63340bb (diff) | |
download | linux-83fba8c8114748a18e20391565cfdfdf8466075c.tar.xz |
blk-mq: introduce blk_mq_set_request_complete
nvme drivers need to set the state of request to MQ_RQ_COMPLETE when
directly complete request in queue_rq.
So add blk_mq_set_request_complete.
Signed-off-by: Chao Leng <lengchao@huawei.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'include/linux/blk-mq.h')
-rw-r--r-- | include/linux/blk-mq.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index aabbf6830ffc..2c473c9b8990 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); |