mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-07 22:42:04 +00:00
block: allow end_io based requests in the completion batch handling
With end_io handlers now being able to potentially pass ownership of the request upon completion, we can allow requests with end_io handlers in the batch completion handling. Reviewed-by: Anuj Gupta <anuj20.g@samsung.com> Reviewed-by: Keith Busch <kbusch@kernel.org> Co-developed-by: Stefan Roesch <shr@fb.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
de671d6116
commit
ab3e1d3bba
@ -823,8 +823,10 @@ static void blk_complete_request(struct request *req)
|
|||||||
* can find how many bytes remain in the request
|
* can find how many bytes remain in the request
|
||||||
* later.
|
* later.
|
||||||
*/
|
*/
|
||||||
req->bio = NULL;
|
if (!req->end_io) {
|
||||||
req->__data_len = 0;
|
req->bio = NULL;
|
||||||
|
req->__data_len = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1055,6 +1057,13 @@ void blk_mq_end_request_batch(struct io_comp_batch *iob)
|
|||||||
|
|
||||||
rq_qos_done(rq->q, rq);
|
rq_qos_done(rq->q, rq);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If end_io handler returns NONE, then it still has
|
||||||
|
* ownership of the request.
|
||||||
|
*/
|
||||||
|
if (rq->end_io && rq->end_io(rq, 0) == RQ_END_IO_NONE)
|
||||||
|
continue;
|
||||||
|
|
||||||
WRITE_ONCE(rq->state, MQ_RQ_IDLE);
|
WRITE_ONCE(rq->state, MQ_RQ_IDLE);
|
||||||
if (!req_ref_put_and_test(rq))
|
if (!req_ref_put_and_test(rq))
|
||||||
continue;
|
continue;
|
||||||
|
@ -853,8 +853,9 @@ static inline bool blk_mq_add_to_batch(struct request *req,
|
|||||||
struct io_comp_batch *iob, int ioerror,
|
struct io_comp_batch *iob, int ioerror,
|
||||||
void (*complete)(struct io_comp_batch *))
|
void (*complete)(struct io_comp_batch *))
|
||||||
{
|
{
|
||||||
if (!iob || (req->rq_flags & RQF_ELV) || req->end_io || ioerror)
|
if (!iob || (req->rq_flags & RQF_ELV) || ioerror)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!iob->complete)
|
if (!iob->complete)
|
||||||
iob->complete = complete;
|
iob->complete = complete;
|
||||||
else if (iob->complete != complete)
|
else if (iob->complete != complete)
|
||||||
|
Loading…
Reference in New Issue
Block a user