diff options
| author | Martin K. Petersen <martin.petersen@oracle.com> | 2021-06-09 06:39:15 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-01-05 17:12:30 +0300 |
| commit | 294d66c35a4e019a9dfe889fe382adce1cc3773e (patch) | |
| tree | 8aba4422a69b579df55897b50f5f6be03985fcef /include/scsi | |
| parent | 929f475ebaf09d2e4e40bdc6fc3902cca150974f (diff) | |
| download | linux-294d66c35a4e019a9dfe889fe382adce1cc3773e.tar.xz | |
scsi: core: Add scsi_prot_ref_tag() helper
[ Upstream commit 7ba46799d34695534666a3f71a2be10ea85ece6c ]
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/20210609033929.3815-2-martin.petersen@oracle.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Message-Id: <20210609033929.3815-2-martin.petersen@oracle.com>
Stable-dep-of: 066c5b46b6ea ("scsi: core: Always send batch on reset or error handling command")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/scsi')
| -rw-r--r-- | include/scsi/scsi_cmnd.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index b1c9b52876f3..663046463533 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -291,6 +291,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; |
