SCSI host lock push-down
Move the mid-layer's ->queuecommand() invocation from being locked with the host lock to being unlocked to facilitate speeding up the critical path for drivers who don't need this lock taken anyway. The patch below presents a simple SCSI host lock push-down as an equivalent transformation. No locking or other behavior should change with this patch. All existing bugs and locking orders are preserved. Additionally, add one parameter to queuecommand, struct Scsi_Host * and remove one parameter from queuecommand, void (*done)(struct scsi_cmnd *) Scsi_Host* is a convenient pointer that most host drivers need anyway, and 'done' is redundant to struct scsi_cmnd->scsi_done. Minimal code disturbance was attempted with this change. Most drivers needed only two one-line modifications for their host lock push-down. Signed-off-by: Jeff Garzik <jgarzik@redhat.com> Acked-by: James Bottomley <James.Bottomley@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
bdbd01ac44
commit
f281233d3e
@@ -364,7 +364,7 @@ static int mts_scsi_host_reset(struct scsi_cmnd *srb)
|
||||
}
|
||||
|
||||
static int
|
||||
mts_scsi_queuecommand(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback);
|
||||
mts_scsi_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *srb);
|
||||
|
||||
static void mts_transfer_cleanup( struct urb *transfer );
|
||||
static void mts_do_sg(struct urb * transfer);
|
||||
@@ -573,7 +573,7 @@ mts_build_transfer_context(struct scsi_cmnd *srb, struct mts_desc* desc)
|
||||
|
||||
|
||||
static int
|
||||
mts_scsi_queuecommand(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback)
|
||||
mts_scsi_queuecommand_lck(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback)
|
||||
{
|
||||
struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]);
|
||||
int err = 0;
|
||||
@@ -626,6 +626,8 @@ out:
|
||||
return err;
|
||||
}
|
||||
|
||||
static DEF_SCSI_QCMD(mts_scsi_queuecommand)
|
||||
|
||||
static struct scsi_host_template mts_scsi_host_template = {
|
||||
.module = THIS_MODULE,
|
||||
.name = "microtekX6",
|
||||
|
Reference in New Issue
Block a user