Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91b63639 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

blk-mq: bidi support



Add two unlinkely branches to make sure the resid is initialized correctly
for bidi request pairs, and the second request gets properly freed.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 63151a44
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
@@ -298,11 +298,14 @@ inline void __blk_mq_end_io(struct request *rq, int error)
{
{
	blk_account_io_done(rq);
	blk_account_io_done(rq);


	if (rq->end_io)
	if (rq->end_io) {
		rq->end_io(rq, error);
		rq->end_io(rq, error);
	else
	} else {
		if (unlikely(blk_bidi_rq(rq)))
			blk_mq_free_request(rq->next_rq);
		blk_mq_free_request(rq);
		blk_mq_free_request(rq);
	}
	}
}
EXPORT_SYMBOL(__blk_mq_end_io);
EXPORT_SYMBOL(__blk_mq_end_io);


void blk_mq_end_io(struct request *rq, int error)
void blk_mq_end_io(struct request *rq, int error)
@@ -366,6 +369,8 @@ static void blk_mq_start_request(struct request *rq, bool last)
	trace_block_rq_issue(q, rq);
	trace_block_rq_issue(q, rq);


	rq->resid_len = blk_rq_bytes(rq);
	rq->resid_len = blk_rq_bytes(rq);
	if (unlikely(blk_bidi_rq(rq)))
		rq->next_rq->resid_len = blk_rq_bytes(rq->next_rq);


	/*
	/*
	 * Just mark start time and set the started bit. Due to memory
	 * Just mark start time and set the started bit. Due to memory