diff mbox series

[5/5] block: use __bio_try_merge_page in __bio_try_merge_pc_page

Message ID 20190611151007.13625-6-hch@lst.de
State New, archived
Headers show
Series [1/5] block: fix gap checking in __bio_add_pc_page | expand

Commit Message

Christoph Hellwig June 11, 2019, 3:10 p.m. UTC
Passsthrough bio handling should be the same as normal bio handling,
except that we need to take hardware limitations into account.  Thus
use the common try_merge implementation after checking the hardware
limits.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/bio.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/block/bio.c b/block/bio.c
index 0d841ba4373a..7db7186eab1c 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -661,20 +661,11 @@  static bool bio_try_merge_pc_page(struct request_queue *q, struct bio *bio,
 	phys_addr_t addr1 = page_to_phys(bv->bv_page) + bv->bv_offset;
 	phys_addr_t addr2 = page_to_phys(page) + off + len - 1;
 
-	if (page == bv->bv_page && off == bv->bv_offset + bv->bv_len) {
-		*same_page = true;
-		goto done;
-	}
-
 	if ((addr1 | mask) != (addr2 | mask))
 		return false;
 	if (bv->bv_len + len > queue_max_segment_size(q))
 		return false;
-	if (!page_is_mergeable(bv, page, len, off, false))
-		return false;
-done:
-	bv->bv_len += len;
-	return true;
+	return __bio_try_merge_page(bio, page, len, off, same_page);
 }
 
 /**
@@ -737,8 +728,8 @@  static int __bio_add_pc_page(struct request_queue *q, struct bio *bio,
 	bvec->bv_len = len;
 	bvec->bv_offset = offset;
 	bio->bi_vcnt++;
- done:
 	bio->bi_iter.bi_size += len;
+ done:
 	bio->bi_phys_segments = bio->bi_vcnt;
 	bio_set_flag(bio, BIO_SEG_VALID);
 	return len;