aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi.c')
-rw-r--r--drivers/scsi/scsi.c27
1 files changed, 3 insertions, 24 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 207d6a7a1bd0..d07fb653f5dc 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -616,32 +616,11 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
616 */ 616 */
617int scsi_change_queue_depth(struct scsi_device *sdev, int depth) 617int scsi_change_queue_depth(struct scsi_device *sdev, int depth)
618{ 618{
619 unsigned long flags; 619 if (depth > 0) {
620 620 sdev->queue_depth = depth;
621 if (depth <= 0) 621 wmb();
622 goto out;
623
624 spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
625
626 /*
627 * Check to see if the queue is managed by the block layer.
628 * If it is, and we fail to adjust the depth, exit.
629 *
630 * Do not resize the tag map if it is a host wide share bqt,
631 * because the size should be the hosts's can_queue. If there
632 * is more IO than the LLD's can_queue (so there are not enuogh
633 * tags) request_fn's host queue ready check will handle it.
634 */
635 if (!shost_use_blk_mq(sdev->host) && !sdev->host->bqt) {
636 if (blk_queue_tagged(sdev->request_queue) &&
637 blk_queue_resize_tags(sdev->request_queue, depth) != 0)
638 goto out_unlock;
639 } 622 }
640 623
641 sdev->queue_depth = depth;
642out_unlock:
643 spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
644out:
645 return sdev->queue_depth; 624 return sdev->queue_depth;
646} 625}
647EXPORT_SYMBOL(scsi_change_queue_depth); 626EXPORT_SYMBOL(scsi_change_queue_depth);