From: martin.petersen@oracle.com (Martin K. Petersen)
Subject: [PATCH 1/2] block: move dif_prepare/dif_complete functions to block layer
Date: Mon, 23 Jul 2018 21:54:38 -0400 [thread overview]
Message-ID: <yq1bmax5rfl.fsf@oracle.com> (raw)
In-Reply-To: <20180723072854.GA18365@lst.de> (Christoph Hellwig's message of "Mon, 23 Jul 2018 09:28:54 +0200")
Christoph,
>> +void blk_integrity_dif_prepare(struct request *rq, u8 protection_type,
>> + u32 ref_tag)
>> +{
>
> Maybe call this blk_t10_pi_prepare?
The rest of these functions have a blk_integrity_ prefix. So either
stick with that or put the functions in t10-pi.c and use a t10_pi_
prefix.
I'm a bit torn on placement since the integrity metadata could contain
other stuff than T10 PI. But the remapping is very specific to T10 PI.
>> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
>> index 9421d9877730..4186bf027c59 100644
>> --- a/drivers/scsi/sd.c
>> +++ b/drivers/scsi/sd.c
>> @@ -1119,7 +1119,9 @@ static int sd_setup_read_write_cmnd(struct scsi_cmnd *SCpnt)
>> SCpnt->cmnd[0] = WRITE_6;
>>
>> if (blk_integrity_rq(rq))
>> - sd_dif_prepare(SCpnt);
>> + blk_integrity_dif_prepare(SCpnt->request,
>> + sdkp->protection_type,
>> + scsi_prot_ref_tag(SCpnt));
>
> scsi_prot_ref_tag could be move to the block layer as it only uses
> the sector in the eequest and the sector size, which we can get
> from the gendisk as well. We then don't need to pass it to the function.
For Type 2, the PI can be at intervals different from the logical block
size (although we don't support that yet). We should use the
blk_integrity profile interval instead of assuming sector size.
And wrt. Keith's comment: The tuple_size should be the one from the
integrity profile as well, not sizeof(struct t10_pi_tuple).
--
Martin K. Petersen Oracle Linux Engineering
next prev parent reply other threads:[~2018-07-24 1:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-22 9:49 [PATCH 1/2] block: move dif_prepare/dif_complete functions to block layer Max Gurtovoy
2018-07-22 9:49 ` [PATCH 2/2] nvme: use blk API to remap ref tags for IOs with metadata Max Gurtovoy
2018-07-23 7:33 ` Christoph Hellwig
2018-07-23 7:28 ` [PATCH 1/2] block: move dif_prepare/dif_complete functions to block layer Christoph Hellwig
2018-07-24 1:54 ` Martin K. Petersen [this message]
2018-07-24 7:57 ` Christoph Hellwig
2018-07-24 12:01 ` Max Gurtovoy
2018-07-23 14:02 ` Keith Busch
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=yq1bmax5rfl.fsf@oracle.com \
--to=martin.petersen@oracle.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).