mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 06:00:52 +07:00
scsi: sd_zbc: Improve report zones error printout
In the case of a report zones command failure, instead of simply printing the host_byte and driver_byte values returned, print a message that is more human readable and useful, adding sense codes too. To do so, use the already defined sd_print_sense_hdr() and sd_print_result() functions by moving the declaration of these functions into sd.h. Link: https://lore.kernel.org/r/20191125070518.951717-1-damien.lemoal@wdc.com Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
45dc8f2d9c
commit
a35989a072
@ -122,8 +122,6 @@ static void sd_eh_reset(struct scsi_cmnd *);
|
||||
static int sd_eh_action(struct scsi_cmnd *, int);
|
||||
static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
|
||||
static void scsi_disk_release(struct device *cdev);
|
||||
static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
|
||||
static void sd_print_result(const struct scsi_disk *, const char *, int);
|
||||
|
||||
static DEFINE_IDA(sd_index_ida);
|
||||
|
||||
@ -3704,15 +3702,13 @@ static void __exit exit_sd(void)
|
||||
module_init(init_sd);
|
||||
module_exit(exit_sd);
|
||||
|
||||
static void sd_print_sense_hdr(struct scsi_disk *sdkp,
|
||||
struct scsi_sense_hdr *sshdr)
|
||||
void sd_print_sense_hdr(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr)
|
||||
{
|
||||
scsi_print_sense_hdr(sdkp->device,
|
||||
sdkp->disk ? sdkp->disk->disk_name : NULL, sshdr);
|
||||
}
|
||||
|
||||
static void sd_print_result(const struct scsi_disk *sdkp, const char *msg,
|
||||
int result)
|
||||
void sd_print_result(const struct scsi_disk *sdkp, const char *msg, int result)
|
||||
{
|
||||
const char *hb_string = scsi_hostbyte_string(result);
|
||||
const char *db_string = scsi_driverbyte_string(result);
|
||||
@ -3727,4 +3723,3 @@ static void sd_print_result(const struct scsi_disk *sdkp, const char *msg,
|
||||
"%s: Result: hostbyte=0x%02x driverbyte=0x%02x\n",
|
||||
msg, host_byte(result), driver_byte(result));
|
||||
}
|
||||
|
||||
|
@ -239,4 +239,7 @@ static inline void sd_zbc_complete(struct scsi_cmnd *cmd,
|
||||
|
||||
#endif /* CONFIG_BLK_DEV_ZONED */
|
||||
|
||||
void sd_print_sense_hdr(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr);
|
||||
void sd_print_result(const struct scsi_disk *sdkp, const char *msg, int result);
|
||||
|
||||
#endif /* _SCSI_DISK_H */
|
||||
|
@ -87,9 +87,11 @@ static int sd_zbc_do_report_zones(struct scsi_disk *sdkp, unsigned char *buf,
|
||||
timeout, SD_MAX_RETRIES, NULL);
|
||||
if (result) {
|
||||
sd_printk(KERN_ERR, sdkp,
|
||||
"REPORT ZONES lba %llu failed with %d/%d\n",
|
||||
(unsigned long long)lba,
|
||||
host_byte(result), driver_byte(result));
|
||||
"REPORT ZONES start lba %llu failed\n", lba);
|
||||
sd_print_result(sdkp, "REPORT ZONES", result);
|
||||
if (driver_byte(result) == DRIVER_SENSE &&
|
||||
scsi_sense_valid(&sshdr))
|
||||
sd_print_sense_hdr(sdkp, &sshdr);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user