aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-eh.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-08-18 00:28:49 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-12 14:55:37 -0400
commita1e10f7e68a544c80081fee4fa550dc28389f44a (patch)
treecf6673989f360e0b12b2a658a7042d30420c14eb /drivers/ata/libata-eh.c
parentcbcdd87593a1d85c5c4b259945a3a09eee12814d (diff)
libata: move EH repeat reporting into ata_eh_report()
EH is sometimes repeated without any error or action. For example, this happens when probing IDENTIFY fails because of a phantom device. In these cases, all the repeated EH does is making sure there is no unhandled error or pending action and return. This repeation is necessary to avoid losing any event which occurred while EH was in progress. Unfortunately, this dry run causes annonying "EH pending after completion" message. This patch moves the repeat reporting into ata_eh_report() such that it's more compact and skipped on dry runs. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: Mikael Pettersson <mikep@it.uu.se> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r--drivers/ata/libata-eh.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 8219e2d71045..daa2f74f73c8 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -358,7 +358,7 @@ enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd)
358void ata_scsi_error(struct Scsi_Host *host) 358void ata_scsi_error(struct Scsi_Host *host)
359{ 359{
360 struct ata_port *ap = ata_shost_to_port(host); 360 struct ata_port *ap = ata_shost_to_port(host);
361 int i, repeat_cnt = ATA_EH_MAX_REPEAT; 361 int i;
362 unsigned long flags; 362 unsigned long flags;
363 363
364 DPRINTK("ENTER\n"); 364 DPRINTK("ENTER\n");
@@ -424,6 +424,9 @@ void ata_scsi_error(struct Scsi_Host *host)
424 __ata_port_freeze(ap); 424 __ata_port_freeze(ap);
425 425
426 spin_unlock_irqrestore(ap->lock, flags); 426 spin_unlock_irqrestore(ap->lock, flags);
427
428 /* initialize eh_tries */
429 ap->eh_tries = ATA_EH_MAX_TRIES;
427 } else 430 } else
428 spin_unlock_wait(ap->lock); 431 spin_unlock_wait(ap->lock);
429 432
@@ -468,15 +471,12 @@ void ata_scsi_error(struct Scsi_Host *host)
468 spin_lock_irqsave(ap->lock, flags); 471 spin_lock_irqsave(ap->lock, flags);
469 472
470 if (ap->pflags & ATA_PFLAG_EH_PENDING) { 473 if (ap->pflags & ATA_PFLAG_EH_PENDING) {
471 if (--repeat_cnt) { 474 if (--ap->eh_tries) {
472 ata_port_printk(ap, KERN_INFO,
473 "EH pending after completion, "
474 "repeating EH (cnt=%d)\n", repeat_cnt);
475 spin_unlock_irqrestore(ap->lock, flags); 475 spin_unlock_irqrestore(ap->lock, flags);
476 goto repeat; 476 goto repeat;
477 } 477 }
478 ata_port_printk(ap, KERN_ERR, "EH pending after %d " 478 ata_port_printk(ap, KERN_ERR, "EH pending after %d "
479 "tries, giving up\n", ATA_EH_MAX_REPEAT); 479 "tries, giving up\n", ATA_EH_MAX_TRIES);
480 ap->pflags &= ~ATA_PFLAG_EH_PENDING; 480 ap->pflags &= ~ATA_PFLAG_EH_PENDING;
481 } 481 }
482 482
@@ -1778,6 +1778,7 @@ static void ata_eh_link_report(struct ata_link *link)
1778 struct ata_port *ap = link->ap; 1778 struct ata_port *ap = link->ap;
1779 struct ata_eh_context *ehc = &link->eh_context; 1779 struct ata_eh_context *ehc = &link->eh_context;
1780 const char *frozen, *desc; 1780 const char *frozen, *desc;
1781 char tries_buf[6];
1781 int tag, nr_failed = 0; 1782 int tag, nr_failed = 0;
1782 1783
1783 desc = NULL; 1784 desc = NULL;
@@ -1802,18 +1803,23 @@ static void ata_eh_link_report(struct ata_link *link)
1802 if (ap->pflags & ATA_PFLAG_FROZEN) 1803 if (ap->pflags & ATA_PFLAG_FROZEN)
1803 frozen = " frozen"; 1804 frozen = " frozen";
1804 1805
1806 memset(tries_buf, 0, sizeof(tries_buf));
1807 if (ap->eh_tries < ATA_EH_MAX_TRIES)
1808 snprintf(tries_buf, sizeof(tries_buf) - 1, " t%d",
1809 ap->eh_tries);
1810
1805 if (ehc->i.dev) { 1811 if (ehc->i.dev) {
1806 ata_dev_printk(ehc->i.dev, KERN_ERR, "exception Emask 0x%x " 1812 ata_dev_printk(ehc->i.dev, KERN_ERR, "exception Emask 0x%x "
1807 "SAct 0x%x SErr 0x%x action 0x%x%s\n", 1813 "SAct 0x%x SErr 0x%x action 0x%x%s%s\n",
1808 ehc->i.err_mask, link->sactive, 1814 ehc->i.err_mask, link->sactive, ehc->i.serror,
1809 ehc->i.serror, ehc->i.action, frozen); 1815 ehc->i.action, frozen, tries_buf);
1810 if (desc) 1816 if (desc)
1811 ata_dev_printk(ehc->i.dev, KERN_ERR, "%s\n", desc); 1817 ata_dev_printk(ehc->i.dev, KERN_ERR, "%s\n", desc);
1812 } else { 1818 } else {
1813 ata_link_printk(link, KERN_ERR, "exception Emask 0x%x " 1819 ata_link_printk(link, KERN_ERR, "exception Emask 0x%x "
1814 "SAct 0x%x SErr 0x%x action 0x%x%s\n", 1820 "SAct 0x%x SErr 0x%x action 0x%x%s%s\n",
1815 ehc->i.err_mask, link->sactive, 1821 ehc->i.err_mask, link->sactive, ehc->i.serror,
1816 ehc->i.serror, ehc->i.action, frozen); 1822 ehc->i.action, frozen, tries_buf);
1817 if (desc) 1823 if (desc)
1818 ata_link_printk(link, KERN_ERR, "%s\n", desc); 1824 ata_link_printk(link, KERN_ERR, "%s\n", desc);
1819 } 1825 }