On 02/20/2017 06:35 PM, Martin K. Petersen wrote:
> I'm still not keen on having two orthogonal sanity checks wrt. figuring
> out how much of a request has been completed.
> 
> Also, I find your approach hard to follow in the case where
> sd_completed_bytes() is called after the resid has been adjusted. It
> works, but it's not immediately obvious that that's the case. Which to
> me is an indication that this entire thing needs a thorough cleanup.

Hello Martin and Damien,

How about the following:
* Add a function to the block layer that reports whether or not the
  request is a medium access request. The number of transferred bytes
  for a medium access request is a multiple of the logical block size.
  (The terminology "medium access command" comes from the SCSI specs.)
* Use that function instead of "scmd->request->cmd_type == REQ_TYPE_FS"
  in the mpt3sas driver.
* Do not modify sd_done().

This approach has the advantage that the mpt3sas firmware bug workaround
does not slow down the hot path of the sd driver when another LLD than
mpt3sas is used.

Bart.

Reply via email to