[PATCH] libata: implement ATA_EHI_NO_AUTOPSY and QUIET

Implement ATA_EHI_NO_AUTOPSY and QUIET. These used to be implied by
ATA_PFLAG_LOADING, but new power management and PMP support need to
use these separately. e.g. Suspend/resume operations shouldn't print
full EH messages and resume shouldn't be recorded as an error.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>

authored by Tejun Heo and committed by Jeff Garzik 1cdaf534 e9c83914

+23 -16
+4 -2
drivers/scsi/libata-core.c
··· 5447 5447 } 5448 5448 5449 5449 if (ap->ops->error_handler) { 5450 + struct ata_eh_info *ehi = &ap->eh_info; 5450 5451 unsigned long flags; 5451 5452 5452 5453 ata_port_probe(ap); ··· 5455 5454 /* kick EH for boot probing */ 5456 5455 spin_lock_irqsave(ap->lock, flags); 5457 5456 5458 - ap->eh_info.probe_mask = (1 << ATA_MAX_DEVICES) - 1; 5459 - ap->eh_info.action |= ATA_EH_SOFTRESET; 5457 + ehi->probe_mask = (1 << ATA_MAX_DEVICES) - 1; 5458 + ehi->action |= ATA_EH_SOFTRESET; 5459 + ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET; 5460 5460 5461 5461 ap->pflags |= ATA_PFLAG_LOADING; 5462 5462 ata_port_schedule_eh(ap);
+17 -14
drivers/scsi/libata-eh.c
··· 322 322 /* clean up */ 323 323 spin_lock_irqsave(ap->lock, flags); 324 324 325 - if (ap->pflags & ATA_PFLAG_LOADING) { 325 + if (ap->pflags & ATA_PFLAG_LOADING) 326 326 ap->pflags &= ~ATA_PFLAG_LOADING; 327 - } else { 328 - if (ap->pflags & ATA_PFLAG_SCSI_HOTPLUG) 329 - queue_work(ata_aux_wq, &ap->hotplug_task); 330 - if (ap->pflags & ATA_PFLAG_RECOVERED) 331 - ata_port_printk(ap, KERN_INFO, "EH complete\n"); 332 - } 327 + else if (ap->pflags & ATA_PFLAG_SCSI_HOTPLUG) 328 + queue_work(ata_aux_wq, &ap->hotplug_task); 329 + 330 + if (ap->pflags & ATA_PFLAG_RECOVERED) 331 + ata_port_printk(ap, KERN_INFO, "EH complete\n"); 333 332 334 333 ap->pflags &= ~(ATA_PFLAG_SCSI_HOTPLUG | ATA_PFLAG_RECOVERED); 335 334 ··· 758 759 unsigned long flags; 759 760 760 761 spin_lock_irqsave(ap->lock, flags); 762 + 761 763 ata_eh_clear_action(dev, &ap->eh_info, action); 762 - ap->pflags |= ATA_PFLAG_RECOVERED; 764 + 765 + if (!(ap->eh_context.i.flags & ATA_EHI_QUIET)) 766 + ap->pflags |= ATA_PFLAG_RECOVERED; 767 + 763 768 spin_unlock_irqrestore(ap->lock, flags); 764 769 } 765 770 ··· 1277 1274 1278 1275 DPRINTK("ENTER\n"); 1279 1276 1277 + if (ehc->i.flags & ATA_EHI_NO_AUTOPSY) 1278 + return; 1279 + 1280 1280 /* obtain and analyze SError */ 1281 1281 rc = sata_scr_read(ap, SCR_ERROR, &serror); 1282 1282 if (rc == 0) { ··· 1470 1464 struct ata_eh_context *ehc = &ap->eh_context; 1471 1465 unsigned int *classes = ehc->classes; 1472 1466 int tries = ATA_EH_RESET_TRIES; 1473 - int verbose = !(ap->pflags & ATA_PFLAG_LOADING); 1467 + int verbose = !(ehc->i.flags & ATA_EHI_QUIET); 1474 1468 unsigned int action; 1475 1469 ata_reset_fn_t reset; 1476 1470 int i, did_followup_srst, rc; ··· 1913 1907 ata_reset_fn_t softreset, ata_reset_fn_t hardreset, 1914 1908 ata_postreset_fn_t postreset) 1915 1909 { 1916 - if (!(ap->pflags & ATA_PFLAG_LOADING)) { 1917 - ata_eh_autopsy(ap); 1918 - ata_eh_report(ap); 1919 - } 1920 - 1910 + ata_eh_autopsy(ap); 1911 + ata_eh_report(ap); 1921 1912 ata_eh_recover(ap, prereset, softreset, hardreset, postreset); 1922 1913 ata_eh_finish(ap); 1923 1914 }
+2
include/linux/libata.h
··· 260 260 /* ata_eh_info->flags */ 261 261 ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ 262 262 ATA_EHI_RESUME_LINK = (1 << 1), /* need to resume link */ 263 + ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */ 264 + ATA_EHI_QUIET = (1 << 3), /* be quiet */ 263 265 264 266 ATA_EHI_DID_RESET = (1 << 16), /* already reset this port */ 265 267