History

block: only honor SG gap prevention for merges that contain data

We can safely merge anything that wont generate an SG list entry, so if the bio is data-less (discard), don't look at potential SG gaps.

Jens Axboe committed 11 years ago

Commit beefa6b1 parent f6454b01 file · +2 −1Browse files

Unified · Split

block/blk-merge.c+2−1
@@ -589,7 +589,8 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio) · 588 unmodified lines
589589 !blk_write_same_mergeable(rq->bio, bio))
590590 return false;
591591
592− if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS)) {
592+ /* Only check gaps if the bio carries data */
593+ if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS) && bio_has_data(bio)) {
593594 struct bio_vec *bprev;
594595
595596 bprev = &rq->biotail->bi_io_vec[rq->biotail->bi_vcnt - 1];