From: Shivasharan S Date: Fri, 10 Feb 2017 08:59:14 +0000 (-0800) Subject: scsi: megaraid_sas: set residual bytes count during IO completion X-Git-Tag: v4.11-rc1~141^2~28 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=31d9a57b419d8ef8fa391009819f940778ce6245;p=linux.git scsi: megaraid_sas: set residual bytes count during IO completion Fixing issue of not setting residual bytes correctly. Signed-off-by: Shivasharan S Signed-off-by: Kashyap Desai Reviewed-by: Hannes Reinecke Reviewed-by: Tomas Henzl Signed-off-by: Martin K. Petersen --- diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index edbecc531f33..46286719c0aa 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -1445,6 +1445,7 @@ map_cmd_status(struct fusion_context *fusion, struct scsi_cmnd *scmd, u8 status, u8 ext_status, u32 data_length, u8 *sense) { + int resid; switch (status) { @@ -1467,6 +1468,15 @@ map_cmd_status(struct fusion_context *fusion, SCSI_SENSE_BUFFERSIZE); scmd->result |= DRIVER_SENSE << 24; } + + /* + * If the IO request is partially completed, then MR FW will + * update "io_request->DataLength" field with actual number of + * bytes transferred.Driver will set residual bytes count in + * SCSI command structure. + */ + resid = (scsi_bufflen(scmd) - data_length); + scsi_set_resid(scmd, resid); break; case MFI_STAT_LD_OFFLINE: