[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] Re: [PATCH RFC 0/4] use scatter lists for all block pc requests and simplify hw handlers

James Bottomley wrote:
On Sun, 2005-06-05 at 09:40 -0500, James Bottomley wrote:

Finally, there's coming up with a replacement API for scsi_do_req that
returns via the end_io callback ... since that doesn't do a wait/wake,
perhaps this should be the core API upon which the others are built?

OK, well, the API is easy ... it's attached.  Converting sg and st to
use it is quite another matter.  sg in particular is a nasty tangle when
it comes to doing its own sg mapping, which the block layer will now do
for it.

--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -177,6 +177,23 @@ int scsi_queue_insert(struct scsi_cmnd *
return 0;
+struct scsi_do_req_cb {
+ void (*done)(void *, int);
+ void *data;
+static void scsi_do_req_end_io(struct request *req)
+ int result = req->errors;
+ struct scsi_do_req_cb *cb = req->end_io_data;
+ BUG_ON(cb == NULL);
+ if (result)
+ result |= DRIVER_ERROR << 24;
+ blk_put_request(req);
+ cb->done(cb->data, result);
+ kfree(cb);
* Function: scsi_do_req
@@ -203,38 +220,49 @@ int scsi_queue_insert(struct scsi_cmnd *
* now inject requests on the *head* of the device queue
* rather than the tail.
-void scsi_do_req(struct scsi_request *sreq, const void *cmnd,
- void *buffer, unsigned bufflen,
- void (*done)(struct scsi_cmnd *),
- int timeout, int retries)
+void scsi_do_command(struct scsi_device *sdev, const void *cmnd, int cmd_len,
+ void *buffer, unsigned bufflen, void *data,
+ void (*done)(void *, int),
+ char *sense_buffer, int timeout, int retries,
+ enum dma_data_direction dir)

James, There is no max_length on sense_buffer. How does one know how much, if any, sense data was written (returned). resid is a very useful return parameter. Perhaps the *done() callback should have two more arguments (and scsi_do_command() one more argument). And 'buffer' and 'bufflen' have not changed in name but I assume they have in nature.

Additionally perhaps it is time to start thinking about
a clean pass through. Something that can pass a packet
command (like sg can at the moment) but to a scsi_host
(or a transport host). An additional argument would be
needed to pass addressing information to the LLD. I'm
thinking about the SAS Serial Management Protocol (SMP)
that has nothing to do with the block layer or the
SCSI mid level. We want to bind to a SAS host (initiator
port) and supply a SAS address (of the SMP target
which is most likely an expander).

Doug Gilbert

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]