提交 ef71de8b 编写于 作者: C Christoph Hellwig 提交者: Jens Axboe

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: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NSagi Grimberg <sagi@grimberg.me>
Reviewed-by: NHannes Reinecke <hare@suse.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 f421e1d9
...@@ -2769,6 +2769,27 @@ struct request *blk_fetch_request(struct request_queue *q) ...@@ -2769,6 +2769,27 @@ struct request *blk_fetch_request(struct request_queue *q)
} }
EXPORT_SYMBOL(blk_fetch_request); 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 * blk_update_request - Special helper function for request stacking drivers
* @req: the request being processed * @req: the request being processed
......
...@@ -1094,6 +1094,8 @@ extern struct request *blk_peek_request(struct request_queue *q); ...@@ -1094,6 +1094,8 @@ extern struct request *blk_peek_request(struct request_queue *q);
extern void blk_start_request(struct request *rq); extern void blk_start_request(struct request *rq);
extern struct request *blk_fetch_request(struct request_queue *q); extern struct request *blk_fetch_request(struct request_queue *q);
void blk_steal_bios(struct bio_list *list, struct request *rq);
/* /*
* Request completion related functions. * Request completion related functions.
* *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册