Commit 41d4c60f authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Damien Le Moal

ata: libata-scsi: rework ata_dump_status to avoid using pr_cont()

pr_cont() has the problem that individual calls will be disrupted
under high load, causing each call to end up on a single line and
thereby mangling the output.
So rework ata_dump_status() to have just one call to ata_port_warn()
and avoid this problem.
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
parent cbc59b8c
...@@ -668,7 +668,7 @@ static void ata_qc_set_pc_nbytes(struct ata_queued_cmd *qc) ...@@ -668,7 +668,7 @@ static void ata_qc_set_pc_nbytes(struct ata_queued_cmd *qc)
/** /**
* ata_dump_status - user friendly display of error info * ata_dump_status - user friendly display of error info
* @id: id of the port in question * @ap: the port in question
* @tf: ptr to filled out taskfile * @tf: ptr to filled out taskfile
* *
* Decode and dump the ATA error/status registers for the user so * Decode and dump the ATA error/status registers for the user so
...@@ -678,37 +678,32 @@ static void ata_qc_set_pc_nbytes(struct ata_queued_cmd *qc) ...@@ -678,37 +678,32 @@ static void ata_qc_set_pc_nbytes(struct ata_queued_cmd *qc)
* LOCKING: * LOCKING:
* inherited from caller * inherited from caller
*/ */
static void ata_dump_status(unsigned id, struct ata_taskfile *tf) static void ata_dump_status(struct ata_port *ap, struct ata_taskfile *tf)
{ {
u8 stat = tf->command, err = tf->feature; u8 stat = tf->command, err = tf->feature;
pr_warn("ata%u: status=0x%02x { ", id, stat);
if (stat & ATA_BUSY) { if (stat & ATA_BUSY) {
pr_cont("Busy }\n"); /* Data is not valid in this case */ ata_port_warn(ap, "status=0x%02x {Busy} ", stat);
} else { } else {
if (stat & ATA_DRDY) pr_cont("DriveReady "); ata_port_warn(ap, "status=0x%02x { %s%s%s%s%s%s%s} ", stat,
if (stat & ATA_DF) pr_cont("DeviceFault "); stat & ATA_DRDY ? "DriveReady " : "",
if (stat & ATA_DSC) pr_cont("SeekComplete "); stat & ATA_DF ? "DeviceFault " : "",
if (stat & ATA_DRQ) pr_cont("DataRequest "); stat & ATA_DSC ? "SeekComplete " : "",
if (stat & ATA_CORR) pr_cont("CorrectedError "); stat & ATA_DRQ ? "DataRequest " : "",
if (stat & ATA_SENSE) pr_cont("Sense "); stat & ATA_CORR ? "CorrectedError " : "",
if (stat & ATA_ERR) pr_cont("Error "); stat & ATA_SENSE ? "Sense " : "",
pr_cont("}\n"); stat & ATA_ERR ? "Error " : "");
if (err)
if (err) { ata_port_warn(ap, "error=0x%02x {%s%s%s%s%s%s", err,
pr_warn("ata%u: error=0x%02x { ", id, err); err & ATA_ABORTED ?
if (err & ATA_ABORTED) pr_cont("DriveStatusError "); "DriveStatusError " : "",
if (err & ATA_ICRC) { err & ATA_ICRC ?
if (err & ATA_ABORTED) (err & ATA_ABORTED ?
pr_cont("BadCRC "); "BadCRC " : "Sector ") : "",
else pr_cont("Sector "); err & ATA_UNC ? "UncorrectableError " : "",
} err & ATA_IDNF ? "SectorIdNotFound " : "",
if (err & ATA_UNC) pr_cont("UncorrectableError "); err & ATA_TRK0NF ? "TrackZeroNotFound " : "",
if (err & ATA_IDNF) pr_cont("SectorIdNotFound "); err & ATA_AMNF ? "AddrMarkNotFound " : "");
if (err & ATA_TRK0NF) pr_cont("TrackZeroNotFound ");
if (err & ATA_AMNF) pr_cont("AddrMarkNotFound ");
pr_cont("}\n");
}
} }
} }
...@@ -1662,7 +1657,7 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) ...@@ -1662,7 +1657,7 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
cmd->result = SAM_STAT_GOOD; cmd->result = SAM_STAT_GOOD;
if (need_sense && !ap->ops->error_handler) if (need_sense && !ap->ops->error_handler)
ata_dump_status(ap->print_id, &qc->result_tf); ata_dump_status(ap, &qc->result_tf);
ata_qc_done(qc); ata_qc_done(qc);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment