Message ID | 20211018135559.244400-2-bigeasy@linutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | blk-mq: Allow to complete requests directly | expand |
On Mon, Oct 18, 2021 at 03:55:58PM +0200, Sebastian Andrzej Siewior wrote: > +static inline void blk_mq_complete_request_direct(struct request *rq, > + void (*complete)(struct request *rq)) Pleae avoid the overly long line. ote that by doing the normal two tab indent for the continuation that would be super trivial and way more readable.
On 2021-10-18 08:20:50 [-0700], Christoph Hellwig wrote: > On Mon, Oct 18, 2021 at 03:55:58PM +0200, Sebastian Andrzej Siewior wrote: > > +static inline void blk_mq_complete_request_direct(struct request *rq, > > + void (*complete)(struct request *rq)) > > Pleae avoid the overly long line. > > ote that by doing the normal two tab indent for the continuation that > would be super trivial and way more readable. Oki. Sebastian
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 13ba1861e688f..93780c890b479 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -521,6 +521,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);
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 <bigeasy@linutronix.de> --- include/linux/blk-mq.h | 11 +++++++++++ 1 file changed, 11 insertions(+)