Re: [PATCH scsi-misc-2.6 08/08] scsi: fix hot unplug sequence

James Bottomley
2005-03-26T14:49:11Z

On Sat, 2005-03-26 at 09:27 +0200, Kai Makisara wrote:
> I fully agree that doing done() correctly _is_ a problem, especially when
> the SCSI subsystem evolves and the high-level driver writers do not follow
> the development closely enough.
>
> One solution to these problems would be to let the drivers still use
> scsi_do_req() and their own done() function, but create two
> (three) helpers:
> - one to be called at the beginning of done(); it would do what needs to
> be done here but lets the driver to do some special things of its own if
> necessary
> - one to be called to wait for the request to finish
> (- one to do scsi_ro_req() and the things necessary before these)

Yes. The drivers that use it just need visiting with a big hammer.
However, our character ULDs (st and sg) use it because they try to
simulate fire and forget in the async write path (That's the only time
you actually don't wait on completion for scsi_do_req).

This comes about because the mid-layer is block oriented, so you can't
use any of the read/write machinery. We could fix this by having a
generic character tap to a block queue for use in cases like SCSI where
the underlying driver uses block queues even if the actual device isn't
a block device.

Essentially, the character tap would simply submit a stream of reads and
writes through the block queue. Then we could modify st and sg to use
an identical framework to the other ULDs ... you get a setup API and a
returning command API which are called for every I/O and the block layer
gets to handle the async/not-async pieces.

James