diff options
author | Max Gurtovoy <maxg@mellanox.com> | 2019-09-16 11:44:29 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-09-17 22:03:49 -0400 |
commit | 54d4e6ab91eb24b47a58403d8561206e916f0242 (patch) | |
tree | 3bd64c92b614284071d893012abcf01bfc55cabc /block/blk-mq.c | |
parent | 5eaed68dd38c14907be2ce5a45c73a5f2acb75f4 (diff) |
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>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r-- | block/blk-mq.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index 20a49be536b5..29275f5a996f 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <trace/events/block.h> | 30 | #include <trace/events/block.h> |
31 | 31 | ||
32 | #include <linux/blk-mq.h> | 32 | #include <linux/blk-mq.h> |
33 | #include <linux/t10-pi.h> | ||
33 | #include "blk.h" | 34 | #include "blk.h" |
34 | #include "blk-mq.h" | 35 | #include "blk-mq.h" |
35 | #include "blk-mq-debugfs.h" | 36 | #include "blk-mq-debugfs.h" |
@@ -700,6 +701,11 @@ void blk_mq_start_request(struct request *rq) | |||
700 | */ | 701 | */ |
701 | rq->nr_phys_segments++; | 702 | rq->nr_phys_segments++; |
702 | } | 703 | } |
704 | |||
705 | #ifdef CONFIG_BLK_DEV_INTEGRITY | ||
706 | if (blk_integrity_rq(rq) && req_op(rq) == REQ_OP_WRITE) | ||
707 | q->integrity.profile->prepare_fn(rq); | ||
708 | #endif | ||
703 | } | 709 | } |
704 | EXPORT_SYMBOL(blk_mq_start_request); | 710 | EXPORT_SYMBOL(blk_mq_start_request); |
705 | 711 | ||