summaryrefslogtreecommitdiff
path: root/block/blk.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-09-24 10:43:50 +0300
committerJens Axboe <axboe@kernel.dk>2018-09-24 21:33:54 +0300
commit6a9f5f240adfdced863a098d34f8f05ca6ab9d5f (patch)
treeeb81b3a3073e9c03c03170468f2ba43ed7f43487 /block/blk.h
parent27ca1d4ed04ea29dc77b47190a3cc82697023e76 (diff)
downloadlinux-6a9f5f240adfdced863a098d34f8f05ca6ab9d5f.tar.xz
block: simplify BIOVEC_PHYS_MERGEABLE
Turn the macro into an inline, move it to blk.h and simplify the arch hooks a bit. Also rename the function to biovec_phys_mergeable as there is no need to shout. 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.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/block/blk.h b/block/blk.h
index 63035c95689c..aed99cbc1bca 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -149,6 +149,20 @@ static inline void blk_queue_enter_live(struct request_queue *q)
percpu_ref_get(&q->q_usage_counter);
}
+#ifndef ARCH_BIOVEC_PHYS_MERGEABLE
+#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)
+{
+ if (bvec_to_phys(vec1) + vec1->bv_len != bvec_to_phys(vec2))
+ return false;
+ if (!ARCH_BIOVEC_PHYS_MERGEABLE(vec1, vec2))
+ return false;
+ return true;
+}
+
static inline bool __bvec_gap_to_prev(struct request_queue *q,
struct bio_vec *bprv, unsigned int offset)
{