diff options
author | Christoph Hellwig <hch@lst.de> | 2014-11-13 09:08:42 -0500 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-11-24 08:45:27 -0500 |
commit | db5ed4dfd5dd0142ec36ff7b335e0ec3b836b3e6 (patch) | |
tree | 6cae824b5c9e5a7fd9d213e3f9c2b1c7dc8b7b8a /drivers/scsi/scsi.c | |
parent | 1e6f2416044c062a56091ebf8d76760956dd5872 (diff) |
scsi: drop reason argument from ->change_queue_depth
Drop the now unused reason argument from the ->change_queue_depth method.
Also add a return value to scsi_adjust_queue_depth, and rename it to
scsi_change_queue_depth now that it can be used as the default
->change_queue_depth implementation.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Diffstat (limited to 'drivers/scsi/scsi.c')
-rw-r--r-- | drivers/scsi/scsi.c | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 106fa2f886d2..5ea15fc7d2fb 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -742,30 +742,18 @@ void scsi_finish_command(struct scsi_cmnd *cmd) | |||
742 | } | 742 | } |
743 | 743 | ||
744 | /** | 744 | /** |
745 | * scsi_adjust_queue_depth - Let low level drivers change a device's queue depth | 745 | * scsi_change_queue_depth - change a device's queue depth |
746 | * @sdev: SCSI Device in question | 746 | * @sdev: SCSI Device in question |
747 | * @tags: Number of tags allowed if tagged queueing enabled, | 747 | * @depth: number of commands allowed to be queued to the driver |
748 | * or number of commands the low level driver can | ||
749 | * queue up in non-tagged mode (as per cmd_per_lun). | ||
750 | * | 748 | * |
751 | * Returns: Nothing | 749 | * Sets the device queue depth and returns the new value. |
752 | * | ||
753 | * Lock Status: None held on entry | ||
754 | * | ||
755 | * Notes: Low level drivers may call this at any time and we will do | ||
756 | * the right thing depending on whether or not the device is | ||
757 | * currently active and whether or not it even has the | ||
758 | * command blocks built yet. | ||
759 | */ | 750 | */ |
760 | void scsi_adjust_queue_depth(struct scsi_device *sdev, int tags) | 751 | int scsi_change_queue_depth(struct scsi_device *sdev, int depth) |
761 | { | 752 | { |
762 | unsigned long flags; | 753 | unsigned long flags; |
763 | 754 | ||
764 | /* | 755 | if (depth <= 0) |
765 | * refuse to set tagged depth to an unworkable size | 756 | goto out; |
766 | */ | ||
767 | if (tags <= 0) | ||
768 | return; | ||
769 | 757 | ||
770 | spin_lock_irqsave(sdev->request_queue->queue_lock, flags); | 758 | spin_lock_irqsave(sdev->request_queue->queue_lock, flags); |
771 | 759 | ||
@@ -780,15 +768,17 @@ void scsi_adjust_queue_depth(struct scsi_device *sdev, int tags) | |||
780 | */ | 768 | */ |
781 | if (!shost_use_blk_mq(sdev->host) && !sdev->host->bqt) { | 769 | if (!shost_use_blk_mq(sdev->host) && !sdev->host->bqt) { |
782 | if (blk_queue_tagged(sdev->request_queue) && | 770 | if (blk_queue_tagged(sdev->request_queue) && |
783 | blk_queue_resize_tags(sdev->request_queue, tags) != 0) | 771 | blk_queue_resize_tags(sdev->request_queue, depth) != 0) |
784 | goto out; | 772 | goto out_unlock; |
785 | } | 773 | } |
786 | 774 | ||
787 | sdev->queue_depth = tags; | 775 | sdev->queue_depth = depth; |
788 | out: | 776 | out_unlock: |
789 | spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags); | 777 | spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags); |
778 | out: | ||
779 | return sdev->queue_depth; | ||
790 | } | 780 | } |
791 | EXPORT_SYMBOL(scsi_adjust_queue_depth); | 781 | EXPORT_SYMBOL(scsi_change_queue_depth); |
792 | 782 | ||
793 | /** | 783 | /** |
794 | * scsi_track_queue_full - track QUEUE_FULL events to adjust queue depth | 784 | * scsi_track_queue_full - track QUEUE_FULL events to adjust queue depth |
@@ -833,12 +823,11 @@ int scsi_track_queue_full(struct scsi_device *sdev, int depth) | |||
833 | if (sdev->last_queue_full_depth < 8) { | 823 | if (sdev->last_queue_full_depth < 8) { |
834 | /* Drop back to untagged */ | 824 | /* Drop back to untagged */ |
835 | scsi_set_tag_type(sdev, 0); | 825 | scsi_set_tag_type(sdev, 0); |
836 | scsi_adjust_queue_depth(sdev, sdev->host->cmd_per_lun); | 826 | scsi_change_queue_depth(sdev, sdev->host->cmd_per_lun); |
837 | return -1; | 827 | return -1; |
838 | } | 828 | } |
839 | 829 | ||
840 | scsi_adjust_queue_depth(sdev, depth); | 830 | return scsi_change_queue_depth(sdev, depth); |
841 | return depth; | ||
842 | } | 831 | } |
843 | EXPORT_SYMBOL(scsi_track_queue_full); | 832 | EXPORT_SYMBOL(scsi_track_queue_full); |
844 | 833 | ||