aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi.c
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2007-02-27 22:40:27 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-03-11 12:17:49 -0400
commita4d04a4cd9881e89fdc62107b6b57053438f2b30 (patch)
tree79deaf3e73439105f5b824eb7a7f00b7e8afc934 /drivers/scsi/scsi.c
parent684b7fe976554d12e6266d7280c87a0f3feff02e (diff)
[SCSI] Make error printing more verbose
This patch enhances SCSI error printing by: - Making use of scsi_print_result() in the completion functions. - Having scmd_printk() output the disk name (when applicable). Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi.c')
-rw-r--r--drivers/scsi/scsi.c47
1 files changed, 17 insertions, 30 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 1c89ee3e69ba..4c1e31334765 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -344,7 +344,6 @@ void scsi_destroy_command_freelist(struct Scsi_Host *shost)
344void scsi_log_send(struct scsi_cmnd *cmd) 344void scsi_log_send(struct scsi_cmnd *cmd)
345{ 345{
346 unsigned int level; 346 unsigned int level;
347 struct scsi_device *sdev;
348 347
349 /* 348 /*
350 * If ML QUEUE log level is greater than or equal to: 349 * If ML QUEUE log level is greater than or equal to:
@@ -361,22 +360,17 @@ void scsi_log_send(struct scsi_cmnd *cmd)
361 level = SCSI_LOG_LEVEL(SCSI_LOG_MLQUEUE_SHIFT, 360 level = SCSI_LOG_LEVEL(SCSI_LOG_MLQUEUE_SHIFT,
362 SCSI_LOG_MLQUEUE_BITS); 361 SCSI_LOG_MLQUEUE_BITS);
363 if (level > 1) { 362 if (level > 1) {
364 sdev = cmd->device; 363 scmd_printk(KERN_INFO, cmd, "Send: ");
365 sdev_printk(KERN_INFO, sdev, "send ");
366 if (level > 2) 364 if (level > 2)
367 printk("0x%p ", cmd); 365 printk("0x%p ", cmd);
368 /* 366 printk("\n");
369 * spaces to match disposition and cmd->result
370 * output in scsi_log_completion.
371 */
372 printk(" ");
373 scsi_print_command(cmd); 367 scsi_print_command(cmd);
374 if (level > 3) { 368 if (level > 3) {
375 printk(KERN_INFO "buffer = 0x%p, bufflen = %d," 369 printk(KERN_INFO "buffer = 0x%p, bufflen = %d,"
376 " done = 0x%p, queuecommand 0x%p\n", 370 " done = 0x%p, queuecommand 0x%p\n",
377 cmd->request_buffer, cmd->request_bufflen, 371 cmd->request_buffer, cmd->request_bufflen,
378 cmd->done, 372 cmd->done,
379 sdev->host->hostt->queuecommand); 373 cmd->device->host->hostt->queuecommand);
380 374
381 } 375 }
382 } 376 }
@@ -386,7 +380,6 @@ void scsi_log_send(struct scsi_cmnd *cmd)
386void scsi_log_completion(struct scsi_cmnd *cmd, int disposition) 380void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
387{ 381{
388 unsigned int level; 382 unsigned int level;
389 struct scsi_device *sdev;
390 383
391 /* 384 /*
392 * If ML COMPLETE log level is greater than or equal to: 385 * If ML COMPLETE log level is greater than or equal to:
@@ -405,8 +398,7 @@ void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
405 SCSI_LOG_MLCOMPLETE_BITS); 398 SCSI_LOG_MLCOMPLETE_BITS);
406 if (((level > 0) && (cmd->result || disposition != SUCCESS)) || 399 if (((level > 0) && (cmd->result || disposition != SUCCESS)) ||
407 (level > 1)) { 400 (level > 1)) {
408 sdev = cmd->device; 401 scmd_printk(KERN_INFO, cmd, "Done: ");
409 sdev_printk(KERN_INFO, sdev, "done ");
410 if (level > 2) 402 if (level > 2)
411 printk("0x%p ", cmd); 403 printk("0x%p ", cmd);
412 /* 404 /*
@@ -415,40 +407,35 @@ void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
415 */ 407 */
416 switch (disposition) { 408 switch (disposition) {
417 case SUCCESS: 409 case SUCCESS:
418 printk("SUCCESS"); 410 printk("SUCCESS\n");
419 break; 411 break;
420 case NEEDS_RETRY: 412 case NEEDS_RETRY:
421 printk("RETRY "); 413 printk("RETRY\n");
422 break; 414 break;
423 case ADD_TO_MLQUEUE: 415 case ADD_TO_MLQUEUE:
424 printk("MLQUEUE"); 416 printk("MLQUEUE\n");
425 break; 417 break;
426 case FAILED: 418 case FAILED:
427 printk("FAILED "); 419 printk("FAILED\n");
428 break; 420 break;
429 case TIMEOUT_ERROR: 421 case TIMEOUT_ERROR:
430 /* 422 /*
431 * If called via scsi_times_out. 423 * If called via scsi_times_out.
432 */ 424 */
433 printk("TIMEOUT"); 425 printk("TIMEOUT\n");
434 break; 426 break;
435 default: 427 default:
436 printk("UNKNOWN"); 428 printk("UNKNOWN\n");
437 } 429 }
438 printk(" %8x ", cmd->result); 430 scsi_print_result(cmd);
439 scsi_print_command(cmd); 431 scsi_print_command(cmd);
440 if (status_byte(cmd->result) & CHECK_CONDITION) { 432 if (status_byte(cmd->result) & CHECK_CONDITION)
441 /*
442 * XXX The scsi_print_sense formatting/prefix
443 * doesn't match this function.
444 */
445 scsi_print_sense("", cmd); 433 scsi_print_sense("", cmd);
446 } 434 if (level > 3)
447 if (level > 3) { 435 scmd_printk(KERN_INFO, cmd,
448 printk(KERN_INFO "scsi host busy %d failed %d\n", 436 "scsi host busy %d failed %d\n",
449 sdev->host->host_busy, 437 cmd->device->host->host_busy,
450 sdev->host->host_failed); 438 cmd->device->host->host_failed);
451 }
452 } 439 }
453 } 440 }
454} 441}