block: centralize PI remapping logic to the block layer
authorMax Gurtovoy <maxg@mellanox.com>
Mon, 16 Sep 2019 15:44:29 +0000 (18:44 +0300)
committerJens Axboe <axboe@kernel.dk>
Wed, 18 Sep 2019 02:03:49 +0000 (20:03 -0600)
commit54d4e6ab91eb24b47a58403d8561206e916f0242
tree3bd64c92b614284071d893012abcf01bfc55cabc
parent5eaed68dd38c14907be2ce5a45c73a5f2acb75f4
block: centralize PI remapping logic to the block layer

Currently t10_pi_prepare/t10_pi_complete functions are called during the
NVMe and SCSi layers command preparetion/completion, but their actual
place should be the block layer since T10-PI is a general data integrity
feature that is used by block storage protocols. Introduce .prepare_fn
and .complete_fn callbacks within the integrity profile that each type
can implement according to its needs.

Suggested-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Suggested-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Fixed to not call queue integrity functions if BLK_DEV_INTEGRITY
isn't defined in the config.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-core.c
block/blk-integrity.c
block/blk-mq.c
block/t10-pi.c
drivers/md/dm-integrity.c
drivers/nvme/host/core.c
drivers/scsi/sd.c
include/linux/blkdev.h
include/linux/t10-pi.h