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>
This commit is contained in:

zatwierdzone przez
Jens Axboe

rodzic
5eaed68dd3
commit
54d4e6ab91
@@ -666,8 +666,6 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
|
||||
if (WARN_ON_ONCE(!nvme_ns_has_pi(ns)))
|
||||
return BLK_STS_NOTSUPP;
|
||||
control |= NVME_RW_PRINFO_PRACT;
|
||||
} else if (req_op(req) == REQ_OP_WRITE) {
|
||||
t10_pi_prepare(req, ns->pi_type);
|
||||
}
|
||||
|
||||
switch (ns->pi_type) {
|
||||
@@ -690,13 +688,6 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
|
||||
|
||||
void nvme_cleanup_cmd(struct request *req)
|
||||
{
|
||||
if (blk_integrity_rq(req) && req_op(req) == REQ_OP_READ &&
|
||||
nvme_req(req)->status == 0) {
|
||||
struct nvme_ns *ns = req->rq_disk->private_data;
|
||||
|
||||
t10_pi_complete(req, ns->pi_type,
|
||||
blk_rq_bytes(req) >> ns->lba_shift);
|
||||
}
|
||||
if (req->rq_flags & RQF_SPECIAL_PAYLOAD) {
|
||||
struct nvme_ns *ns = req->rq_disk->private_data;
|
||||
struct page *page = req->special_vec.bv_page;
|
||||
|
Reference in New Issue
Block a user