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

block: untangle the end of blk_bio_segment_split

Now that we don't need to assign the front/back segment sizes, we can
duplicating the segs assignment for the split vs no-split case and
remove a whole chunk of boilerplate code.
Reviewed-by: NHannes Reinecke <hare@suse.com>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 e9cd19c0
...@@ -202,8 +202,6 @@ static struct bio *blk_bio_segment_split(struct request_queue *q, ...@@ -202,8 +202,6 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
struct bio_vec bv, bvprv, *bvprvp = NULL; struct bio_vec bv, bvprv, *bvprvp = NULL;
struct bvec_iter iter; struct bvec_iter iter;
unsigned nsegs = 0, sectors = 0; unsigned nsegs = 0, sectors = 0;
bool do_split = true;
struct bio *new = NULL;
const unsigned max_sectors = get_max_io_size(q, bio); const unsigned max_sectors = get_max_io_size(q, bio);
const unsigned max_segs = queue_max_segments(q); const unsigned max_segs = queue_max_segments(q);
...@@ -245,17 +243,11 @@ static struct bio *blk_bio_segment_split(struct request_queue *q, ...@@ -245,17 +243,11 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
} }
} }
do_split = false; *segs = nsegs;
return NULL;
split: split:
*segs = nsegs; *segs = nsegs;
return bio_split(bio, sectors, GFP_NOIO, bs);
if (do_split) {
new = bio_split(bio, sectors, GFP_NOIO, bs);
if (new)
bio = new;
}
return do_split ? new : NULL;
} }
void __blk_queue_split(struct request_queue *q, struct bio **bio, void __blk_queue_split(struct request_queue *q, struct bio **bio,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册