diff options
author | Christoph Hellwig <hch@lst.de> | 2014-11-03 14:15:14 -0500 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-11-12 05:19:43 -0500 |
commit | c8b09f6fb67df7fc1b51ced1037fa9b677428149 (patch) | |
tree | 87527c3e17a7539c0ffa9f64fbd85ec2ad3dabf1 /drivers/scsi/scsi.c | |
parent | 2ecb204d07ac8debe3893c362415919bc78bebd6 (diff) |
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: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/scsi.c')
-rw-r--r-- | drivers/scsi/scsi.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index a3426f1bf0dd..106fa2f886d2 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -744,8 +744,6 @@ void scsi_finish_command(struct scsi_cmnd *cmd) | |||
744 | /** | 744 | /** |
745 | * scsi_adjust_queue_depth - Let low level drivers change a device's queue depth | 745 | * scsi_adjust_queue_depth - Let low level drivers change a device's queue depth |
746 | * @sdev: SCSI Device in question | 746 | * @sdev: SCSI Device in question |
747 | * @tagged: Do we use tagged queueing (non-0) or do we treat | ||
748 | * this device as an untagged device (0) | ||
749 | * @tags: Number of tags allowed if tagged queueing enabled, | 747 | * @tags: Number of tags allowed if tagged queueing enabled, |
750 | * or number of commands the low level driver can | 748 | * or number of commands the low level driver can |
751 | * queue up in non-tagged mode (as per cmd_per_lun). | 749 | * queue up in non-tagged mode (as per cmd_per_lun). |
@@ -759,7 +757,7 @@ void scsi_finish_command(struct scsi_cmnd *cmd) | |||
759 | * currently active and whether or not it even has the | 757 | * currently active and whether or not it even has the |
760 | * command blocks built yet. | 758 | * command blocks built yet. |
761 | */ | 759 | */ |
762 | void scsi_adjust_queue_depth(struct scsi_device *sdev, int tagged, int tags) | 760 | void scsi_adjust_queue_depth(struct scsi_device *sdev, int tags) |
763 | { | 761 | { |
764 | unsigned long flags; | 762 | unsigned long flags; |
765 | 763 | ||
@@ -787,20 +785,6 @@ void scsi_adjust_queue_depth(struct scsi_device *sdev, int tagged, int tags) | |||
787 | } | 785 | } |
788 | 786 | ||
789 | sdev->queue_depth = tags; | 787 | sdev->queue_depth = tags; |
790 | switch (tagged) { | ||
791 | case 0: | ||
792 | sdev->simple_tags = 0; | ||
793 | break; | ||
794 | case MSG_ORDERED_TAG: | ||
795 | case MSG_SIMPLE_TAG: | ||
796 | sdev->simple_tags = 1; | ||
797 | break; | ||
798 | default: | ||
799 | sdev->simple_tags = 0; | ||
800 | sdev_printk(KERN_WARNING, sdev, | ||
801 | "scsi_adjust_queue_depth, bad queue type, " | ||
802 | "disabled\n"); | ||
803 | } | ||
804 | out: | 788 | out: |
805 | spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags); | 789 | spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags); |
806 | } | 790 | } |
@@ -848,11 +832,12 @@ int scsi_track_queue_full(struct scsi_device *sdev, int depth) | |||
848 | return 0; | 832 | return 0; |
849 | if (sdev->last_queue_full_depth < 8) { | 833 | if (sdev->last_queue_full_depth < 8) { |
850 | /* Drop back to untagged */ | 834 | /* Drop back to untagged */ |
851 | scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); | 835 | scsi_set_tag_type(sdev, 0); |
836 | scsi_adjust_queue_depth(sdev, sdev->host->cmd_per_lun); | ||
852 | return -1; | 837 | return -1; |
853 | } | 838 | } |
854 | 839 | ||
855 | scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth); | 840 | scsi_adjust_queue_depth(sdev, depth); |
856 | return depth; | 841 | return depth; |
857 | } | 842 | } |
858 | EXPORT_SYMBOL(scsi_track_queue_full); | 843 | EXPORT_SYMBOL(scsi_track_queue_full); |
@@ -867,7 +852,7 @@ int scsi_change_queue_type(struct scsi_device *sdev, int tag_type) | |||
867 | if (!sdev->tagged_supported) | 852 | if (!sdev->tagged_supported) |
868 | return 0; | 853 | return 0; |
869 | 854 | ||
870 | scsi_adjust_queue_depth(sdev, tag_type, sdev->queue_depth); | 855 | scsi_set_tag_type(sdev, tag_type); |
871 | return tag_type; | 856 | return tag_type; |
872 | 857 | ||
873 | } | 858 | } |