From: Max Gurtovoy <maxg@mellanox.com> To: linux-block@vger.kernel.org, axboe@kernel.dk, martin.petersen@oracle.com, linux-nvme@lists.infradead.org, keith.busch@intel.com, hch@lst.de, sagi@grimberg.me Cc: shlomin@mellanox.com, israelr@mellanox.com, Max Gurtovoy <maxg@mellanox.com> Subject: [PATCH v4 2/3] block: don't remap ref tag for T10 PI type 0 Date: Sun, 8 Sep 2019 18:26:44 +0300 [thread overview] Message-ID: <1567956405-5585-2-git-send-email-maxg@mellanox.com> (raw) In-Reply-To: <1567956405-5585-1-git-send-email-maxg@mellanox.com> Only type 1 and type 2 have a reference tag by definition. Suggested-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Max Gurtovoy <maxg@mellanox.com> --- changes from v3: - added blk_integrity_need_remap helper --- block/t10-pi.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/block/t10-pi.c b/block/t10-pi.c index a33eac4..753b5a8 100644 --- a/block/t10-pi.c +++ b/block/t10-pi.c @@ -168,6 +168,12 @@ static blk_status_t t10_pi_type3_verify_ip(struct blk_integrity_iter *iter) }; EXPORT_SYMBOL(t10_pi_type3_ip); +static inline bool blk_integrity_need_remap(struct gendisk *disk) +{ + return disk->protection_type == T10_PI_TYPE1_PROTECTION || + disk->protection_type == T10_PI_TYPE2_PROTECTION; +} + /** * t10_pi_prepare - prepare PI prior submitting request to device * @rq: request with PI that should be prepared @@ -178,7 +184,7 @@ static blk_status_t t10_pi_type3_verify_ip(struct blk_integrity_iter *iter) * likely to be different. Remap protection information to match the * physical LBA. * - * Type 3 does not have a reference tag so no remapping is required. + * Types 0 and 3 don't have a reference tag so no remapping is required. */ void t10_pi_prepare(struct request *rq) { @@ -186,7 +192,7 @@ void t10_pi_prepare(struct request *rq) u32 ref_tag = t10_pi_ref_tag(rq); struct bio *bio; - if (rq->rq_disk->protection_type == T10_PI_TYPE3_PROTECTION) + if (!blk_integrity_need_remap(rq->rq_disk)) return; __rq_for_each_bio(bio, rq) { @@ -234,7 +240,7 @@ void t10_pi_prepare(struct request *rq) * to the device, we should remap it back to virtual values expected by the * block layer. * - * Type 3 does not have a reference tag so no remapping is required. + * Types 0 and 3 don't have a reference tag so no remapping is required. */ void t10_pi_complete(struct request *rq, unsigned int nr_bytes) { @@ -243,7 +249,7 @@ void t10_pi_complete(struct request *rq, unsigned int nr_bytes) u32 ref_tag = t10_pi_ref_tag(rq); struct bio *bio; - if (rq->rq_disk->protection_type == T10_PI_TYPE3_PROTECTION) + if (!blk_integrity_need_remap(rq->rq_disk)) return; __rq_for_each_bio(bio, rq) { -- 1.8.3.1
WARNING: multiple messages have this Message-ID (diff)
From: Max Gurtovoy <maxg@mellanox.com> To: linux-block@vger.kernel.org, axboe@kernel.dk, martin.petersen@oracle.com, linux-nvme@lists.infradead.org, keith.busch@intel.com, hch@lst.de, sagi@grimberg.me Cc: Max Gurtovoy <maxg@mellanox.com>, shlomin@mellanox.com, israelr@mellanox.com Subject: [PATCH v4 2/3] block: don't remap ref tag for T10 PI type 0 Date: Sun, 8 Sep 2019 18:26:44 +0300 [thread overview] Message-ID: <1567956405-5585-2-git-send-email-maxg@mellanox.com> (raw) In-Reply-To: <1567956405-5585-1-git-send-email-maxg@mellanox.com> Only type 1 and type 2 have a reference tag by definition. Suggested-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Max Gurtovoy <maxg@mellanox.com> --- changes from v3: - added blk_integrity_need_remap helper --- block/t10-pi.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/block/t10-pi.c b/block/t10-pi.c index a33eac4..753b5a8 100644 --- a/block/t10-pi.c +++ b/block/t10-pi.c @@ -168,6 +168,12 @@ static blk_status_t t10_pi_type3_verify_ip(struct blk_integrity_iter *iter) }; EXPORT_SYMBOL(t10_pi_type3_ip); +static inline bool blk_integrity_need_remap(struct gendisk *disk) +{ + return disk->protection_type == T10_PI_TYPE1_PROTECTION || + disk->protection_type == T10_PI_TYPE2_PROTECTION; +} + /** * t10_pi_prepare - prepare PI prior submitting request to device * @rq: request with PI that should be prepared @@ -178,7 +184,7 @@ static blk_status_t t10_pi_type3_verify_ip(struct blk_integrity_iter *iter) * likely to be different. Remap protection information to match the * physical LBA. * - * Type 3 does not have a reference tag so no remapping is required. + * Types 0 and 3 don't have a reference tag so no remapping is required. */ void t10_pi_prepare(struct request *rq) { @@ -186,7 +192,7 @@ void t10_pi_prepare(struct request *rq) u32 ref_tag = t10_pi_ref_tag(rq); struct bio *bio; - if (rq->rq_disk->protection_type == T10_PI_TYPE3_PROTECTION) + if (!blk_integrity_need_remap(rq->rq_disk)) return; __rq_for_each_bio(bio, rq) { @@ -234,7 +240,7 @@ void t10_pi_prepare(struct request *rq) * to the device, we should remap it back to virtual values expected by the * block layer. * - * Type 3 does not have a reference tag so no remapping is required. + * Types 0 and 3 don't have a reference tag so no remapping is required. */ void t10_pi_complete(struct request *rq, unsigned int nr_bytes) { @@ -243,7 +249,7 @@ void t10_pi_complete(struct request *rq, unsigned int nr_bytes) u32 ref_tag = t10_pi_ref_tag(rq); struct bio *bio; - if (rq->rq_disk->protection_type == T10_PI_TYPE3_PROTECTION) + if (!blk_integrity_need_remap(rq->rq_disk)) return; __rq_for_each_bio(bio, rq) { -- 1.8.3.1 _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2019-09-08 15:26 UTC|newest] Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-09-08 15:26 [PATCH v4 1/3] block: centralize PI remapping logic to the block layer Max Gurtovoy 2019-09-08 15:26 ` Max Gurtovoy 2019-09-08 15:26 ` Max Gurtovoy [this message] 2019-09-08 15:26 ` [PATCH v4 2/3] block: don't remap ref tag for T10 PI type 0 Max Gurtovoy 2019-09-09 2:22 ` Martin K. Petersen 2019-09-09 2:22 ` Martin K. Petersen 2019-09-09 2:36 ` Keith Busch 2019-09-09 2:36 ` Keith Busch 2019-09-09 2:49 ` Martin K. Petersen 2019-09-09 2:49 ` Martin K. Petersen 2019-09-09 13:31 ` Max Gurtovoy 2019-09-09 13:31 ` Max Gurtovoy 2019-09-08 15:26 ` [PATCH v4 3/3] nvme: remove PI values definition from NVMe subsystem Max Gurtovoy 2019-09-08 15:26 ` Max Gurtovoy 2019-09-09 2:21 ` [PATCH v4 1/3] block: centralize PI remapping logic to the block layer Martin K. Petersen 2019-09-09 2:21 ` Martin K. Petersen 2019-09-09 13:55 ` Max Gurtovoy 2019-09-09 13:55 ` Max Gurtovoy 2019-09-10 2:29 ` Martin K. Petersen 2019-09-10 2:29 ` Martin K. Petersen 2019-09-10 22:27 ` Max Gurtovoy 2019-09-10 22:27 ` Max Gurtovoy 2019-09-11 1:16 ` Martin K. Petersen 2019-09-11 1:16 ` Martin K. Petersen 2019-09-11 9:12 ` Max Gurtovoy 2019-09-11 9:12 ` Max Gurtovoy 2019-09-13 22:20 ` Martin K. Petersen 2019-09-13 22:20 ` Martin K. Petersen 2019-09-16 8:03 ` Christoph Hellwig 2019-09-16 8:03 ` Christoph Hellwig 2019-09-16 17:19 ` Martin K. Petersen 2019-09-16 17:19 ` Martin K. Petersen
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1567956405-5585-2-git-send-email-maxg@mellanox.com \ --to=maxg@mellanox.com \ --cc=axboe@kernel.dk \ --cc=hch@lst.de \ --cc=israelr@mellanox.com \ --cc=keith.busch@intel.com \ --cc=linux-block@vger.kernel.org \ --cc=linux-nvme@lists.infradead.org \ --cc=martin.petersen@oracle.com \ --cc=sagi@grimberg.me \ --cc=shlomin@mellanox.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.