[PATCH 1/3] cciss: reformat error handling
PATCH 1/3 This patch reformats some error handling code to reduce line lengths a bit. It accompanies the SG_IO patch which is 2/3 of this set. Please consider this for inclusion. Signed-off-by: Stephen M. Cameron <[EMAIL PROTECTED]> Signed-off-by: Mike Miller <[EMAIL PROTECTED]> --- linux-2.6.21-rc6/drivers/block/cciss.c | 176 - 1 files changed, 90 insertions(+), 86 deletions(-) diff -puN linux-2.6.21-rc6/drivers/block/cciss.c~reformat_error_handling linux-2.6.21-rc6/drivers/block/cciss.c --- cciss_sg_io/linux-2.6.21-rc6/drivers/block/cciss.c~reformat_error_handling 2007-04-10 14:22:46.0 -0500 +++ cciss_sg_io-scameron/linux-2.6.21-rc6/drivers/block/cciss.c 2007-04-10 14:31:58.0 -0500 @@ -2349,95 +2349,99 @@ static inline void complete_command(ctlr if (timeout) status = 0; - if (cmd->err_info->CommandStatus != 0) {/* an error has occurred */ - switch (cmd->err_info->CommandStatus) { - unsigned char sense_key; - case CMD_TARGET_STATUS: - status = 0; - - if (cmd->err_info->ScsiStatus == 0x02) { - printk(KERN_WARNING "cciss: cmd %p " - "has CHECK CONDITION " - " byte 2 = 0x%x\n", cmd, - cmd->err_info->SenseInfo[2] - ); - /* check the sense key */ - sense_key = 0xf & cmd->err_info->SenseInfo[2]; - /* no status or recovered error */ - if ((sense_key == 0x0) || (sense_key == 0x1)) { - status = 1; - } - } else { - printk(KERN_WARNING "cciss: cmd %p " - "has SCSI Status 0x%x\n", - cmd, cmd->err_info->ScsiStatus); + if (cmd->err_info->CommandStatus == 0) /* no error has occurred */ + goto after_error_processing; + + switch (cmd->err_info->CommandStatus) { + unsigned char sense_key; + case CMD_TARGET_STATUS: + status = 0; + + if (cmd->err_info->ScsiStatus == 0x02) { + printk(KERN_WARNING "cciss: cmd %p " + "has CHECK CONDITION " + " byte 2 = 0x%x\n", cmd, + cmd->err_info->SenseInfo[2] + ); + /* check the sense key */ + sense_key = 0xf & cmd->err_info->SenseInfo[2]; + /* no status or recovered error */ + if ((sense_key == 0x0) || (sense_key == 0x1)) { + status = 1; } - 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: -
[PATCH 1/3] cciss: reformat error handling
PATCH 1/3 This patch reformats some error handling code to reduce line lengths a bit. It accompanies the SG_IO patch which is 2/3 of this set. Please consider this for inclusion. Signed-off-by: Stephen M. Cameron [EMAIL PROTECTED] Signed-off-by: Mike Miller [EMAIL PROTECTED] --- linux-2.6.21-rc6/drivers/block/cciss.c | 176 - 1 files changed, 90 insertions(+), 86 deletions(-) diff -puN linux-2.6.21-rc6/drivers/block/cciss.c~reformat_error_handling linux-2.6.21-rc6/drivers/block/cciss.c --- cciss_sg_io/linux-2.6.21-rc6/drivers/block/cciss.c~reformat_error_handling 2007-04-10 14:22:46.0 -0500 +++ cciss_sg_io-scameron/linux-2.6.21-rc6/drivers/block/cciss.c 2007-04-10 14:31:58.0 -0500 @@ -2349,95 +2349,99 @@ static inline void complete_command(ctlr if (timeout) status = 0; - if (cmd-err_info-CommandStatus != 0) {/* an error has occurred */ - switch (cmd-err_info-CommandStatus) { - unsigned char sense_key; - case CMD_TARGET_STATUS: - status = 0; - - if (cmd-err_info-ScsiStatus == 0x02) { - printk(KERN_WARNING cciss: cmd %p - has CHECK CONDITION - byte 2 = 0x%x\n, cmd, - cmd-err_info-SenseInfo[2] - ); - /* check the sense key */ - sense_key = 0xf cmd-err_info-SenseInfo[2]; - /* no status or recovered error */ - if ((sense_key == 0x0) || (sense_key == 0x1)) { - status = 1; - } - } else { - printk(KERN_WARNING cciss: cmd %p - has SCSI Status 0x%x\n, - cmd, cmd-err_info-ScsiStatus); + if (cmd-err_info-CommandStatus == 0) /* no error has occurred */ + goto after_error_processing; + + switch (cmd-err_info-CommandStatus) { + unsigned char sense_key; + case CMD_TARGET_STATUS: + status = 0; + + if (cmd-err_info-ScsiStatus == 0x02) { + printk(KERN_WARNING cciss: cmd %p + has CHECK CONDITION + byte 2 = 0x%x\n, cmd, + cmd-err_info-SenseInfo[2] + ); + /* check the sense key */ + sense_key = 0xf cmd-err_info-SenseInfo[2]; + /* no status or recovered error */ + if ((sense_key == 0x0) || (sense_key == 0x1)) { + status = 1; } - 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,