aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-scsi.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-07-02 04:03:52 -0400
committerTejun Heo <tj@kernel.org>2010-07-02 04:59:24 -0400
commitad72cf9885c536e3adae03f8337557ac9dd1e4bb (patch)
treee93af7f241987ffe365792c0130d182b0ac890d1 /drivers/ata/libata-scsi.c
parentd313dd85ad846bc768d58e9ceb28588f917f4c9a (diff)
libata: take advantage of cmwq and remove concurrency limitations
libata has two concurrency related limitations. a. ata_wq which is used for polling PIO has single thread per CPU. If there are multiple devices doing polling PIO on the same CPU, they can't be executed simultaneously. b. ata_aux_wq which is used for SCSI probing has single thread. In cases where SCSI probing is stalled for extended period of time which is possible for ATAPI devices, this will stall all probing. #a is solved by increasing maximum concurrency of ata_wq. Please note that polling PIO might be used under allocation path and thus needs to be served by a separate wq with a rescuer. #b is solved by using the default wq instead and achieving exclusion via per-port mutex. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/ata/libata-scsi.c')
-rw-r--r--drivers/ata/libata-scsi.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index a54273d2c3c6..d75c9c479d1a 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3435,7 +3435,7 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync)
3435 " switching to async\n"); 3435 " switching to async\n");
3436 } 3436 }
3437 3437
3438 queue_delayed_work(ata_aux_wq, &ap->hotplug_task, 3438 queue_delayed_work(system_long_wq, &ap->hotplug_task,
3439 round_jiffies_relative(HZ)); 3439 round_jiffies_relative(HZ));
3440} 3440}
3441 3441
@@ -3582,6 +3582,7 @@ void ata_scsi_hotplug(struct work_struct *work)
3582 } 3582 }
3583 3583
3584 DPRINTK("ENTER\n"); 3584 DPRINTK("ENTER\n");
3585 mutex_lock(&ap->scsi_scan_mutex);
3585 3586
3586 /* Unplug detached devices. We cannot use link iterator here 3587 /* Unplug detached devices. We cannot use link iterator here
3587 * because PMP links have to be scanned even if PMP is 3588 * because PMP links have to be scanned even if PMP is
@@ -3595,6 +3596,7 @@ void ata_scsi_hotplug(struct work_struct *work)
3595 /* scan for new ones */ 3596 /* scan for new ones */
3596 ata_scsi_scan_host(ap, 0); 3597 ata_scsi_scan_host(ap, 0);
3597 3598
3599 mutex_unlock(&ap->scsi_scan_mutex);
3598 DPRINTK("EXIT\n"); 3600 DPRINTK("EXIT\n");
3599} 3601}
3600 3602
@@ -3673,9 +3675,7 @@ static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel,
3673 * @work: Pointer to ATA port to perform scsi_rescan_device() 3675 * @work: Pointer to ATA port to perform scsi_rescan_device()
3674 * 3676 *
3675 * After ATA pass thru (SAT) commands are executed successfully, 3677 * After ATA pass thru (SAT) commands are executed successfully,
3676 * libata need to propagate the changes to SCSI layer. This 3678 * libata need to propagate the changes to SCSI layer.
3677 * function must be executed from ata_aux_wq such that sdev
3678 * attach/detach don't race with rescan.
3679 * 3679 *
3680 * LOCKING: 3680 * LOCKING:
3681 * Kernel thread context (may sleep). 3681 * Kernel thread context (may sleep).
@@ -3688,6 +3688,7 @@ void ata_scsi_dev_rescan(struct work_struct *work)
3688 struct ata_device *dev; 3688 struct ata_device *dev;
3689 unsigned long flags; 3689 unsigned long flags;
3690 3690
3691 mutex_lock(&ap->scsi_scan_mutex);
3691 spin_lock_irqsave(ap->lock, flags); 3692 spin_lock_irqsave(ap->lock, flags);
3692 3693
3693 ata_for_each_link(link, ap, EDGE) { 3694 ata_for_each_link(link, ap, EDGE) {
@@ -3707,6 +3708,7 @@ void ata_scsi_dev_rescan(struct work_struct *work)
3707 } 3708 }
3708 3709
3709 spin_unlock_irqrestore(ap->lock, flags); 3710 spin_unlock_irqrestore(ap->lock, flags);
3711 mutex_unlock(&ap->scsi_scan_mutex);
3710} 3712}
3711 3713
3712/** 3714/**