summaryrefslogtreecommitdiffstats
path: root/block/bio.c
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 /block/bio.c
parent3a4b0eda8e4b27e6aca86f9f4d327c1070815e30 (diff)
downloadlinux-66cb45aa41315d1d9972cada354fbdf7870d7714.tar.gz
linux-66cb45aa41315d1d9972cada354fbdf7870d7714.tar.bz2
linux-66cb45aa41315d1d9972cada354fbdf7870d7714.zip
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 'block/bio.c')
-rw-r--r--block/bio.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/block/bio.c b/block/bio.c
index 8c2e55e39a1b..0ec61c9e536c 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -746,6 +746,14 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page
goto done;
}
+
+ /*
+ * If the queue doesn't support SG gaps and adding this
+ * offset would create a gap, disallow it.
+ */
+ if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS) &&
+ bvec_gap_to_prev(prev, offset))
+ return 0;
}
if (bio->bi_vcnt >= bio->bi_max_vecs)