diff --git a/block/blk-merge.c b/block/blk-merge.c index e73846a..64fbbba 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -79,9 +79,13 @@ static struct bio *blk_bio_segment_split(struct request_queue *q, unsigned front_seg_size = bio->bi_seg_front_size; bool do_split = true; struct bio *new = NULL; + bool no_sg_merge = !!test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags); bio_for_each_segment(bv, bio, iter) { - if (sectors + (bv.bv_len >> 9) > blk_max_size_offset(q, bio->bi_iter.bi_sector)) + if (no_sg_merge) + goto new_segment; + + if (sectors + (bv.bv_len >> 9) > queue_max_sectors(q)) goto split; /*