diff options
author | Jens Axboe <axboe@fb.com> | 2015-05-29 21:10:23 +0200 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-05-29 21:10:23 +0200 |
commit | beefa6ba7bf304d3de3a02cb7366fb0a7d6b27ab (patch) | |
tree | 17390185e6e56a3d9bdebd0997d8f95025a30d09 | |
parent | block: fix returnvar.cocci warnings (diff) | |
download | linux-beefa6ba7bf304d3de3a02cb7366fb0a7d6b27ab.tar.xz linux-beefa6ba7bf304d3de3a02cb7366fb0a7d6b27ab.zip |
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.
Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r-- | block/blk-merge.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c index fd3fee81c23c..30a0d9f89017 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -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]; |