Skip to content

Commit

Permalink
block: only honor SG gap prevention for merges that contain data
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Jens Axboe committed May 29, 2015
1 parent f6454b0 commit beefa6b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion block/blk-merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,8 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
!blk_write_same_mergeable(rq->bio, bio))
return false;

if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS)) {
/* Only check gaps if the bio carries data */
if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS) && bio_has_data(bio)) {
struct bio_vec *bprev;

bprev = &rq->biotail->bi_io_vec[rq->biotail->bi_vcnt - 1];
Expand Down

0 comments on commit beefa6b

Please sign in to comment.