summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-04-16 11:44:53 +0400
committerJens Axboe <axboe@fb.com>2014-04-17 00:15:25 +0400
commit91b63639c7d59dbf86da5311faff43691dcae832 (patch)
treefb20c0f5fb01d1e457ca0c318f87d5c2b5ef43cb
parent63151a449ebaef062ffac5b302206565ff5ef62e (diff)
downloadlinux-91b63639c7d59dbf86da5311faff43691dcae832.tar.xz
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: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--block/blk-mq.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 86d66e0e900c..963a82109386 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -298,10 +298,13 @@ inline void __blk_mq_end_io(struct request *rq, int error)
{
blk_account_io_done(rq);
- if (rq->end_io)
+ if (rq->end_io) {
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);
+ }
}
EXPORT_SYMBOL(__blk_mq_end_io);
@@ -366,6 +369,8 @@ static void blk_mq_start_request(struct request *rq, bool last)
trace_block_rq_issue(q, 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