Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

authored by

Hannes Reinecke and committed by
Damien Le Moal
41d4c60f cbc59b8c

+23 -28
+23 -28
drivers/ata/libata-scsi.c
··· 668 668 669 669 /** 670 670 * ata_dump_status - user friendly display of error info 671 - * @id: id of the port in question 671 + * @ap: the port in question 672 672 * @tf: ptr to filled out taskfile 673 673 * 674 674 * Decode and dump the ATA error/status registers for the user so ··· 678 678 * LOCKING: 679 679 * inherited from caller 680 680 */ 681 - static void ata_dump_status(unsigned id, struct ata_taskfile *tf) 681 + static void ata_dump_status(struct ata_port *ap, struct ata_taskfile *tf) 682 682 { 683 683 u8 stat = tf->command, err = tf->feature; 684 684 685 - pr_warn("ata%u: status=0x%02x { ", id, stat); 686 685 if (stat & ATA_BUSY) { 687 - pr_cont("Busy }\n"); /* Data is not valid in this case */ 686 + ata_port_warn(ap, "status=0x%02x {Busy} ", stat); 688 687 } else { 689 - if (stat & ATA_DRDY) pr_cont("DriveReady "); 690 - if (stat & ATA_DF) pr_cont("DeviceFault "); 691 - if (stat & ATA_DSC) pr_cont("SeekComplete "); 692 - if (stat & ATA_DRQ) pr_cont("DataRequest "); 693 - if (stat & ATA_CORR) pr_cont("CorrectedError "); 694 - if (stat & ATA_SENSE) pr_cont("Sense "); 695 - if (stat & ATA_ERR) pr_cont("Error "); 696 - pr_cont("}\n"); 697 - 698 - if (err) { 699 - pr_warn("ata%u: error=0x%02x { ", id, err); 700 - if (err & ATA_ABORTED) pr_cont("DriveStatusError "); 701 - if (err & ATA_ICRC) { 702 - if (err & ATA_ABORTED) 703 - pr_cont("BadCRC "); 704 - else pr_cont("Sector "); 705 - } 706 - if (err & ATA_UNC) pr_cont("UncorrectableError "); 707 - if (err & ATA_IDNF) pr_cont("SectorIdNotFound "); 708 - if (err & ATA_TRK0NF) pr_cont("TrackZeroNotFound "); 709 - if (err & ATA_AMNF) pr_cont("AddrMarkNotFound "); 710 - pr_cont("}\n"); 711 - } 688 + ata_port_warn(ap, "status=0x%02x { %s%s%s%s%s%s%s} ", stat, 689 + stat & ATA_DRDY ? "DriveReady " : "", 690 + stat & ATA_DF ? "DeviceFault " : "", 691 + stat & ATA_DSC ? "SeekComplete " : "", 692 + stat & ATA_DRQ ? "DataRequest " : "", 693 + stat & ATA_CORR ? "CorrectedError " : "", 694 + stat & ATA_SENSE ? "Sense " : "", 695 + stat & ATA_ERR ? "Error " : ""); 696 + if (err) 697 + ata_port_warn(ap, "error=0x%02x {%s%s%s%s%s%s", err, 698 + err & ATA_ABORTED ? 699 + "DriveStatusError " : "", 700 + err & ATA_ICRC ? 701 + (err & ATA_ABORTED ? 702 + "BadCRC " : "Sector ") : "", 703 + err & ATA_UNC ? "UncorrectableError " : "", 704 + err & ATA_IDNF ? "SectorIdNotFound " : "", 705 + err & ATA_TRK0NF ? "TrackZeroNotFound " : "", 706 + err & ATA_AMNF ? "AddrMarkNotFound " : ""); 712 707 } 713 708 } 714 709 ··· 1657 1662 cmd->result = SAM_STAT_GOOD; 1658 1663 1659 1664 if (need_sense && !ap->ops->error_handler) 1660 - ata_dump_status(ap->print_id, &qc->result_tf); 1665 + ata_dump_status(ap, &qc->result_tf); 1661 1666 1662 1667 ata_qc_done(qc); 1663 1668 }