diff options
author | Christoph Hellwig <hch@lst.de> | 2014-04-16 03:44:52 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-04-16 16:15:25 -0400 |
commit | 63151a449ebaef062ffac5b302206565ff5ef62e (patch) | |
tree | d53d4090b1d92761b04baf47e0efb6ca5c860263 /block/blk-mq.c | |
parent | 6700a678c02e47b6d50c51da2a46ff80efedb8c7 (diff) |
blk-mq: allow drivers to hook into I/O completion
Split out the bottom half of blk_mq_end_io so that drivers can perform
work when they know a request has been completed, but before it has been
freed. This also obsoletes blk_mq_end_io_partial as drivers can now
pass any value to blk_update_request directly.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r-- | block/blk-mq.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index b59a8d027dff..86d66e0e900c 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -294,20 +294,24 @@ void blk_mq_clone_flush_request(struct request *flush_rq, | |||
294 | hctx->cmd_size); | 294 | hctx->cmd_size); |
295 | } | 295 | } |
296 | 296 | ||
297 | bool blk_mq_end_io_partial(struct request *rq, int error, unsigned int nr_bytes) | 297 | inline void __blk_mq_end_io(struct request *rq, int error) |
298 | { | 298 | { |
299 | if (blk_update_request(rq, error, blk_rq_bytes(rq))) | ||
300 | return true; | ||
301 | |||
302 | blk_account_io_done(rq); | 299 | blk_account_io_done(rq); |
303 | 300 | ||
304 | if (rq->end_io) | 301 | if (rq->end_io) |
305 | rq->end_io(rq, error); | 302 | rq->end_io(rq, error); |
306 | else | 303 | else |
307 | blk_mq_free_request(rq); | 304 | blk_mq_free_request(rq); |
308 | return false; | ||
309 | } | 305 | } |
310 | EXPORT_SYMBOL(blk_mq_end_io_partial); | 306 | EXPORT_SYMBOL(__blk_mq_end_io); |
307 | |||
308 | void blk_mq_end_io(struct request *rq, int error) | ||
309 | { | ||
310 | if (blk_update_request(rq, error, blk_rq_bytes(rq))) | ||
311 | BUG(); | ||
312 | __blk_mq_end_io(rq, error); | ||
313 | } | ||
314 | EXPORT_SYMBOL(blk_mq_end_io); | ||
311 | 315 | ||
312 | static void __blk_mq_complete_request_remote(void *data) | 316 | static void __blk_mq_complete_request_remote(void *data) |
313 | { | 317 | { |