Re: [PATCH 1/6] blk-mq: introduce blk_mq_set_request_complete
From: Chao Leng <hidden>
Date: 2021-01-06 02:31:05
Also in:
linux-nvme
From: Chao Leng <hidden>
Date: 2021-01-06 02:31:05
Also in:
linux-nvme
On 2021/1/6 3:16, Minwoo Im wrote:
Hello, On 21-01-05 15:19:31, Chao Leng wrote:quoted
In some scenarios, nvme need setting the state of request to MQ_RQ_COMPLETE. So add an inline function blk_mq_set_request_complete. For details, see the subsequent patches. Signed-off-by: Chao Leng <redacted> --- include/linux/blk-mq.h | 5 +++++ 1 file changed, 5 insertions(+)diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index e7482e6ad3ec..cee72d31054d 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h@@ -493,6 +493,11 @@ static inline int blk_mq_request_completed(struct request *rq) return blk_mq_rq_state(rq) == MQ_RQ_COMPLETE; } +static inline void blk_mq_set_request_complete(struct request *rq) +{ + WRITE_ONCE(rq->state, MQ_RQ_COMPLETE); +} +Maybe we can have this newly added helper with updating caller in blk_mq_complete_request_remote() also ?
There are similar optimizations for blk_mq_request_started and blk_mq_request_completed. It may be better to optimize it by using independent patches.
Thanks, .