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

Commit c8b09f6f authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

scsi: don't set tagging state from scsi_adjust_queue_depth



Remove the tagged argument from scsi_adjust_queue_depth, and just let it
handle the queue depth.  For most drivers those two are fairly separate,
given that most modern drivers don't care about the SCSI "tagged" status
of a command at all, and many old drivers allow queuing of multiple
untagged commands in the driver.

Instead we start out with the ->simple_tags flag set before calling
->slave_configure, which is how all drivers actually looking at
->simple_tags except for one worke anyway.  The one other case looks
broken, but I've kept the behavior as-is for now.

Except for that we only change ->simple_tags from the ->change_queue_type,
and when rejecting a tag message in a single driver, so keeping this
churn out of scsi_adjust_queue_depth is a clear win.

Now that the usage of scsi_adjust_queue_depth is more obvious we can
also remove all the trivial instances in ->slave_alloc or ->slave_configure
that just set it to the cmd_per_lun default.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarMike Christie <michaelc@cs.wisc.edu>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 2ecb204d
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -271,9 +271,9 @@ init_this_scsi_driver() ----+
                      slave_destroy() ***
------------------------------------------------------------

The mid level invokes scsi_adjust_queue_depth() with tagged queuing off and
"cmd_per_lun" for that host as the queue length. These settings can be
overridden by a slave_configure() supplied by the LLD.
The mid level invokes scsi_adjust_queue_depth() with "cmd_per_lun" for that
host as the queue length. These settings can be overridden by a
slave_configure() supplied by the LLD.

*** For scsi devices that the mid level tries to scan but do not
    respond, a slave_alloc(), slave_destroy() pair is called.
@@ -438,9 +438,6 @@ int scsi_add_host(struct Scsi_Host *shost, struct device * dev)
/**
 * scsi_adjust_queue_depth - allow LLD to change queue depth on a SCSI device
 * @sdev:       pointer to SCSI device to change queue depth on
 * @tagged:     0 - no tagged queuing
 *              MSG_SIMPLE_TAG - simple tagged queuing
 *              MSG_ORDERED_TAG - ordered tagged queuing
 * @tags        Number of tags allowed if tagged queuing enabled,
 *              or number of commands the LLD can queue up
 *              in non-tagged mode (as per cmd_per_lun).
@@ -456,8 +453,7 @@ int scsi_add_host(struct Scsi_Host *shost, struct device * dev)
 *      Defined in: drivers/scsi/scsi.c [see source code for more notes]
 *
 **/
void scsi_adjust_queue_depth(struct scsi_device * sdev, int tagged, 
                             int tags)
void scsi_adjust_queue_depth(struct scsi_device *sdev, int tags)


/**
+2 −2
Original line number Diff line number Diff line
@@ -1164,7 +1164,7 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,

		depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id));
		depth = min(ATA_MAX_QUEUE - 1, depth);
		scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth);
		scsi_adjust_queue_depth(sdev, depth);
	}

	blk_queue_flush_queueable(q, false);
@@ -1282,7 +1282,7 @@ int __ata_change_queue_depth(struct ata_port *ap, struct scsi_device *sdev,
	if (sdev->queue_depth == queue_depth)
		return -EINVAL;

	scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, queue_depth);
	scsi_adjust_queue_depth(sdev, queue_depth);
	return queue_depth;
}

+1 −1
Original line number Diff line number Diff line
@@ -2278,7 +2278,7 @@ srp_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
			max_depth = 1;
		if (qdepth > max_depth)
			qdepth = max_depth;
		scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
		scsi_adjust_queue_depth(sdev, qdepth);
	} else if (reason == SCSI_QDEPTH_QFULL)
		scsi_track_queue_full(sdev, qdepth);
	else
+1 −1
Original line number Diff line number Diff line
@@ -2347,7 +2347,7 @@ mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
	if (qdepth > max_depth)
		qdepth = max_depth;

	scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
	scsi_adjust_queue_depth(sdev, qdepth);
	return sdev->queue_depth;
}

+3 −5
Original line number Diff line number Diff line
@@ -37,13 +37,13 @@ static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth,
{
	switch (reason) {
	case SCSI_QDEPTH_DEFAULT:
		scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
		scsi_adjust_queue_depth(sdev, depth);
		break;
	case SCSI_QDEPTH_QFULL:
		scsi_track_queue_full(sdev, depth);
		break;
	case SCSI_QDEPTH_RAMP_UP:
		scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
		scsi_adjust_queue_depth(sdev, depth);
		break;
	default:
		return -EOPNOTSUPP;
@@ -66,9 +66,7 @@ static void zfcp_scsi_slave_destroy(struct scsi_device *sdev)
static int zfcp_scsi_slave_configure(struct scsi_device *sdp)
{
	if (sdp->tagged_supported)
		scsi_adjust_queue_depth(sdp, MSG_SIMPLE_TAG, default_depth);
	else
		scsi_adjust_queue_depth(sdp, 0, 1);
		scsi_adjust_queue_depth(sdp, default_depth);
	return 0;
}

Loading