This is a note to let you know that I've just added the patch titled scsi: core: Add scsi_prot_ref_tag() helper to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: scsi-core-add-scsi_prot_ref_tag-helper.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit f77fc8490ddd94125be1894caf9c7fa893648b19 Author: Martin K. Petersen <martin.petersen@xxxxxxxxxx> Date: Tue Jun 8 23:39:15 2021 -0400 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@xxxxxxxxxx Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx> Reviewed-by: Benjamin Block <bblock@xxxxxxxxxxxxx> Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx> Message-Id: <20210609033929.3815-2-martin.petersen@xxxxxxxxxx> Stable-dep-of: 066c5b46b6ea ("scsi: core: Always send batch on reset or error handling command") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index b1c9b52876f3c..6630464635330 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;