aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-08-06 05:36:23 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-12 14:55:31 -0400
commitdbd826168d6267a26cf20cd233f6730f8d8047d6 (patch)
tree961486fededf27561a2d790ecab6dc50f94617a9
parent4fb37a25b976e8d1b34461330b3f2c6d9b94c133 (diff)
libata-link: implement ata_link_abort()
Implement ata_link_abort(). Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/ata/libata-core.c1
-rw-r--r--drivers/ata/libata-eh.c50
-rw-r--r--include/linux/libata.h1
3 files changed, 38 insertions, 14 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 3da642bd2ee2..dcae590cc9b4 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -7050,6 +7050,7 @@ EXPORT_SYMBOL_GPL(ata_ehi_push_desc);
7050EXPORT_SYMBOL_GPL(ata_ehi_clear_desc); 7050EXPORT_SYMBOL_GPL(ata_ehi_clear_desc);
7051EXPORT_SYMBOL_GPL(ata_eng_timeout); 7051EXPORT_SYMBOL_GPL(ata_eng_timeout);
7052EXPORT_SYMBOL_GPL(ata_port_schedule_eh); 7052EXPORT_SYMBOL_GPL(ata_port_schedule_eh);
7053EXPORT_SYMBOL_GPL(ata_link_abort);
7053EXPORT_SYMBOL_GPL(ata_port_abort); 7054EXPORT_SYMBOL_GPL(ata_port_abort);
7054EXPORT_SYMBOL_GPL(ata_port_freeze); 7055EXPORT_SYMBOL_GPL(ata_port_freeze);
7055EXPORT_SYMBOL_GPL(ata_eh_freeze_port); 7056EXPORT_SYMBOL_GPL(ata_eh_freeze_port);
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 733aa761f3ee..eb4c0593b406 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -719,19 +719,7 @@ void ata_port_schedule_eh(struct ata_port *ap)
719 DPRINTK("port EH scheduled\n"); 719 DPRINTK("port EH scheduled\n");
720} 720}
721 721
722/** 722static int ata_do_link_abort(struct ata_port *ap, struct ata_link *link)
723 * ata_port_abort - abort all qc's on the port
724 * @ap: ATA port to abort qc's for
725 *
726 * Abort all active qc's of @ap and schedule EH.
727 *
728 * LOCKING:
729 * spin_lock_irqsave(host lock)
730 *
731 * RETURNS:
732 * Number of aborted qc's.
733 */
734int ata_port_abort(struct ata_port *ap)
735{ 723{
736 int tag, nr_aborted = 0; 724 int tag, nr_aborted = 0;
737 725
@@ -743,7 +731,7 @@ int ata_port_abort(struct ata_port *ap)
743 for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { 731 for (tag = 0; tag < ATA_MAX_QUEUE; tag++) {
744 struct ata_queued_cmd *qc = ata_qc_from_tag(ap, tag); 732 struct ata_queued_cmd *qc = ata_qc_from_tag(ap, tag);
745 733
746 if (qc) { 734 if (qc && (!link || qc->dev->link == link)) {
747 qc->flags |= ATA_QCFLAG_FAILED; 735 qc->flags |= ATA_QCFLAG_FAILED;
748 ata_qc_complete(qc); 736 ata_qc_complete(qc);
749 nr_aborted++; 737 nr_aborted++;
@@ -757,6 +745,40 @@ int ata_port_abort(struct ata_port *ap)
757} 745}
758 746
759/** 747/**
748 * ata_link_abort - abort all qc's on the link
749 * @link: ATA link to abort qc's for
750 *
751 * Abort all active qc's active on @link and schedule EH.
752 *
753 * LOCKING:
754 * spin_lock_irqsave(host lock)
755 *
756 * RETURNS:
757 * Number of aborted qc's.
758 */
759int ata_link_abort(struct ata_link *link)
760{
761 return ata_do_link_abort(link->ap, link);
762}
763
764/**
765 * ata_port_abort - abort all qc's on the port
766 * @ap: ATA port to abort qc's for
767 *
768 * Abort all active qc's of @ap and schedule EH.
769 *
770 * LOCKING:
771 * spin_lock_irqsave(host_set lock)
772 *
773 * RETURNS:
774 * Number of aborted qc's.
775 */
776int ata_port_abort(struct ata_port *ap)
777{
778 return ata_do_link_abort(ap, NULL);
779}
780
781/**
760 * __ata_port_freeze - freeze port 782 * __ata_port_freeze - freeze port
761 * @ap: ATA port to freeze 783 * @ap: ATA port to freeze
762 * 784 *
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 74ced08d5989..bfa155789993 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -906,6 +906,7 @@ extern unsigned long ata_pci_default_filter(struct ata_device *, unsigned long);
906extern void ata_eng_timeout(struct ata_port *ap); 906extern void ata_eng_timeout(struct ata_port *ap);
907 907
908extern void ata_port_schedule_eh(struct ata_port *ap); 908extern void ata_port_schedule_eh(struct ata_port *ap);
909extern int ata_link_abort(struct ata_link *link);
909extern int ata_port_abort(struct ata_port *ap); 910extern int ata_port_abort(struct ata_port *ap);
910extern int ata_port_freeze(struct ata_port *ap); 911extern int ata_port_freeze(struct ata_port *ap);
911 912