diff options
author | Christoph Hellwig <hch@lst.de> | 2021-11-17 07:14:00 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-11-29 06:34:51 -0700 |
commit | f2b8f3ce989d8066f2dedaad223b3e73c4485223 (patch) | |
tree | f844603e5ab000fe2a223c9bbc09c1389b9db909 /block/blk-mq.c | |
parent | 52fdbbcc83f35da90f857668acc387470ed84606 (diff) | |
download | lwn-f2b8f3ce989d8066f2dedaad223b3e73c4485223.tar.gz lwn-f2b8f3ce989d8066f2dedaad223b3e73c4485223.zip |
block: move blk_steal_bios to blk-mq.c
Keep all the request based code together.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20211117061404.331732-8-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r-- | block/blk-mq.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index 3217139d2e0b..cd5f31c4d2fd 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -3014,6 +3014,27 @@ free_and_out: } EXPORT_SYMBOL_GPL(blk_rq_prep_clone); +/* + * 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); + static size_t order_to_size(unsigned int order) { return (size_t)PAGE_SIZE << order; |