diff options
| author | Christoph Hellwig <hch@lst.de> | 2019-03-03 10:38:29 -0500 |
|---|---|---|
| committer | Christoph Hellwig <hch@lst.de> | 2019-04-05 02:07:57 -0400 |
| commit | 2a876f5e25e8ec9fa5777d36e5695ee33dd63f6f (patch) | |
| tree | dd1f6e267f5cb0417264a4b24db2a25c2b6f099b /include/linux/blkdev.h | |
| parent | 3aef3cae4342c1d8137a1c0782cbb66f1be3943c (diff) | |
block: add a rq_integrity_vec helper
This provides a nice little shortcut to get the integrity data for
drivers like NVMe that only support a single integrity segment.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Diffstat (limited to 'include/linux/blkdev.h')
| -rw-r--r-- | include/linux/blkdev.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 84ce76f92d83..3a13fbe13e08 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -1559,6 +1559,17 @@ static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi, | |||
| 1559 | return bio_integrity_intervals(bi, sectors) * bi->tuple_size; | 1559 | return bio_integrity_intervals(bi, sectors) * bi->tuple_size; |
| 1560 | } | 1560 | } |
| 1561 | 1561 | ||
| 1562 | /* | ||
| 1563 | * Return the first bvec that contains integrity data. Only drivers that are | ||
| 1564 | * limited to a single integrity segment should use this helper. | ||
| 1565 | */ | ||
| 1566 | static inline struct bio_vec *rq_integrity_vec(struct request *rq) | ||
| 1567 | { | ||
| 1568 | if (WARN_ON_ONCE(queue_max_integrity_segments(rq->q) > 1)) | ||
| 1569 | return NULL; | ||
| 1570 | return rq->bio->bi_integrity->bip_vec; | ||
| 1571 | } | ||
| 1572 | |||
| 1562 | #else /* CONFIG_BLK_DEV_INTEGRITY */ | 1573 | #else /* CONFIG_BLK_DEV_INTEGRITY */ |
| 1563 | 1574 | ||
| 1564 | struct bio; | 1575 | struct bio; |
| @@ -1633,6 +1644,11 @@ static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi, | |||
| 1633 | return 0; | 1644 | return 0; |
| 1634 | } | 1645 | } |
| 1635 | 1646 | ||
| 1647 | static inline struct bio_vec *rq_integrity_vec(struct request *rq) | ||
| 1648 | { | ||
| 1649 | return NULL; | ||
| 1650 | } | ||
| 1651 | |||
| 1636 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ | 1652 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ |
| 1637 | 1653 | ||
| 1638 | struct block_device_operations { | 1654 | struct block_device_operations { |
