On Sun, Apr 8, 2012 at 2:14 PM, James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> wrote: > On Fri, 2012-04-06 at 17:57 +0530, Santosh Y wrote: >> Currently the Expected data transfer length field in >> command UPIU is being updated with "transfersize" from >> the scsi_cmnd struct. But, if the read/write data >> transfer size exceeds the sector size, the "transfersize" >> will be truncated to the sector size. Thanks to KOBAYASHI >> Yoshitake for pointing it out. > > I'm a bit confused by this changelog, but I think it's saying you're > using the cmd->transfersize field for the length of data to transfer? Yes, I'll update the comment to make it clear. It might be confusing, if one is not familiar with the UFS spec. > In which case, that's wrong cmd->transfersize is the minimum transfer > size (usually a sector) ... badly named field, sorry. > > Based on the calculation below, the actual length you're looking for is > > scsi_cmnd->sdb->length > > Which is the total size of the entire transfer in bytes. Thanks, don't know how did I overlook it. Ended up calculating the same thing again. :-) I'll resend the patch, which updates Expected data transfer length field in command UPIU with scsi_cmnd->sdb->length. >> + */ >> +static inline u32 ufshcd_get_transfer_len(struct scsi_cmnd *cmdp) >> +{ >> + u32 transfer_len; >> + >> + switch (cmdp->cmnd[0]) { >> + case READ_6: >> + case WRITE_6: >> + transfer_len = cmdp->device->sector_size * >> + cmdp->cmnd[4]; > > Just an efficiency not here, even though the code won't be written this > way, you don't want to multiply by sector_size ... it's always a power > of two, so you do shift or binary log tricks to avoid the expensive > multiply. > It looks like sdb.length is being calculated the same way in sd_prep_fn(), SCpnt->sdb.length = this_count * sdp->sector_size; Does it need to be updated? -- ~Santosh -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html