summaryrefslogtreecommitdiff
path: root/block/blk.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-09-24 09:43:52 +0200
committerJens Axboe <axboe@kernel.dk>2018-09-24 12:33:57 -0600
commit3dccdae54fe836a22cee9dc6df9fd1708ae075ce (patch)
tree95d8808538de6f977086e2603d75694d7c1848bc /block/blk.h
parent0e253391a970300fe4ae69d0c1d1ab494eb07508 (diff)
block: merge BIOVEC_SEG_BOUNDARY into biovec_phys_mergeable
These two checks should always be performed together, so merge them into a single helper. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk.h')
-rw-r--r--block/blk.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/block/blk.h b/block/blk.h
index aed99cbc1bca..8f7229b6f63e 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -153,13 +153,19 @@ static inline void blk_queue_enter_live(struct request_queue *q)
#define ARCH_BIOVEC_PHYS_MERGEABLE(vec1, vec2) true
#endif
-static inline bool biovec_phys_mergeable(const struct bio_vec *vec1,
- const struct bio_vec *vec2)
+static inline bool biovec_phys_mergeable(struct request_queue *q,
+ struct bio_vec *vec1, struct bio_vec *vec2)
{
- if (bvec_to_phys(vec1) + vec1->bv_len != bvec_to_phys(vec2))
+ unsigned long mask = queue_segment_boundary(q);
+ phys_addr_t addr1 = bvec_to_phys(vec1);
+ phys_addr_t addr2 = bvec_to_phys(vec2);
+
+ if (addr1 + vec1->bv_len != addr2)
return false;
if (!ARCH_BIOVEC_PHYS_MERGEABLE(vec1, vec2))
return false;
+ if ((addr1 | mask) != ((addr2 + vec2->bv_len - 1) | mask))
+ return false;
return true;
}