aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/cciss.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2010-08-07 12:17:56 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-08-07 12:17:56 -0400
commit33659ebbae262228eef4e0fe990f393d1f0ed941 (patch)
treefcb537f09359c8dad3a6f6e16dc4319562dc42cc /drivers/block/cciss.c
parent7e005f79791dcd58436c88ded4a7f5aed1b82147 (diff)
block: remove wrappers for request type/flags
Remove all the trivial wrappers for the cmd_type and cmd_flags fields in struct requests. This allows much easier grepping for different request types instead of unwinding through macros. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r--drivers/block/cciss.c49
1 files changed, 30 insertions, 19 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 10a0268a1f92..11b377762b8e 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1783,7 +1783,7 @@ static void cciss_softirq_done(struct request *rq)
1783#endif /* CCISS_DEBUG */ 1783#endif /* CCISS_DEBUG */
1784 1784
1785 /* set the residual count for pc requests */ 1785 /* set the residual count for pc requests */
1786 if (blk_pc_request(rq)) 1786 if (rq->cmd_type == REQ_TYPE_BLOCK_PC)
1787 rq->resid_len = cmd->err_info->ResidualCnt; 1787 rq->resid_len = cmd->err_info->ResidualCnt;
1788 1788
1789 blk_end_request_all(rq, (rq->errors == 0) ? 0 : -EIO); 1789 blk_end_request_all(rq, (rq->errors == 0) ? 0 : -EIO);
@@ -2983,7 +2983,7 @@ static inline int evaluate_target_status(ctlr_info_t *h,
2983 driver_byte = DRIVER_OK; 2983 driver_byte = DRIVER_OK;
2984 msg_byte = cmd->err_info->CommandStatus; /* correct? seems too device specific */ 2984 msg_byte = cmd->err_info->CommandStatus; /* correct? seems too device specific */
2985 2985
2986 if (blk_pc_request(cmd->rq)) 2986 if (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC)
2987 host_byte = DID_PASSTHROUGH; 2987 host_byte = DID_PASSTHROUGH;
2988 else 2988 else
2989 host_byte = DID_OK; 2989 host_byte = DID_OK;
@@ -2992,7 +2992,7 @@ static inline int evaluate_target_status(ctlr_info_t *h,
2992 host_byte, driver_byte); 2992 host_byte, driver_byte);
2993 2993
2994 if (cmd->err_info->ScsiStatus != SAM_STAT_CHECK_CONDITION) { 2994 if (cmd->err_info->ScsiStatus != SAM_STAT_CHECK_CONDITION) {
2995 if (!blk_pc_request(cmd->rq)) 2995 if (cmd->rq->cmd_type != REQ_TYPE_BLOCK_PC)
2996 printk(KERN_WARNING "cciss: cmd %p " 2996 printk(KERN_WARNING "cciss: cmd %p "
2997 "has SCSI Status 0x%x\n", 2997 "has SCSI Status 0x%x\n",
2998 cmd, cmd->err_info->ScsiStatus); 2998 cmd, cmd->err_info->ScsiStatus);
@@ -3002,15 +3002,17 @@ static inline int evaluate_target_status(ctlr_info_t *h,
3002 /* check the sense key */ 3002 /* check the sense key */
3003 sense_key = 0xf & cmd->err_info->SenseInfo[2]; 3003 sense_key = 0xf & cmd->err_info->SenseInfo[2];
3004 /* no status or recovered error */ 3004 /* no status or recovered error */
3005 if (((sense_key == 0x0) || (sense_key == 0x1)) && !blk_pc_request(cmd->rq)) 3005 if (((sense_key == 0x0) || (sense_key == 0x1)) &&
3006 (cmd->rq->cmd_type != REQ_TYPE_BLOCK_PC))
3006 error_value = 0; 3007 error_value = 0;
3007 3008
3008 if (check_for_unit_attention(h, cmd)) { 3009 if (check_for_unit_attention(h, cmd)) {
3009 *retry_cmd = !blk_pc_request(cmd->rq); 3010 *retry_cmd = !(cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC);
3010 return 0; 3011 return 0;
3011 } 3012 }
3012 3013
3013 if (!blk_pc_request(cmd->rq)) { /* Not SG_IO or similar? */ 3014 /* Not SG_IO or similar? */
3015 if (cmd->rq->cmd_type != REQ_TYPE_BLOCK_PC) {
3014 if (error_value != 0) 3016 if (error_value != 0)
3015 printk(KERN_WARNING "cciss: cmd %p has CHECK CONDITION" 3017 printk(KERN_WARNING "cciss: cmd %p has CHECK CONDITION"
3016 " sense key = 0x%x\n", cmd, sense_key); 3018 " sense key = 0x%x\n", cmd, sense_key);
@@ -3052,7 +3054,7 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3052 rq->errors = evaluate_target_status(h, cmd, &retry_cmd); 3054 rq->errors = evaluate_target_status(h, cmd, &retry_cmd);
3053 break; 3055 break;
3054 case CMD_DATA_UNDERRUN: 3056 case CMD_DATA_UNDERRUN:
3055 if (blk_fs_request(cmd->rq)) { 3057 if (cmd->rq->cmd_type == REQ_TYPE_FS) {
3056 printk(KERN_WARNING "cciss: cmd %p has" 3058 printk(KERN_WARNING "cciss: cmd %p has"
3057 " completed with data underrun " 3059 " completed with data underrun "
3058 "reported\n", cmd); 3060 "reported\n", cmd);
@@ -3060,7 +3062,7 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3060 } 3062 }
3061 break; 3063 break;
3062 case CMD_DATA_OVERRUN: 3064 case CMD_DATA_OVERRUN:
3063 if (blk_fs_request(cmd->rq)) 3065 if (cmd->rq->cmd_type == REQ_TYPE_FS)
3064 printk(KERN_WARNING "cciss: cmd %p has" 3066 printk(KERN_WARNING "cciss: cmd %p has"
3065 " completed with data overrun " 3067 " completed with data overrun "
3066 "reported\n", cmd); 3068 "reported\n", cmd);
@@ -3070,42 +3072,48 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3070 "reported invalid\n", cmd); 3072 "reported invalid\n", cmd);
3071 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3073 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3072 cmd->err_info->CommandStatus, DRIVER_OK, 3074 cmd->err_info->CommandStatus, DRIVER_OK,
3073 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); 3075 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3076 DID_PASSTHROUGH : DID_ERROR);
3074 break; 3077 break;
3075 case CMD_PROTOCOL_ERR: 3078 case CMD_PROTOCOL_ERR:
3076 printk(KERN_WARNING "cciss: cmd %p has " 3079 printk(KERN_WARNING "cciss: cmd %p has "
3077 "protocol error \n", cmd); 3080 "protocol error \n", cmd);
3078 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3081 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3079 cmd->err_info->CommandStatus, DRIVER_OK, 3082 cmd->err_info->CommandStatus, DRIVER_OK,
3080 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); 3083 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3084 DID_PASSTHROUGH : DID_ERROR);
3081 break; 3085 break;
3082 case CMD_HARDWARE_ERR: 3086 case CMD_HARDWARE_ERR:
3083 printk(KERN_WARNING "cciss: cmd %p had " 3087 printk(KERN_WARNING "cciss: cmd %p had "
3084 " hardware error\n", cmd); 3088 " hardware error\n", cmd);
3085 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3089 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3086 cmd->err_info->CommandStatus, DRIVER_OK, 3090 cmd->err_info->CommandStatus, DRIVER_OK,
3087 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); 3091 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3092 DID_PASSTHROUGH : DID_ERROR);
3088 break; 3093 break;
3089 case CMD_CONNECTION_LOST: 3094 case CMD_CONNECTION_LOST:
3090 printk(KERN_WARNING "cciss: cmd %p had " 3095 printk(KERN_WARNING "cciss: cmd %p had "
3091 "connection lost\n", cmd); 3096 "connection lost\n", cmd);
3092 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3097 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3093 cmd->err_info->CommandStatus, DRIVER_OK, 3098 cmd->err_info->CommandStatus, DRIVER_OK,
3094 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); 3099 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3100 DID_PASSTHROUGH : DID_ERROR);
3095 break; 3101 break;
3096 case CMD_ABORTED: 3102 case CMD_ABORTED:
3097 printk(KERN_WARNING "cciss: cmd %p was " 3103 printk(KERN_WARNING "cciss: cmd %p was "
3098 "aborted\n", cmd); 3104 "aborted\n", cmd);
3099 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3105 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3100 cmd->err_info->CommandStatus, DRIVER_OK, 3106 cmd->err_info->CommandStatus, DRIVER_OK,
3101 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ABORT); 3107 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3108 DID_PASSTHROUGH : DID_ABORT);
3102 break; 3109 break;
3103 case CMD_ABORT_FAILED: 3110 case CMD_ABORT_FAILED:
3104 printk(KERN_WARNING "cciss: cmd %p reports " 3111 printk(KERN_WARNING "cciss: cmd %p reports "
3105 "abort failed\n", cmd); 3112 "abort failed\n", cmd);
3106 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3113 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3107 cmd->err_info->CommandStatus, DRIVER_OK, 3114 cmd->err_info->CommandStatus, DRIVER_OK,
3108 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); 3115 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3116 DID_PASSTHROUGH : DID_ERROR);
3109 break; 3117 break;
3110 case CMD_UNSOLICITED_ABORT: 3118 case CMD_UNSOLICITED_ABORT:
3111 printk(KERN_WARNING "cciss%d: unsolicited " 3119 printk(KERN_WARNING "cciss%d: unsolicited "
@@ -3121,13 +3129,15 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3121 "many times\n", h->ctlr, cmd); 3129 "many times\n", h->ctlr, cmd);
3122 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3130 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3123 cmd->err_info->CommandStatus, DRIVER_OK, 3131 cmd->err_info->CommandStatus, DRIVER_OK,
3124 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ABORT); 3132 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3133 DID_PASSTHROUGH : DID_ABORT);
3125 break; 3134 break;
3126 case CMD_TIMEOUT: 3135 case CMD_TIMEOUT:
3127 printk(KERN_WARNING "cciss: cmd %p timedout\n", cmd); 3136 printk(KERN_WARNING "cciss: cmd %p timedout\n", cmd);
3128 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3137 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3129 cmd->err_info->CommandStatus, DRIVER_OK, 3138 cmd->err_info->CommandStatus, DRIVER_OK,
3130 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); 3139 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3140 DID_PASSTHROUGH : DID_ERROR);
3131 break; 3141 break;
3132 default: 3142 default:
3133 printk(KERN_WARNING "cciss: cmd %p returned " 3143 printk(KERN_WARNING "cciss: cmd %p returned "
@@ -3135,7 +3145,8 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3135 cmd->err_info->CommandStatus); 3145 cmd->err_info->CommandStatus);
3136 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3146 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3137 cmd->err_info->CommandStatus, DRIVER_OK, 3147 cmd->err_info->CommandStatus, DRIVER_OK,
3138 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); 3148 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3149 DID_PASSTHROUGH : DID_ERROR);
3139 } 3150 }
3140 3151
3141after_error_processing: 3152after_error_processing:
@@ -3294,7 +3305,7 @@ static void do_cciss_request(struct request_queue *q)
3294 c->Header.SGList = h->max_cmd_sgentries; 3305 c->Header.SGList = h->max_cmd_sgentries;
3295 set_performant_mode(h, c); 3306 set_performant_mode(h, c);
3296 3307
3297 if (likely(blk_fs_request(creq))) { 3308 if (likely(creq->cmd_type == REQ_TYPE_FS)) {
3298 if(h->cciss_read == CCISS_READ_10) { 3309 if(h->cciss_read == CCISS_READ_10) {
3299 c->Request.CDB[1] = 0; 3310 c->Request.CDB[1] = 0;
3300 c->Request.CDB[2] = (start_blk >> 24) & 0xff; /* MSB */ 3311 c->Request.CDB[2] = (start_blk >> 24) & 0xff; /* MSB */
@@ -3324,7 +3335,7 @@ static void do_cciss_request(struct request_queue *q)
3324 c->Request.CDB[13]= blk_rq_sectors(creq) & 0xff; 3335 c->Request.CDB[13]= blk_rq_sectors(creq) & 0xff;
3325 c->Request.CDB[14] = c->Request.CDB[15] = 0; 3336 c->Request.CDB[14] = c->Request.CDB[15] = 0;
3326 } 3337 }
3327 } else if (blk_pc_request(creq)) { 3338 } else if (creq->cmd_type == REQ_TYPE_BLOCK_PC) {
3328 c->Request.CDBLen = creq->cmd_len; 3339 c->Request.CDBLen = creq->cmd_len;
3329 memcpy(c->Request.CDB, creq->cmd, BLK_MAX_CDB); 3340 memcpy(c->Request.CDB, creq->cmd, BLK_MAX_CDB);
3330 } else { 3341 } else {