From a0e65bb9c96eb65ef2fceb665645801e67c8919e Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 5 Sep 2021 02:57:50 +0000 Subject: [PATCH] scst/include/backport.h: Improve the kernel backports that add support for v5.14 Unbreak the build against kernels v4.10 and older. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9508 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index 93c049f3b..ca787fc93 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -52,7 +52,7 @@ #include #include /* struct scsi_cmnd */ struct scsi_target; -#include /* struct fc_bsg_job */ +#include /* struct bsg_job */ #include /* get_unaligned_be64() */ /* */ @@ -2205,13 +2205,15 @@ static inline void scsi_build_sense(struct scsi_cmnd *scmd, int desc, */ static inline struct request *scsi_cmd_to_rq(struct scsi_cmnd *scmd) { - return blk_mq_rq_from_pdu(scmd); + return scmd->request; } /* - * See also commit 7ba46799d346 ("scsi: core: Add scsi_prot_ref_tag() - * helper"). + * See also commits 7ba46799d346 ("scsi: core: Add scsi_prot_ref_tag() + * helper") and ddd0bc756983 ("block: move ref_tag calculation func to the + * block layer"; v4.19). */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) static inline u32 scsi_prot_ref_tag(struct scsi_cmnd *scmd) { struct request *rq = blk_mq_rq_from_pdu(scmd); @@ -2219,6 +2221,7 @@ static inline u32 scsi_prot_ref_tag(struct scsi_cmnd *scmd) return t10_pi_ref_tag(rq); } #endif +#endif /* */