libata: quickly trigger SATA SPD down after debouncing failed
authorTejun Heo <htejun@gmail.com>
Mon, 16 Jul 2007 05:29:40 +0000 (14:29 +0900)
committerJeff Garzik <jeff@garzik.org>
Fri, 20 Jul 2007 12:19:06 +0000 (08:19 -0400)
Debouncing failure is a good indicator of basic link problem.  Use
-EPIPE to indicate debouncing failure and make ata_eh_reset() invoke
sata_down_spd_limit() if the error occurs during reset.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/ata/libata-core.c
drivers/ata/libata-eh.c

index c325b7a4246a1e49929aac0cc439179827112a8e..05922e9f4fade04e2f7a4b837ad15388a1df70bf 100644 (file)
@@ -3267,9 +3267,11 @@ int sata_phy_debounce(struct ata_port *ap, const unsigned long *params,
                last = cur;
                last_jiffies = jiffies;
 
-               /* check deadline */
+               /* Check deadline.  If debouncing failed, return
+                * -EPIPE to tell upper layer to lower link speed.
+                */
                if (time_after(jiffies, deadline))
-                       return -EBUSY;
+                       return -EPIPE;
        }
 }
 
index 183eaf466d4fb222a168ea5b99ecce8f81c79f9b..1a4397ae9e48285893c7a8ad517a14359189606f 100644 (file)
@@ -1790,7 +1790,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
                        schedule_timeout_uninterruptible(delta);
                }
 
-               if (reset == hardreset &&
+               if (rc == -EPIPE ||
                    try == ARRAY_SIZE(ata_eh_reset_timeouts) - 1)
                        sata_down_spd_limit(ap);
                if (hardreset)