diff options
author | Christoph Hellwig <hch@lst.de> | 2018-09-24 09:43:52 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-09-24 20:33:57 +0200 |
commit | 3dccdae54fe836a22cee9dc6df9fd1708ae075ce (patch) | |
tree | 95d8808538de6f977086e2603d75694d7c1848bc /block/blk.h | |
parent | block: add a missing BIOVEC_SEG_BOUNDARY check in bio_add_pc_page (diff) | |
download | linux-3dccdae54fe836a22cee9dc6df9fd1708ae075ce.tar.xz linux-3dccdae54fe836a22cee9dc6df9fd1708ae075ce.zip |
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.h | 12 |
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; } |