Ver código fonte

[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>
Tejun Heo 19 anos atrás
pai
commit
1cdaf534f8
3 arquivos alterados com 23 adições e 16 exclusões
  1. 4 2
      drivers/scsi/libata-core.c
  2. 17 14
      drivers/scsi/libata-eh.c
  3. 2 0
      include/linux/libata.h

+ 4 - 2
drivers/scsi/libata-core.c

@@ -5447,6 +5447,7 @@ int ata_device_add(const struct ata_probe_ent *ent)
 		}
 		}
 
 
 		if (ap->ops->error_handler) {
 		if (ap->ops->error_handler) {
+			struct ata_eh_info *ehi = &ap->eh_info;
 			unsigned long flags;
 			unsigned long flags;
 
 
 			ata_port_probe(ap);
 			ata_port_probe(ap);
@@ -5454,8 +5455,9 @@ int ata_device_add(const struct ata_probe_ent *ent)
 			/* kick EH for boot probing */
 			/* kick EH for boot probing */
 			spin_lock_irqsave(ap->lock, flags);
 			spin_lock_irqsave(ap->lock, flags);
 
 
-			ap->eh_info.probe_mask = (1 << ATA_MAX_DEVICES) - 1;
-			ap->eh_info.action |= ATA_EH_SOFTRESET;
+			ehi->probe_mask = (1 << ATA_MAX_DEVICES) - 1;
+			ehi->action |= ATA_EH_SOFTRESET;
+			ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET;
 
 
 			ap->pflags |= ATA_PFLAG_LOADING;
 			ap->pflags |= ATA_PFLAG_LOADING;
 			ata_port_schedule_eh(ap);
 			ata_port_schedule_eh(ap);

+ 17 - 14
drivers/scsi/libata-eh.c

@@ -322,14 +322,13 @@ void ata_scsi_error(struct Scsi_Host *host)
 	/* clean up */
 	/* clean up */
 	spin_lock_irqsave(ap->lock, flags);
 	spin_lock_irqsave(ap->lock, flags);
 
 
-	if (ap->pflags & ATA_PFLAG_LOADING) {
+	if (ap->pflags & ATA_PFLAG_LOADING)
 		ap->pflags &= ~ATA_PFLAG_LOADING;
 		ap->pflags &= ~ATA_PFLAG_LOADING;
-	} else {
-		if (ap->pflags & ATA_PFLAG_SCSI_HOTPLUG)
-			queue_work(ata_aux_wq, &ap->hotplug_task);
-		if (ap->pflags & ATA_PFLAG_RECOVERED)
-			ata_port_printk(ap, KERN_INFO, "EH complete\n");
-	}
+	else if (ap->pflags & ATA_PFLAG_SCSI_HOTPLUG)
+		queue_work(ata_aux_wq, &ap->hotplug_task);
+
+	if (ap->pflags & ATA_PFLAG_RECOVERED)
+		ata_port_printk(ap, KERN_INFO, "EH complete\n");
 
 
 	ap->pflags &= ~(ATA_PFLAG_SCSI_HOTPLUG | ATA_PFLAG_RECOVERED);
 	ap->pflags &= ~(ATA_PFLAG_SCSI_HOTPLUG | ATA_PFLAG_RECOVERED);
 
 
@@ -759,8 +758,12 @@ static void ata_eh_about_to_do(struct ata_port *ap, struct ata_device *dev,
 	unsigned long flags;
 	unsigned long flags;
 
 
 	spin_lock_irqsave(ap->lock, flags);
 	spin_lock_irqsave(ap->lock, flags);
+
 	ata_eh_clear_action(dev, &ap->eh_info, action);
 	ata_eh_clear_action(dev, &ap->eh_info, action);
-	ap->pflags |= ATA_PFLAG_RECOVERED;
+
+	if (!(ap->eh_context.i.flags & ATA_EHI_QUIET))
+		ap->pflags |= ATA_PFLAG_RECOVERED;
+
 	spin_unlock_irqrestore(ap->lock, flags);
 	spin_unlock_irqrestore(ap->lock, flags);
 }
 }
 
 
@@ -1274,6 +1277,9 @@ static void ata_eh_autopsy(struct ata_port *ap)
 
 
 	DPRINTK("ENTER\n");
 	DPRINTK("ENTER\n");
 
 
+	if (ehc->i.flags & ATA_EHI_NO_AUTOPSY)
+		return;
+
 	/* obtain and analyze SError */
 	/* obtain and analyze SError */
 	rc = sata_scr_read(ap, SCR_ERROR, &serror);
 	rc = sata_scr_read(ap, SCR_ERROR, &serror);
 	if (rc == 0) {
 	if (rc == 0) {
@@ -1464,7 +1470,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
 	struct ata_eh_context *ehc = &ap->eh_context;
 	struct ata_eh_context *ehc = &ap->eh_context;
 	unsigned int *classes = ehc->classes;
 	unsigned int *classes = ehc->classes;
 	int tries = ATA_EH_RESET_TRIES;
 	int tries = ATA_EH_RESET_TRIES;
-	int verbose = !(ap->pflags & ATA_PFLAG_LOADING);
+	int verbose = !(ehc->i.flags & ATA_EHI_QUIET);
 	unsigned int action;
 	unsigned int action;
 	ata_reset_fn_t reset;
 	ata_reset_fn_t reset;
 	int i, did_followup_srst, rc;
 	int i, did_followup_srst, rc;
@@ -1907,11 +1913,8 @@ void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
 	       ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
 	       ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
 	       ata_postreset_fn_t postreset)
 	       ata_postreset_fn_t postreset)
 {
 {
-	if (!(ap->pflags & ATA_PFLAG_LOADING)) {
-		ata_eh_autopsy(ap);
-		ata_eh_report(ap);
-	}
-
+	ata_eh_autopsy(ap);
+	ata_eh_report(ap);
 	ata_eh_recover(ap, prereset, softreset, hardreset, postreset);
 	ata_eh_recover(ap, prereset, softreset, hardreset, postreset);
 	ata_eh_finish(ap);
 	ata_eh_finish(ap);
 }
 }

+ 2 - 0
include/linux/libata.h

@@ -260,6 +260,8 @@ enum {
 	/* ata_eh_info->flags */
 	/* ata_eh_info->flags */
 	ATA_EHI_HOTPLUGGED	= (1 << 0),  /* could have been hotplugged */
 	ATA_EHI_HOTPLUGGED	= (1 << 0),  /* could have been hotplugged */
 	ATA_EHI_RESUME_LINK	= (1 << 1),  /* need to resume link */
 	ATA_EHI_RESUME_LINK	= (1 << 1),  /* need to resume link */
+	ATA_EHI_NO_AUTOPSY	= (1 << 2),  /* no autopsy */
+	ATA_EHI_QUIET		= (1 << 3),  /* be quiet */
 
 
 	ATA_EHI_DID_RESET	= (1 << 16), /* already reset this port */
 	ATA_EHI_DID_RESET	= (1 << 16), /* already reset this port */