aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJens Axboe2019-04-05 09:08:51 -0600
committerJens Axboe2019-04-05 09:08:51 -0600
commit75199aa5269f66d0958aa9971fa81a92de83d7f9 (patch)
treeb8a52678e908d88124136353ceaeb422ae59a592 /include
parent2b24e6f63ac9e817630424c6d8f008256348dfc4 (diff)
parentd0de579c043c3a2ab60ce75eb6cf4d414becc676 (diff)
Merge branch 'nvme-5.2' of git://git.infradead.org/nvme into for-5.2/block
Pull NVMe changes from Christoph: "Below is the first batch of nvme updates for 5.2. This includes the performance improvements for single segment I/O on PCIe, which introduce new block helpers, so it might be a good idea to get them in early. - various performance optimizations in the PCIe code (Keith and me) - new block helpers to support the above (me) - nvmet error conversion cleanup (me) - nvmet-fc variable sized array cleanup (Gustavo) - passthrough ioctl error printk cleanup (Kenneth) - small nvmet fixes (Max) - endianess conversion cleanup (Max) - nvmet-tcp faspath completion optimization (Sagi)" * 'nvme-5.2' of git://git.infradead.org/nvme: (24 commits) nvme: log the error status on Identify Namespace failure nvmet: add safety check for subsystem lock during nvmet_ns_changed nvmet: never fail double namespace enablement nvme-pci: tidy up nvme_map_data nvme-pci: optimize mapping single segment requests using SGLs nvme-pci: optimize mapping of small single segment requests nvme-pci: remove the inline scatterlist optimization nvme-pci: split metadata handling from nvme_map_data / nvme_unmap_data nvme-pci: do not build a scatterlist to map metadata nvme-pci: only call nvme_unmap_data for requests transferring data nvme-pci: merge nvme_free_iod into nvme_unmap_data nvme-pci: move the call to nvme_cleanup_cmd out of nvme_unmap_data nvme-pci: remove nvme_init_iod block: add dma_map_bvec helper block: add a rq_dma_dir helper block: add a rq_integrity_vec helper block: add a req_bvec helper nvme-pci: remove unused nvme_iod member nvme-pci: remove q_dmadev from nvme_queue nvme-pci: use a flag for polled queues ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/blkdev.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 5c58a3b2bf00..4b85dc066264 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -641,6 +641,13 @@ static inline bool blk_account_rq(struct request *rq)
#define rq_data_dir(rq) (op_is_write(req_op(rq)) ? WRITE : READ)
+#define rq_dma_dir(rq) \
+ (op_is_write(req_op(rq)) ? DMA_TO_DEVICE : DMA_FROM_DEVICE)
+
+#define dma_map_bvec(dev, bv, dir, attrs) \
+ dma_map_page_attrs(dev, (bv)->bv_page, (bv)->bv_offset, (bv)->bv_len, \
+ (dir), (attrs))
+
static inline bool queue_is_mq(struct request_queue *q)
{
return q->mq_ops;
@@ -932,6 +939,17 @@ static inline unsigned int blk_rq_payload_bytes(struct request *rq)
return blk_rq_bytes(rq);
}
+/*
+ * Return the first full biovec in the request. The caller needs to check that
+ * there are any bvecs before calling this helper.
+ */
+static inline struct bio_vec req_bvec(struct request *rq)
+{
+ if (rq->rq_flags & RQF_SPECIAL_PAYLOAD)
+ return rq->special_vec;
+ return mp_bvec_iter_bvec(rq->bio->bi_io_vec, rq->bio->bi_iter);
+}
+
static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q,
int op)
{
@@ -1548,6 +1566,17 @@ static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi,
return bio_integrity_intervals(bi, sectors) * bi->tuple_size;
}
+/*
+ * Return the first bvec that contains integrity data. Only drivers that are
+ * limited to a single integrity segment should use this helper.
+ */
+static inline struct bio_vec *rq_integrity_vec(struct request *rq)
+{
+ if (WARN_ON_ONCE(queue_max_integrity_segments(rq->q) > 1))
+ return NULL;
+ return rq->bio->bi_integrity->bip_vec;
+}
+
#else /* CONFIG_BLK_DEV_INTEGRITY */
struct bio;
@@ -1622,6 +1651,11 @@ static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi,
return 0;
}
+static inline struct bio_vec *rq_integrity_vec(struct request *rq)
+{
+ return NULL;
+}
+
#endif /* CONFIG_BLK_DEV_INTEGRITY */
struct block_device_operations {