Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=311b581e1d87be87f78e6e17fc50f468f2dec561
Commit:     311b581e1d87be87f78e6e17fc50f468f2dec561
Parent:     12a441622b753684cc73d1c6f225e9ac53e0bf77
Author:     James Bottomley <[EMAIL PROTECTED]>
AuthorDate: Sun Sep 23 09:08:46 2007 -0500
Committer:  James Bottomley <[EMAIL PROTECTED]>
CommitDate: Fri Oct 12 14:51:56 2007 -0400

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: James Bottomley <[EMAIL PROTECTED]>
---
 drivers/scsi/constants.c |   14 ++++++++++++++
 drivers/scsi/scsi_lib.c  |   10 +++++-----
 include/scsi/scsi_dbg.h  |    2 ++
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index 7bdeed1..024553f 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1235,6 +1235,20 @@ scsi_print_sense_hdr(const char *name, struct 
scsi_sense_hdr *sshdr)
 }
 EXPORT_SYMBOL(scsi_print_sense_hdr);
 
+/*
+ * Print normalized SCSI sense header with device information and a prefix.
+ */
+void
+scsi_cmd_print_sense_hdr(struct scsi_cmnd *scmd, const char *desc,
+                         struct scsi_sense_hdr *sshdr)
+{
+       scmd_printk(KERN_INFO, scmd, "%s: ", desc);
+       scsi_show_sense_hdr(sshdr);
+       scmd_printk(KERN_INFO, scmd, "%s: ", desc);
+       scsi_show_extd_sense(sshdr->asc, sshdr->ascq);
+}
+EXPORT_SYMBOL(scsi_cmd_print_sense_hdr);
+
 static void
 scsi_decode_sense_buffer(const unsigned char *sense_buffer, int sense_len,
                       struct scsi_sense_hdr *sshdr)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 94d82cb..86fd3ab 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -944,11 +944,11 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned 
int good_bytes)
                                        break;
                                }
                        }
-                       if (!(req->cmd_flags & REQ_QUIET)) {
-                               scmd_printk(KERN_INFO, cmd,
-                                           "Device not ready: ");
-                               scsi_print_sense_hdr("", &sshdr);
-                       }
+                       if (!(req->cmd_flags & REQ_QUIET))
+                               scsi_cmd_print_sense_hdr(cmd,
+                                                        "Device not ready",
+                                                        &sshdr);
+
                        scsi_end_request(cmd, 0, this_count, 1);
                        return;
                case VOLUME_OVERFLOW:
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
index 5a43a4c..e89844c 100644
--- a/include/scsi/scsi_dbg.h
+++ b/include/scsi/scsi_dbg.h
@@ -9,6 +9,8 @@ extern void __scsi_print_command(unsigned char *);
 extern void scsi_show_extd_sense(unsigned char, unsigned char);
 extern void scsi_show_sense_hdr(struct scsi_sense_hdr *);
 extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *);
+extern void scsi_cmd_print_sense_hdr(struct scsi_cmnd *, const char *,
+                                    struct scsi_sense_hdr *);
 extern void scsi_print_sense(char *, struct scsi_cmnd *);
 extern void __scsi_print_sense(const char *name,
                               const unsigned char *sense_buffer,
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to