diff options
Diffstat (limited to 'drivers/scsi/libata-scsi.c')
-rw-r--r-- | drivers/scsi/libata-scsi.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 9bef68c7c1de..996058af1bcd 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <scsi/scsi_eh.h> | 41 | #include <scsi/scsi_eh.h> |
42 | #include <scsi/scsi_device.h> | 42 | #include <scsi/scsi_device.h> |
43 | #include <scsi/scsi_request.h> | 43 | #include <scsi/scsi_request.h> |
44 | #include <scsi/scsi_tcq.h> | ||
44 | #include <scsi/scsi_transport.h> | 45 | #include <scsi/scsi_transport.h> |
45 | #include <linux/libata.h> | 46 | #include <linux/libata.h> |
46 | #include <linux/hdreg.h> | 47 | #include <linux/hdreg.h> |
@@ -684,6 +685,14 @@ static void ata_scsi_dev_config(struct scsi_device *sdev, | |||
684 | request_queue_t *q = sdev->request_queue; | 685 | request_queue_t *q = sdev->request_queue; |
685 | blk_queue_max_hw_segments(q, q->max_hw_segments - 1); | 686 | blk_queue_max_hw_segments(q, q->max_hw_segments - 1); |
686 | } | 687 | } |
688 | |||
689 | if (dev->flags & ATA_DFLAG_NCQ) { | ||
690 | int depth; | ||
691 | |||
692 | depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id)); | ||
693 | depth = min(ATA_MAX_QUEUE - 1, depth); | ||
694 | scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth); | ||
695 | } | ||
687 | } | 696 | } |
688 | 697 | ||
689 | /** | 698 | /** |
@@ -718,6 +727,43 @@ int ata_scsi_slave_config(struct scsi_device *sdev) | |||
718 | } | 727 | } |
719 | 728 | ||
720 | /** | 729 | /** |
730 | * ata_scsi_change_queue_depth - SCSI callback for queue depth config | ||
731 | * @sdev: SCSI device to configure queue depth for | ||
732 | * @queue_depth: new queue depth | ||
733 | * | ||
734 | * This is libata standard hostt->change_queue_depth callback. | ||
735 | * SCSI will call into this callback when user tries to set queue | ||
736 | * depth via sysfs. | ||
737 | * | ||
738 | * LOCKING: | ||
739 | * SCSI layer (we don't care) | ||
740 | * | ||
741 | * RETURNS: | ||
742 | * Newly configured queue depth. | ||
743 | */ | ||
744 | int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth) | ||
745 | { | ||
746 | struct ata_port *ap = ata_shost_to_port(sdev->host); | ||
747 | struct ata_device *dev; | ||
748 | int max_depth; | ||
749 | |||
750 | if (queue_depth < 1) | ||
751 | return sdev->queue_depth; | ||
752 | |||
753 | dev = ata_scsi_find_dev(ap, sdev); | ||
754 | if (!dev || !ata_dev_enabled(dev)) | ||
755 | return sdev->queue_depth; | ||
756 | |||
757 | max_depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id)); | ||
758 | max_depth = min(ATA_MAX_QUEUE - 1, max_depth); | ||
759 | if (queue_depth > max_depth) | ||
760 | queue_depth = max_depth; | ||
761 | |||
762 | scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, queue_depth); | ||
763 | return queue_depth; | ||
764 | } | ||
765 | |||
766 | /** | ||
721 | * ata_scsi_start_stop_xlat - Translate SCSI START STOP UNIT command | 767 | * ata_scsi_start_stop_xlat - Translate SCSI START STOP UNIT command |
722 | * @qc: Storage for translated ATA taskfile | 768 | * @qc: Storage for translated ATA taskfile |
723 | * @scsicmd: SCSI command to translate | 769 | * @scsicmd: SCSI command to translate |