Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f281233d authored by Jeff Garzik's avatar Jeff Garzik Committed by Linus Torvalds
Browse files

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: default avatarJeff Garzik <jgarzik@redhat.com>
Acked-by: default avatarJames Bottomley <James.Bottomley@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent bdbd01ac
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -202,7 +202,7 @@ simscsi_readwrite10 (struct scsi_cmnd *sc, int mode)
}

static int
simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
simscsi_queuecommand_lck (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
{
	unsigned int target_id = sc->device->id;
	char fname[MAX_ROOT_LEN+16];
@@ -326,6 +326,8 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
	return 0;
}

static DEF_SCSI_QCMD(simscsi_queuecommand)

static int
simscsi_host_reset (struct scsi_cmnd *sc)
{
+3 −1
Original line number Diff line number Diff line
@@ -3183,7 +3183,7 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd,
 *	Return value from __ata_scsi_queuecmd() if @cmd can be queued,
 *	0 otherwise.
 */
int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
static int ata_scsi_queuecmd_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
{
	struct ata_port *ap;
	struct ata_device *dev;
@@ -3211,6 +3211,8 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
	return rc;
}

DEF_SCSI_QCMD(ata_scsi_queuecmd)

/**
 *	ata_scsi_simulate - simulate SCSI command on ATA device
 *	@dev: the target device
+5 −3
Original line number Diff line number Diff line
@@ -62,8 +62,8 @@ static int cciss_scsi_proc_info(
		int length, 	   /* length of data in buffer */
		int func);	   /* 0 == read, 1 == write */

static int cciss_scsi_queue_command (struct scsi_cmnd *cmd,
		void (* done)(struct scsi_cmnd *));
static int cciss_scsi_queue_command (struct Scsi_Host *h,
				     struct scsi_cmnd *cmd);
static int cciss_eh_device_reset_handler(struct scsi_cmnd *);
static int cciss_eh_abort_handler(struct scsi_cmnd *);

@@ -1406,7 +1406,7 @@ static void cciss_scatter_gather(ctlr_info_t *h, CommandList_struct *c,


static int
cciss_scsi_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
cciss_scsi_queue_command_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
{
	ctlr_info_t *h;
	int rc;
@@ -1504,6 +1504,8 @@ cciss_scsi_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd
	return 0;
}

static DEF_SCSI_QCMD(cciss_scsi_queue_command)

static void cciss_unregister_scsi(ctlr_info_t *h)
{
	struct cciss_scsi_adapter_data_t *sa;
+3 −1
Original line number Diff line number Diff line
@@ -1468,7 +1468,7 @@ static int sbp2_map_scatterlist(struct sbp2_command_orb *orb,

/* SCSI stack integration */

static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
static int sbp2_scsi_queuecommand_lck(struct scsi_cmnd *cmd, scsi_done_fn_t done)
{
	struct sbp2_logical_unit *lu = cmd->device->hostdata;
	struct fw_device *device = target_device(lu->tgt);
@@ -1534,6 +1534,8 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
	return retval;
}

static DEF_SCSI_QCMD(sbp2_scsi_queuecommand)

static int sbp2_scsi_slave_alloc(struct scsi_device *sdev)
{
	struct sbp2_logical_unit *lu = sdev->hostdata;
+3 −1
Original line number Diff line number Diff line
@@ -1123,7 +1123,7 @@ static void srp_send_completion(struct ib_cq *cq, void *target_ptr)
	}
}

static int srp_queuecommand(struct scsi_cmnd *scmnd,
static int srp_queuecommand_lck(struct scsi_cmnd *scmnd,
			    void (*done)(struct scsi_cmnd *))
{
	struct srp_target_port *target = host_to_target(scmnd->device->host);
@@ -1196,6 +1196,8 @@ static int srp_queuecommand(struct scsi_cmnd *scmnd,
	return SCSI_MLQUEUE_HOST_BUSY;
}

static DEF_SCSI_QCMD(srp_queuecommand)

static int srp_alloc_iu_bufs(struct srp_target_port *target)
{
	int i;
Loading