提交 d38ae168 编写于 作者: M Mike Miller (OS Dev) 提交者: Linus Torvalds

cciss: reformat error handling

Reformat some error handling code to reduce line lengths a bit.
Signed-off-by: NStephen M. Cameron <steve.cameron@hp.com>
Signed-off-by: NMike Miller <mike.miller@hp.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 09f0892e
...@@ -2349,95 +2349,99 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd, ...@@ -2349,95 +2349,99 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
if (timeout) if (timeout)
status = 0; status = 0;
if (cmd->err_info->CommandStatus != 0) { /* an error has occurred */ if (cmd->err_info->CommandStatus == 0) /* no error has occurred */
switch (cmd->err_info->CommandStatus) { goto after_error_processing;
unsigned char sense_key;
case CMD_TARGET_STATUS:
status = 0;
if (cmd->err_info->ScsiStatus == 0x02) { switch (cmd->err_info->CommandStatus) {
printk(KERN_WARNING "cciss: cmd %p " unsigned char sense_key;
"has CHECK CONDITION " case CMD_TARGET_STATUS:
" byte 2 = 0x%x\n", cmd, status = 0;
cmd->err_info->SenseInfo[2]
); if (cmd->err_info->ScsiStatus == 0x02) {
/* check the sense key */ printk(KERN_WARNING "cciss: cmd %p "
sense_key = 0xf & cmd->err_info->SenseInfo[2]; "has CHECK CONDITION "
/* no status or recovered error */ " byte 2 = 0x%x\n", cmd,
if ((sense_key == 0x0) || (sense_key == 0x1)) { cmd->err_info->SenseInfo[2]
status = 1; );
} /* check the sense key */
} else { sense_key = 0xf & cmd->err_info->SenseInfo[2];
printk(KERN_WARNING "cciss: cmd %p " /* no status or recovered error */
"has SCSI Status 0x%x\n", if ((sense_key == 0x0) || (sense_key == 0x1)) {
cmd, cmd->err_info->ScsiStatus); status = 1;
} }
break; } else {
case CMD_DATA_UNDERRUN: printk(KERN_WARNING "cciss: cmd %p "
printk(KERN_WARNING "cciss: cmd %p has" "has SCSI Status 0x%x\n",
" completed with data underrun " cmd, cmd->err_info->ScsiStatus);
"reported\n", cmd);
break;
case CMD_DATA_OVERRUN:
printk(KERN_WARNING "cciss: cmd %p has"
" completed with data overrun "
"reported\n", cmd);
break;
case CMD_INVALID:
printk(KERN_WARNING "cciss: cmd %p is "
"reported invalid\n", cmd);
status = 0;
break;
case CMD_PROTOCOL_ERR:
printk(KERN_WARNING "cciss: cmd %p has "
"protocol error \n", cmd);
status = 0;
break;
case CMD_HARDWARE_ERR:
printk(KERN_WARNING "cciss: cmd %p had "
" hardware error\n", cmd);
status = 0;
break;
case CMD_CONNECTION_LOST:
printk(KERN_WARNING "cciss: cmd %p had "
"connection lost\n", cmd);
status = 0;
break;
case CMD_ABORTED:
printk(KERN_WARNING "cciss: cmd %p was "
"aborted\n", cmd);
status = 0;
break;
case CMD_ABORT_FAILED:
printk(KERN_WARNING "cciss: cmd %p reports "
"abort failed\n", cmd);
status = 0;
break;
case CMD_UNSOLICITED_ABORT:
printk(KERN_WARNING "cciss%d: unsolicited "
"abort %p\n", h->ctlr, cmd);
if (cmd->retry_count < MAX_CMD_RETRIES) {
retry_cmd = 1;
printk(KERN_WARNING
"cciss%d: retrying %p\n", h->ctlr, cmd);
cmd->retry_count++;
} else
printk(KERN_WARNING
"cciss%d: %p retried too "
"many times\n", h->ctlr, cmd);
status = 0;
break;
case CMD_TIMEOUT:
printk(KERN_WARNING "cciss: cmd %p timedout\n", cmd);
status = 0;
break;
default:
printk(KERN_WARNING "cciss: cmd %p returned "
"unknown status %x\n", cmd,
cmd->err_info->CommandStatus);
status = 0;
} }
break;
case CMD_DATA_UNDERRUN:
printk(KERN_WARNING "cciss: cmd %p has"
" completed with data underrun "
"reported\n", cmd);
break;
case CMD_DATA_OVERRUN:
printk(KERN_WARNING "cciss: cmd %p has"
" completed with data overrun "
"reported\n", cmd);
break;
case CMD_INVALID:
printk(KERN_WARNING "cciss: cmd %p is "
"reported invalid\n", cmd);
status = 0;
break;
case CMD_PROTOCOL_ERR:
printk(KERN_WARNING "cciss: cmd %p has "
"protocol error \n", cmd);
status = 0;
break;
case CMD_HARDWARE_ERR:
printk(KERN_WARNING "cciss: cmd %p had "
" hardware error\n", cmd);
status = 0;
break;
case CMD_CONNECTION_LOST:
printk(KERN_WARNING "cciss: cmd %p had "
"connection lost\n", cmd);
status = 0;
break;
case CMD_ABORTED:
printk(KERN_WARNING "cciss: cmd %p was "
"aborted\n", cmd);
status = 0;
break;
case CMD_ABORT_FAILED:
printk(KERN_WARNING "cciss: cmd %p reports "
"abort failed\n", cmd);
status = 0;
break;
case CMD_UNSOLICITED_ABORT:
printk(KERN_WARNING "cciss%d: unsolicited "
"abort %p\n", h->ctlr, cmd);
if (cmd->retry_count < MAX_CMD_RETRIES) {
retry_cmd = 1;
printk(KERN_WARNING
"cciss%d: retrying %p\n", h->ctlr, cmd);
cmd->retry_count++;
} else
printk(KERN_WARNING
"cciss%d: %p retried too "
"many times\n", h->ctlr, cmd);
status = 0;
break;
case CMD_TIMEOUT:
printk(KERN_WARNING "cciss: cmd %p timedout\n", cmd);
status = 0;
break;
default:
printk(KERN_WARNING "cciss: cmd %p returned "
"unknown status %x\n", cmd,
cmd->err_info->CommandStatus);
status = 0;
} }
after_error_processing:
/* We need to return this command */ /* We need to return this command */
if (retry_cmd) { if (retry_cmd) {
resend_cciss_cmd(h, cmd); resend_cciss_cmd(h, cmd);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册