aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-02-12 09:32:59 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-02-12 14:36:30 -0500
commitb00eec1d58ee71131375bfeb86e64bceec3f5618 (patch)
tree03536ad3ecc61d42da0611f40a51fedcd44192b5 /drivers/scsi
parent6e7846e9c548443c86cfbad9e4defb4bdcfc538b (diff)
[PATCH] libata: add per-device max_sectors
If a low level driver wants to control max_sectors, it had to adjust ap->host->max_sectors and set ATA_DFLAG_LOCK_SECTORS to tell ata_scsi_slave_config not to override the limit. This is not only cumbersome but also incorrect for hosts which support more than one devices per port. This patch adds per-device ->max_sectors. If the field is unset (zero), libata core layer will adjust ->max_sectors according to default rules. If the field is set, libata honors the setting. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/libata-core.c4
-rw-r--r--drivers/scsi/libata-scsi.c18
-rw-r--r--drivers/scsi/sata_sil.c4
3 files changed, 11 insertions, 15 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 1a373b4d0e22..61cba39a6834 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1147,9 +1147,7 @@ void ata_dev_config(struct ata_port *ap, unsigned int i)
1147 printk(KERN_INFO "ata%u(%u): applying bridge limits\n", 1147 printk(KERN_INFO "ata%u(%u): applying bridge limits\n",
1148 ap->id, i); 1148 ap->id, i);
1149 ap->udma_mask &= ATA_UDMA5; 1149 ap->udma_mask &= ATA_UDMA5;
1150 ap->host->max_sectors = ATA_MAX_SECTORS; 1150 ap->device[i].max_sectors = ATA_MAX_SECTORS;
1151 ap->host->hostt->max_sectors = ATA_MAX_SECTORS;
1152 ap->device[i].flags |= ATA_DFLAG_LOCK_SECTORS;
1153 } 1151 }
1154 1152
1155 if (ap->ops->dev_config) 1153 if (ap->ops->dev_config)
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 3628fedc9865..86da46502b3e 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -684,23 +684,23 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
684 if (sdev->id < ATA_MAX_DEVICES) { 684 if (sdev->id < ATA_MAX_DEVICES) {
685 struct ata_port *ap; 685 struct ata_port *ap;
686 struct ata_device *dev; 686 struct ata_device *dev;
687 unsigned int max_sectors;
687 688
688 ap = (struct ata_port *) &sdev->host->hostdata[0]; 689 ap = (struct ata_port *) &sdev->host->hostdata[0];
689 dev = &ap->device[sdev->id]; 690 dev = &ap->device[sdev->id];
690 691
691 /* TODO: 1024 is an arbitrary number, not the 692 /* TODO: 2048 is an arbitrary number, not the
692 * hardware maximum. This should be increased to 693 * hardware maximum. This should be increased to
693 * 65534 when Jens Axboe's patch for dynamically 694 * 65534 when Jens Axboe's patch for dynamically
694 * determining max_sectors is merged. 695 * determining max_sectors is merged.
695 */ 696 */
696 if ((dev->flags & ATA_DFLAG_LBA48) && 697 max_sectors = ATA_MAX_SECTORS;
697 ((dev->flags & ATA_DFLAG_LOCK_SECTORS) == 0)) { 698 if (dev->flags & ATA_DFLAG_LBA48)
698 /* 699 max_sectors = 2048;
699 * do not overwrite sdev->host->max_sectors, since 700 if (dev->max_sectors)
700 * other drives on this host may not support LBA48 701 max_sectors = dev->max_sectors;
701 */ 702
702 blk_queue_max_sectors(sdev->request_queue, 2048); 703 blk_queue_max_sectors(sdev->request_queue, max_sectors);
703 }
704 704
705 /* 705 /*
706 * SATA DMA transfers must be multiples of 4 byte, so 706 * SATA DMA transfers must be multiples of 4 byte, so
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index 61c4ac7ff9db..6c482c8be254 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -354,9 +354,7 @@ static void sil_dev_config(struct ata_port *ap, struct ata_device *dev)
354 (quirks & SIL_QUIRK_MOD15WRITE))) { 354 (quirks & SIL_QUIRK_MOD15WRITE))) {
355 printk(KERN_INFO "ata%u(%u): applying Seagate errata fix (mod15write workaround)\n", 355 printk(KERN_INFO "ata%u(%u): applying Seagate errata fix (mod15write workaround)\n",
356 ap->id, dev->devno); 356 ap->id, dev->devno);
357 ap->host->max_sectors = 15; 357 dev->max_sectors = 15;
358 ap->host->hostt->max_sectors = 15;
359 dev->flags |= ATA_DFLAG_LOCK_SECTORS;
360 return; 358 return;
361 } 359 }
362 360