diff options
author | Christoph Hellwig <hch@lst.de> | 2017-11-02 21:29:51 +0300 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2019-02-12 10:33:25 +0800 |
commit | c21c8b24ef14c66c2764134eb6822bbc884048b7 (patch) | |
tree | 07110ff8be8e43a4aeb47e20bfd9f6d58c2a3623 /block | |
parent | 7055bd5233863e27e3efe6605aa07901cc61b544 (diff) |
block: add a blk_steal_bios helper
This helpers allows to bounce steal the uncompleted bios from a request so
that they can be reissued on another path.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit ef71de8b15d891b27b8c983a9a8972b11cb4576a)
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-core.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 468025c9e03f..914c3e79683d 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -2747,6 +2747,27 @@ struct request *blk_fetch_request(struct request_queue *q) } EXPORT_SYMBOL(blk_fetch_request); +/* + * Steal bios from a request and add them to a bio list. + * The request must not have been partially completed before. + */ +void blk_steal_bios(struct bio_list *list, struct request *rq) +{ + if (rq->bio) { + if (list->tail) + list->tail->bi_next = rq->bio; + else + list->head = rq->bio; + list->tail = rq->biotail; + + rq->bio = NULL; + rq->biotail = NULL; + } + + rq->__data_len = 0; +} +EXPORT_SYMBOL_GPL(blk_steal_bios); + /** * blk_update_request - Special helper function for request stacking drivers * @req: the request being processed |