diff options
author | Mike Miller (OS Dev) <mikem@beardog.cca.cpqcorp.net> | 2007-05-08 03:29:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:09 -0400 |
commit | d38ae168bfde9195466b9d45cb1126a657c10942 (patch) | |
tree | f9f62fafa4b545b3da6687d927e7ed2221d3195b /drivers | |
parent | 09f0892ec7f8068ba1d1fcef4d1fca23ec96e0dd (diff) |
cciss: reformat error handling
Reformat some error handling code to reduce line lengths a bit.
Signed-off-by: Stephen M. Cameron <steve.cameron@hp.com>
Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/cciss.c | 174 |
1 files changed, 89 insertions, 85 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 65a725cd3422..b00be1427c3f 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -2349,95 +2349,99 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd, | |||
2349 | if (timeout) | 2349 | if (timeout) |
2350 | status = 0; | 2350 | status = 0; |
2351 | 2351 | ||
2352 | if (cmd->err_info->CommandStatus != 0) { /* an error has occurred */ | 2352 | if (cmd->err_info->CommandStatus == 0) /* no error has occurred */ |
2353 | switch (cmd->err_info->CommandStatus) { | 2353 | goto after_error_processing; |
2354 | unsigned char sense_key; | ||
2355 | case CMD_TARGET_STATUS: | ||
2356 | status = 0; | ||
2357 | 2354 | ||
2358 | if (cmd->err_info->ScsiStatus == 0x02) { | 2355 | switch (cmd->err_info->CommandStatus) { |
2359 | printk(KERN_WARNING "cciss: cmd %p " | 2356 | unsigned char sense_key; |
2360 | "has CHECK CONDITION " | 2357 | case CMD_TARGET_STATUS: |
2361 | " byte 2 = 0x%x\n", cmd, | 2358 | status = 0; |
2362 | cmd->err_info->SenseInfo[2] | 2359 | |
2363 | ); | 2360 | if (cmd->err_info->ScsiStatus == 0x02) { |
2364 | /* check the sense key */ | 2361 | printk(KERN_WARNING "cciss: cmd %p " |
2365 | sense_key = 0xf & cmd->err_info->SenseInfo[2]; | 2362 | "has CHECK CONDITION " |
2366 | /* no status or recovered error */ | 2363 | " byte 2 = 0x%x\n", cmd, |
2367 | if ((sense_key == 0x0) || (sense_key == 0x1)) { | 2364 | cmd->err_info->SenseInfo[2] |
2368 | status = 1; | 2365 | ); |
2369 | } | 2366 | /* check the sense key */ |
2370 | } else { | 2367 | sense_key = 0xf & cmd->err_info->SenseInfo[2]; |
2371 | printk(KERN_WARNING "cciss: cmd %p " | 2368 | /* no status or recovered error */ |
2372 | "has SCSI Status 0x%x\n", | 2369 | if ((sense_key == 0x0) || (sense_key == 0x1)) { |
2373 | cmd, cmd->err_info->ScsiStatus); | 2370 | status = 1; |
2374 | } | 2371 | } |
2375 | break; | 2372 | } else { |
2376 | case CMD_DATA_UNDERRUN: | 2373 | printk(KERN_WARNING "cciss: cmd %p " |
2377 | printk(KERN_WARNING "cciss: cmd %p has" | 2374 | "has SCSI Status 0x%x\n", |
2378 | " completed with data underrun " | 2375 | cmd, cmd->err_info->ScsiStatus); |
2379 | "reported\n", cmd); | ||
2380 | break; | ||
2381 | case CMD_DATA_OVERRUN: | ||
2382 | printk(KERN_WARNING "cciss: cmd %p has" | ||
2383 | " completed with data overrun " | ||
2384 | "reported\n", cmd); | ||
2385 | break; | ||
2386 | case CMD_INVALID: | ||
2387 | printk(KERN_WARNING "cciss: cmd %p is " | ||
2388 | "reported invalid\n", cmd); | ||
2389 | status = 0; | ||
2390 | break; | ||
2391 | case CMD_PROTOCOL_ERR: | ||
2392 | printk(KERN_WARNING "cciss: cmd %p has " | ||
2393 | "protocol error \n", cmd); | ||
2394 | status = 0; | ||
2395 | break; | ||
2396 | case CMD_HARDWARE_ERR: | ||
2397 | printk(KERN_WARNING "cciss: cmd %p had " | ||
2398 | " hardware error\n", cmd); | ||
2399 | status = 0; | ||
2400 | break; | ||
2401 | case CMD_CONNECTION_LOST: | ||
2402 | printk(KERN_WARNING "cciss: cmd %p had " | ||
2403 | "connection lost\n", cmd); | ||
2404 | status = 0; | ||
2405 | break; | ||
2406 | case CMD_ABORTED: | ||
2407 | printk(KERN_WARNING "cciss: cmd %p was " | ||
2408 | "aborted\n", cmd); | ||
2409 | status = 0; | ||
2410 | break; | ||
2411 | case CMD_ABORT_FAILED: | ||
2412 | printk(KERN_WARNING "cciss: cmd %p reports " | ||
2413 | "abort failed\n", cmd); | ||
2414 | status = 0; | ||
2415 | break; | ||
2416 | case CMD_UNSOLICITED_ABORT: | ||
2417 | printk(KERN_WARNING "cciss%d: unsolicited " | ||
2418 | "abort %p\n", h->ctlr, cmd); | ||
2419 | if (cmd->retry_count < MAX_CMD_RETRIES) { | ||
2420 | retry_cmd = 1; | ||
2421 | printk(KERN_WARNING | ||
2422 | "cciss%d: retrying %p\n", h->ctlr, cmd); | ||
2423 | cmd->retry_count++; | ||
2424 | } else | ||
2425 | printk(KERN_WARNING | ||
2426 | "cciss%d: %p retried too " | ||
2427 | "many times\n", h->ctlr, cmd); | ||
2428 | status = 0; | ||
2429 | break; | ||
2430 | case CMD_TIMEOUT: | ||
2431 | printk(KERN_WARNING "cciss: cmd %p timedout\n", cmd); | ||
2432 | status = 0; | ||
2433 | break; | ||
2434 | default: | ||
2435 | printk(KERN_WARNING "cciss: cmd %p returned " | ||
2436 | "unknown status %x\n", cmd, | ||
2437 | cmd->err_info->CommandStatus); | ||
2438 | status = 0; | ||
2439 | } | 2376 | } |
2377 | break; | ||
2378 | case CMD_DATA_UNDERRUN: | ||
2379 | printk(KERN_WARNING "cciss: cmd %p has" | ||
2380 | " completed with data underrun " | ||
2381 | "reported\n", cmd); | ||
2382 | break; | ||
2383 | case CMD_DATA_OVERRUN: | ||
2384 | printk(KERN_WARNING "cciss: cmd %p has" | ||
2385 | " completed with data overrun " | ||
2386 | "reported\n", cmd); | ||
2387 | break; | ||
2388 | case CMD_INVALID: | ||
2389 | printk(KERN_WARNING "cciss: cmd %p is " | ||
2390 | "reported invalid\n", cmd); | ||
2391 | status = 0; | ||
2392 | break; | ||
2393 | case CMD_PROTOCOL_ERR: | ||
2394 | printk(KERN_WARNING "cciss: cmd %p has " | ||
2395 | "protocol error \n", cmd); | ||
2396 | status = 0; | ||
2397 | break; | ||
2398 | case CMD_HARDWARE_ERR: | ||
2399 | printk(KERN_WARNING "cciss: cmd %p had " | ||
2400 | " hardware error\n", cmd); | ||
2401 | status = 0; | ||
2402 | break; | ||
2403 | case CMD_CONNECTION_LOST: | ||
2404 | printk(KERN_WARNING "cciss: cmd %p had " | ||
2405 | "connection lost\n", cmd); | ||
2406 | status = 0; | ||
2407 | break; | ||
2408 | case CMD_ABORTED: | ||
2409 | printk(KERN_WARNING "cciss: cmd %p was " | ||
2410 | "aborted\n", cmd); | ||
2411 | status = 0; | ||
2412 | break; | ||
2413 | case CMD_ABORT_FAILED: | ||
2414 | printk(KERN_WARNING "cciss: cmd %p reports " | ||
2415 | "abort failed\n", cmd); | ||
2416 | status = 0; | ||
2417 | break; | ||
2418 | case CMD_UNSOLICITED_ABORT: | ||
2419 | printk(KERN_WARNING "cciss%d: unsolicited " | ||
2420 | "abort %p\n", h->ctlr, cmd); | ||
2421 | if (cmd->retry_count < MAX_CMD_RETRIES) { | ||
2422 | retry_cmd = 1; | ||
2423 | printk(KERN_WARNING | ||
2424 | "cciss%d: retrying %p\n", h->ctlr, cmd); | ||
2425 | cmd->retry_count++; | ||
2426 | } else | ||
2427 | printk(KERN_WARNING | ||
2428 | "cciss%d: %p retried too " | ||
2429 | "many times\n", h->ctlr, cmd); | ||
2430 | status = 0; | ||
2431 | break; | ||
2432 | case CMD_TIMEOUT: | ||
2433 | printk(KERN_WARNING "cciss: cmd %p timedout\n", cmd); | ||
2434 | status = 0; | ||
2435 | break; | ||
2436 | default: | ||
2437 | printk(KERN_WARNING "cciss: cmd %p returned " | ||
2438 | "unknown status %x\n", cmd, | ||
2439 | cmd->err_info->CommandStatus); | ||
2440 | status = 0; | ||
2440 | } | 2441 | } |
2442 | |||
2443 | after_error_processing: | ||
2444 | |||
2441 | /* We need to return this command */ | 2445 | /* We need to return this command */ |
2442 | if (retry_cmd) { | 2446 | if (retry_cmd) { |
2443 | resend_cciss_cmd(h, cmd); | 2447 | resend_cciss_cmd(h, cmd); |