Skip to content

Commit beefa6b

Browse files
committed
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>
1 parent f6454b0 commit beefa6b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

block/blk-merge.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,8 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
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];

0 commit comments

Comments
 (0)