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

[SCSI] Fix device not ready printk

Because scsi_print_sense_hdr prefixes with KERN_INFO, the output from
scsi_io_completion looks like:

sd 0:0:0:0: [sdb] Device not ready: <6>: Sense Key : 0x2 [current]
: ASC=0x4 ASCQ=0x3

By using scsi_show_sense_hdr, we can get the much more appealing output:

sd 0:0:0:0: [sdb] Device not ready: Sense Key : 0x2 [current]
sd 0:0:0:0: [sdb] Device not ready: ASC=0x4 ASCQ=0x3

Acked-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

authored by

James Bottomley and committed by
James Bottomley
311b581e 12a44162

+21 -5
+14
drivers/scsi/constants.c
··· 1235 1235 } 1236 1236 EXPORT_SYMBOL(scsi_print_sense_hdr); 1237 1237 1238 + /* 1239 + * Print normalized SCSI sense header with device information and a prefix. 1240 + */ 1241 + void 1242 + scsi_cmd_print_sense_hdr(struct scsi_cmnd *scmd, const char *desc, 1243 + struct scsi_sense_hdr *sshdr) 1244 + { 1245 + scmd_printk(KERN_INFO, scmd, "%s: ", desc); 1246 + scsi_show_sense_hdr(sshdr); 1247 + scmd_printk(KERN_INFO, scmd, "%s: ", desc); 1248 + scsi_show_extd_sense(sshdr->asc, sshdr->ascq); 1249 + } 1250 + EXPORT_SYMBOL(scsi_cmd_print_sense_hdr); 1251 + 1238 1252 static void 1239 1253 scsi_decode_sense_buffer(const unsigned char *sense_buffer, int sense_len, 1240 1254 struct scsi_sense_hdr *sshdr)
+5 -5
drivers/scsi/scsi_lib.c
··· 944 944 break; 945 945 } 946 946 } 947 - if (!(req->cmd_flags & REQ_QUIET)) { 948 - scmd_printk(KERN_INFO, cmd, 949 - "Device not ready: "); 950 - scsi_print_sense_hdr("", &sshdr); 951 - } 947 + if (!(req->cmd_flags & REQ_QUIET)) 948 + scsi_cmd_print_sense_hdr(cmd, 949 + "Device not ready", 950 + &sshdr); 951 + 952 952 scsi_end_request(cmd, 0, this_count, 1); 953 953 return; 954 954 case VOLUME_OVERFLOW:
+2
include/scsi/scsi_dbg.h
··· 9 9 extern void scsi_show_extd_sense(unsigned char, unsigned char); 10 10 extern void scsi_show_sense_hdr(struct scsi_sense_hdr *); 11 11 extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *); 12 + extern void scsi_cmd_print_sense_hdr(struct scsi_cmnd *, const char *, 13 + struct scsi_sense_hdr *); 12 14 extern void scsi_print_sense(char *, struct scsi_cmnd *); 13 15 extern void __scsi_print_sense(const char *name, 14 16 const unsigned char *sense_buffer,