Skip to content

Commit

Permalink
scsi: core: Add scsi_prot_ref_tag() helper
Browse files Browse the repository at this point in the history
We are about to remove the request pointer from struct scsi_cmnd and that
will complicate getting to the ref_tag via t10_pi_ref_tag() in the various
drivers. Introduce a helper function to retrieve the reference tag so
drivers will not have to worry about the details.

Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Bart Van Assche <[email protected]>
Reviewed-by: Benjamin Block <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Message-Id: <[email protected]>
  • Loading branch information
martinkpetersen committed Jul 21, 2021
1 parent f339c7e commit 7ba4679
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/scsi/scsi_cmnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,13 @@ static inline sector_t scsi_get_lba(struct scsi_cmnd *scmd)
return blk_rq_pos(scmd->request);
}

static inline u32 scsi_prot_ref_tag(struct scsi_cmnd *scmd)
{
struct request *rq = blk_mq_rq_from_pdu(scmd);

return t10_pi_ref_tag(rq);
}

static inline unsigned int scsi_prot_interval(struct scsi_cmnd *scmd)
{
return scmd->device->sector_size;
Expand Down

0 comments on commit 7ba4679

Please sign in to comment.