> -----Original Message----- > From: Martin K. Petersen [mailto:martin.petersen@xxxxxxxxxx] > Sent: Tuesday, February 07, 2017 5:22 AM > To: Shivasharan S > Cc: linux-scsi@xxxxxxxxxxxxxxx; martin.petersen@xxxxxxxxxx; > thenzl@xxxxxxxxxx; jejb@xxxxxxxxxxxxxxxxxx; > kashyap.desai@xxxxxxxxxxxx; sumit.saxena@xxxxxxxxxxxx; > hare@xxxxxxxx > Subject: Re: [PATCH 13/39] megaraid_sas : set residual bytes count during IO > compeltion > > >>>>> "Shivasharan" == Shivasharan S > <shivasharan.srikanteshwara@xxxxxxxxxxxx> writes: > > Shivasharan> Fixing issue of not setting residual bytes correctly. > > @@ -1464,6 +1465,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); > > Is data_length guaranteed to be a multiple of the logical block size? > Otherwise you need to tweak the residual like we just did for mpt3sas. Martin, Data length will be always guaranteed to be a multiple of the logical block size until and unless we have some firmware defect. In past, We have seen some partial/complete DMA data length return from firmware was not aligned with logical block size. Eventually, root caused + fixed in firmware. > > -- > Martin K. Petersen Oracle Linux Engineering