From: Sebastian Andrzej Siewior Date: Mon, 25 Oct 2021 07:06:57 +0000 (+0200) Subject: blk-mq: Add blk_mq_complete_request_direct() X-Git-Tag: v6.1-rc5~2252^2~49 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e8dc17e2893b4107366004810ca2a4acf1fc8563;p=platform%2Fkernel%2Flinux-starfive.git blk-mq: Add blk_mq_complete_request_direct() Add blk_mq_complete_request_direct() which completes the block request directly instead deferring it to softirq for single queue devices. This is useful for devices which complete the requests in preemptible context and raising softirq from means scheduling ksoftirqd. Signed-off-by: Sebastian Andrzej Siewior Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20211025070658.1565848-2-bigeasy@linutronix.de Signed-off-by: Jens Axboe --- diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 308edc2a4925..d952c3442261 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -752,6 +752,17 @@ static inline void blk_mq_set_request_complete(struct request *rq) WRITE_ONCE(rq->state, MQ_RQ_COMPLETE); } +/* + * Complete the request directly instead of deferring it to softirq or + * completing it another CPU. Useful in preemptible instead of an interrupt. + */ +static inline void blk_mq_complete_request_direct(struct request *rq, + void (*complete)(struct request *rq)) +{ + WRITE_ONCE(rq->state, MQ_RQ_COMPLETE); + complete(rq); +} + 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);