aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-08-12 11:39:56 -0400
committerJens Axboe <axboe@kernel.dk>2019-08-22 09:14:36 -0400
commit320ea869a12cec206756207c6ca5f817ec45c7f2 (patch)
treef47241df847ce8a065edf328cf94794e8f4694c0 /block
parente9e006f5fcf2bab59149cb38a48a4817c1b538b4 (diff)
block: improve the gap check in __bio_add_pc_page
If we can add more data into an existing segment we do not create a gap per definition, so move the check for a gap after the attempt to merge into the segment. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/bio.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/block/bio.c b/block/bio.c
index 54769659a434..537d71a30e56 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -710,18 +710,18 @@ static int __bio_add_pc_page(struct request_queue *q, struct bio *bio,
710 goto done; 710 goto done;
711 } 711 }
712 712
713 /*
714 * If the queue doesn't support SG gaps and adding this
715 * offset would create a gap, disallow it.
716 */
717 if (bvec_gap_to_prev(q, bvec, offset))
718 return 0;
719
720 if (page_is_mergeable(bvec, page, len, offset, &same_page) && 713 if (page_is_mergeable(bvec, page, len, offset, &same_page) &&
721 can_add_page_to_seg(q, bvec, page, len, offset)) { 714 can_add_page_to_seg(q, bvec, page, len, offset)) {
722 bvec->bv_len += len; 715 bvec->bv_len += len;
723 goto done; 716 goto done;
724 } 717 }
718
719 /*
720 * If the queue doesn't support SG gaps and adding this segment
721 * would create a gap, disallow it.
722 */
723 if (bvec_gap_to_prev(q, bvec, offset))
724 return 0;
725 } 725 }
726 726
727 if (bio_full(bio, len)) 727 if (bio_full(bio, len))