This is a note to let you know that I've just added the patch titled scsi_cmnd: Introduce scsi_transfer_length helper to the 3.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_cmnd-introduce-scsi_transfer_length-helper.patch and it can be found in the queue-3.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 8846bab180fa2bcfe02d4ba5288fbaba12c8f4f3 Mon Sep 17 00:00:00 2001 From: Sagi Grimberg <sagig@xxxxxxxxxxxx> Date: Wed, 11 Jun 2014 12:09:57 +0300 Subject: scsi_cmnd: Introduce scsi_transfer_length helper From: Sagi Grimberg <sagig@xxxxxxxxxxxx> commit 8846bab180fa2bcfe02d4ba5288fbaba12c8f4f3 upstream. In case protection information exists on the wire scsi transports should include it in the transfer byte count (even if protection information does not exist in the host memory space). This helper will compute the total transfer length from the scsi command data length and protection attributes. Signed-off-by: Sagi Grimberg <sagig@xxxxxxxxxxxx> Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx> Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- include/scsi/scsi_cmnd.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -7,6 +7,7 @@ #include <linux/types.h> #include <linux/timer.h> #include <linux/scatterlist.h> +#include <scsi/scsi_device.h> struct Scsi_Host; struct scsi_device; @@ -309,4 +310,20 @@ static inline void set_driver_byte(struc cmd->result = (cmd->result & 0x00ffffff) | (status << 24); } +static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd) +{ + unsigned int xfer_len = blk_rq_bytes(scmd->request); + unsigned int prot_op = scsi_get_prot_op(scmd); + unsigned int sector_size = scmd->device->sector_size; + + switch (prot_op) { + case SCSI_PROT_NORMAL: + case SCSI_PROT_WRITE_STRIP: + case SCSI_PROT_READ_INSERT: + return xfer_len; + } + + return xfer_len + (xfer_len >> ilog2(sector_size)) * 8; +} + #endif /* _SCSI_SCSI_CMND_H */ Patches currently in stable-queue which might be from sagig@xxxxxxxxxxxx are queue-3.10/target-iser-fix-hangs-in-connection-teardown.patch queue-3.10/target-iser-bail-from-accept_np-if-np_thread-is-trying-to-close.patch queue-3.10/scsi_cmnd-introduce-scsi_transfer_length-helper.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html