提交 764f612c 编写于 作者: M Ming Lei 提交者: Jens Axboe

blk-merge: don't compute bi_phys_segments from bi_vcnt for cloned bio

It isn't correct to figure out req->bi_phys_segments from bio->bi_vcnt
if the bio is cloned.
Signed-off-by: NMing Lei <ming.lei@canonical.com>
Tested-by: NJeff Mahoney <jeffm@suse.com>
Signed-off-by: NJens Axboe <axboe@fb.com>
上级 b8839b8c
......@@ -97,14 +97,18 @@ void blk_recalc_rq_segments(struct request *rq)
void blk_recount_segments(struct request_queue *q, struct bio *bio)
{
if (test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags) &&
bool no_sg_merge = !!test_bit(QUEUE_FLAG_NO_SG_MERGE,
&q->queue_flags);
if (no_sg_merge && !bio_flagged(bio, BIO_CLONED) &&
bio->bi_vcnt < queue_max_segments(q))
bio->bi_phys_segments = bio->bi_vcnt;
else {
struct bio *nxt = bio->bi_next;
bio->bi_next = NULL;
bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio, false);
bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio,
no_sg_merge);
bio->bi_next = nxt;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册