summaryrefslogtreecommitdiffstats
path: root/include/linux/bio.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-06-24 16:22:24 -0600
committerJens Axboe <axboe@fb.com>2014-06-24 16:22:24 -0600
commit66cb45aa41315d1d9972cada354fbdf7870d7714 (patch)
tree5ca5ef3c31f24a7a11989d8a6a163eed9aaf9528 /include/linux/bio.h
parent3a4b0eda8e4b27e6aca86f9f4d327c1070815e30 (diff)
downloadop-kernel-dev-66cb45aa41315d1d9972cada354fbdf7870d7714.zip
op-kernel-dev-66cb45aa41315d1d9972cada354fbdf7870d7714.tar.gz
block: add support for limiting gaps in SG lists
Another restriction inherited for NVMe - those devices don't support SG lists that have "gaps" in them. Gaps refers to cases where the previous SG entry doesn't end on a page boundary. For NVMe, all SG entries must start at offset 0 (except the first) and end on a page boundary (except the last). Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include/linux/bio.h')
-rw-r--r--include/linux/bio.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index f91decb..d2633ee 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -186,6 +186,15 @@ static inline void *bio_data(struct bio *bio)
#define BIOVEC_SEG_BOUNDARY(q, b1, b2) \
__BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, queue_segment_boundary((q)))
+/*
+ * Check if adding a bio_vec after bprv with offset would create a gap in
+ * the SG list. Most drivers don't care about this, but some do.
+ */
+static inline bool bvec_gap_to_prev(struct bio_vec *bprv, unsigned int offset)
+{
+ return offset || ((bprv->bv_offset + bprv->bv_len) & (PAGE_SIZE - 1));
+}
+
#define bio_io_error(bio) bio_endio((bio), -EIO)
/*
OpenPOWER on IntegriCloud