diff options
author | Max Gurtovoy <maxg@mellanox.com> | 2018-07-30 00:15:31 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-07-30 08:27:01 -0600 |
commit | ddd0bc756983dc4d19000a4fe021b4c7f9d59aab (patch) | |
tree | c60de4ff47106f0c20b1f1beda9df7eedbdc8b86 /include/linux/t10-pi.h | |
parent | c454edc21b12dd7d416de6c81555e87aaec9685c (diff) |
block: move ref_tag calculation func to the block layer
Currently this function is implemented in the scsi layer, but it's
actual place should be the block layer since T10-PI is a general
data integrity feature that is used in the nvme protocol as well.
Suggested-by: Christoph Hellwig <hch@lst.de>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/t10-pi.h')
-rw-r--r-- | include/linux/t10-pi.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/t10-pi.h b/include/linux/t10-pi.h index c6aa8a3c42ed..c40511f4e63d 100644 --- a/include/linux/t10-pi.h +++ b/include/linux/t10-pi.h @@ -37,6 +37,16 @@ struct t10_pi_tuple { #define T10_PI_APP_ESCAPE cpu_to_be16(0xffff) #define T10_PI_REF_ESCAPE cpu_to_be32(0xffffffff) +static inline u32 t10_pi_ref_tag(struct request *rq) +{ +#ifdef CONFIG_BLK_DEV_INTEGRITY + return blk_rq_pos(rq) >> + (rq->q->integrity.interval_exp - 9) & 0xffffffff; +#else + return -1U; +#endif +} + extern const struct blk_integrity_profile t10_pi_type1_crc; extern const struct blk_integrity_profile t10_pi_type1_ip; extern const struct blk_integrity_profile t10_pi_type3_crc; |