summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-04-20 10:03:01 -0400
committerJens Axboe <axboe@fb.com>2017-04-20 14:16:10 -0400
commit17d5363b83f8c73ef9109f75a4a9b578f31d842f (patch)
tree07eabf4d2ef1bbba0f5db8dcd8dba4178b5f502c
parentd19633d5375b8f4735c389c80865dfbf0474992a (diff)
scsi: introduce a result field in struct scsi_request
This passes on the scsi_cmnd result field to users of passthrough requests. Currently we abuse req->errors for this purpose, but that field will go away in its current form. Note that the old IDE code abuses the errors field in very creative ways and stores all kinds of different values in it. I didn't dare to touch this magic, so the abuses are brought forward 1:1. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--block/bsg-lib.c8
-rw-r--r--block/bsg.c12
-rw-r--r--block/scsi_ioctl.c14
-rw-r--r--drivers/block/cciss.c42
-rw-r--r--drivers/block/pktcdvd.c2
-rw-r--r--drivers/block/virtio_blk.c2
-rw-r--r--drivers/cdrom/cdrom.c2
-rw-r--r--drivers/ide/ide-atapi.c10
-rw-r--r--drivers/ide/ide-cd.c20
-rw-r--r--drivers/ide/ide-cd_ioctl.c2
-rw-r--r--drivers/ide/ide-devsets.c4
-rw-r--r--drivers/ide/ide-dma.c2
-rw-r--r--drivers/ide/ide-eh.c36
-rw-r--r--drivers/ide/ide-floppy.c10
-rw-r--r--drivers/ide/ide-io.c10
-rw-r--r--drivers/ide/ide-ioctls.c4
-rw-r--r--drivers/ide/ide-park.c2
-rw-r--r--drivers/ide/ide-pm.c8
-rw-r--r--drivers/ide/ide-tape.c4
-rw-r--r--drivers/ide/ide-taskfile.c6
-rw-r--r--drivers/scsi/osd/osd_initiator.c4
-rw-r--r--drivers/scsi/osst.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_bsg.c6
-rw-r--r--drivers/scsi/scsi_lib.c15
-rw-r--r--drivers/scsi/scsi_transport_sas.c2
-rw-r--r--drivers/scsi/sg.c2
-rw-r--r--drivers/scsi/st.c6
-rw-r--r--drivers/target/target_core_pscsi.c2
-rw-r--r--fs/nfsd/blocklayout.c4
-rw-r--r--include/linux/ide.h2
-rw-r--r--include/scsi/scsi_request.h1
31 files changed, 123 insertions, 123 deletions
diff --git a/block/bsg-lib.c b/block/bsg-lib.c
index cd15f9dbb147..0a23dbba2d30 100644
--- a/block/bsg-lib.c
+++ b/block/bsg-lib.c
@@ -37,7 +37,7 @@ static void bsg_destroy_job(struct kref *kref)
37 struct bsg_job *job = container_of(kref, struct bsg_job, kref); 37 struct bsg_job *job = container_of(kref, struct bsg_job, kref);
38 struct request *rq = job->req; 38 struct request *rq = job->req;
39 39
40 blk_end_request_all(rq, rq->errors); 40 blk_end_request_all(rq, scsi_req(rq)->result);
41 41
42 put_device(job->dev); /* release reference for the request */ 42 put_device(job->dev); /* release reference for the request */
43 43
@@ -74,7 +74,7 @@ void bsg_job_done(struct bsg_job *job, int result,
74 struct scsi_request *rq = scsi_req(req); 74 struct scsi_request *rq = scsi_req(req);
75 int err; 75 int err;
76 76
77 err = job->req->errors = result; 77 err = scsi_req(job->req)->result = result;
78 if (err < 0) 78 if (err < 0)
79 /* we're only returning the result field in the reply */ 79 /* we're only returning the result field in the reply */
80 rq->sense_len = sizeof(u32); 80 rq->sense_len = sizeof(u32);
@@ -177,7 +177,7 @@ failjob_rls_job:
177 * @q: request queue to manage 177 * @q: request queue to manage
178 * 178 *
179 * On error the create_bsg_job function should return a -Exyz error value 179 * On error the create_bsg_job function should return a -Exyz error value
180 * that will be set to the req->errors. 180 * that will be set to ->result.
181 * 181 *
182 * Drivers/subsys should pass this to the queue init function. 182 * Drivers/subsys should pass this to the queue init function.
183 */ 183 */
@@ -201,7 +201,7 @@ static void bsg_request_fn(struct request_queue *q)
201 201
202 ret = bsg_create_job(dev, req); 202 ret = bsg_create_job(dev, req);
203 if (ret) { 203 if (ret) {
204 req->errors = ret; 204 scsi_req(req)->result = ret;
205 blk_end_request_all(req, ret); 205 blk_end_request_all(req, ret);
206 spin_lock_irq(q->queue_lock); 206 spin_lock_irq(q->queue_lock);
207 continue; 207 continue;
diff --git a/block/bsg.c b/block/bsg.c
index 74835dbf0c47..d9da1b613ced 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -391,13 +391,13 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr,
391 struct scsi_request *req = scsi_req(rq); 391 struct scsi_request *req = scsi_req(rq);
392 int ret = 0; 392 int ret = 0;
393 393
394 dprintk("rq %p bio %p 0x%x\n", rq, bio, rq->errors); 394 dprintk("rq %p bio %p 0x%x\n", rq, bio, req->result);
395 /* 395 /*
396 * fill in all the output members 396 * fill in all the output members
397 */ 397 */
398 hdr->device_status = rq->errors & 0xff; 398 hdr->device_status = req->result & 0xff;
399 hdr->transport_status = host_byte(rq->errors); 399 hdr->transport_status = host_byte(req->result);
400 hdr->driver_status = driver_byte(rq->errors); 400 hdr->driver_status = driver_byte(req->result);
401 hdr->info = 0; 401 hdr->info = 0;
402 if (hdr->device_status || hdr->transport_status || hdr->driver_status) 402 if (hdr->device_status || hdr->transport_status || hdr->driver_status)
403 hdr->info |= SG_INFO_CHECK; 403 hdr->info |= SG_INFO_CHECK;
@@ -431,8 +431,8 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr,
431 * just a protocol response (i.e. non negative), that gets 431 * just a protocol response (i.e. non negative), that gets
432 * processed above. 432 * processed above.
433 */ 433 */
434 if (!ret && rq->errors < 0) 434 if (!ret && req->result < 0)
435 ret = rq->errors; 435 ret = req->result;
436 436
437 blk_rq_unmap_user(bio); 437 blk_rq_unmap_user(bio);
438 scsi_req_free_cmd(req); 438 scsi_req_free_cmd(req);
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index b1352143f12f..4a294a5f7fab 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -262,11 +262,11 @@ static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr,
262 /* 262 /*
263 * fill in all the output members 263 * fill in all the output members
264 */ 264 */
265 hdr->status = rq->errors & 0xff; 265 hdr->status = req->result & 0xff;
266 hdr->masked_status = status_byte(rq->errors); 266 hdr->masked_status = status_byte(req->result);
267 hdr->msg_status = msg_byte(rq->errors); 267 hdr->msg_status = msg_byte(req->result);
268 hdr->host_status = host_byte(rq->errors); 268 hdr->host_status = host_byte(req->result);
269 hdr->driver_status = driver_byte(rq->errors); 269 hdr->driver_status = driver_byte(req->result);
270 hdr->info = 0; 270 hdr->info = 0;
271 if (hdr->masked_status || hdr->host_status || hdr->driver_status) 271 if (hdr->masked_status || hdr->host_status || hdr->driver_status)
272 hdr->info |= SG_INFO_CHECK; 272 hdr->info |= SG_INFO_CHECK;
@@ -509,7 +509,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
509 509
510 blk_execute_rq(q, disk, rq, 0); 510 blk_execute_rq(q, disk, rq, 0);
511 511
512 err = rq->errors & 0xff; /* only 8 bit SCSI status */ 512 err = req->result & 0xff; /* only 8 bit SCSI status */
513 if (err) { 513 if (err) {
514 if (req->sense_len && req->sense) { 514 if (req->sense_len && req->sense) {
515 bytes = (OMAX_SB_LEN > req->sense_len) ? 515 bytes = (OMAX_SB_LEN > req->sense_len) ?
@@ -548,7 +548,7 @@ static int __blk_send_generic(struct request_queue *q, struct gendisk *bd_disk,
548 scsi_req(rq)->cmd[4] = data; 548 scsi_req(rq)->cmd[4] = data;
549 scsi_req(rq)->cmd_len = 6; 549 scsi_req(rq)->cmd_len = 6;
550 blk_execute_rq(q, bd_disk, rq, 0); 550 blk_execute_rq(q, bd_disk, rq, 0);
551 err = rq->errors ? -EIO : 0; 551 err = scsi_req(rq)->result ? -EIO : 0;
552 blk_put_request(rq); 552 blk_put_request(rq);
553 553
554 return err; 554 return err;
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 8e1a4554951c..cd375503f7b0 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1864,8 +1864,7 @@ static void cciss_softirq_done(struct request *rq)
1864 /* set the residual count for pc requests */ 1864 /* set the residual count for pc requests */
1865 if (blk_rq_is_passthrough(rq)) 1865 if (blk_rq_is_passthrough(rq))
1866 scsi_req(rq)->resid_len = c->err_info->ResidualCnt; 1866 scsi_req(rq)->resid_len = c->err_info->ResidualCnt;
1867 1867 blk_end_request_all(rq, scsi_req(rq)->result ? -EIO : 0);
1868 blk_end_request_all(rq, (rq->errors == 0) ? 0 : -EIO);
1869 1868
1870 spin_lock_irqsave(&h->lock, flags); 1869 spin_lock_irqsave(&h->lock, flags);
1871 cmd_free(h, c); 1870 cmd_free(h, c);
@@ -3140,18 +3139,19 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3140{ 3139{
3141 int retry_cmd = 0; 3140 int retry_cmd = 0;
3142 struct request *rq = cmd->rq; 3141 struct request *rq = cmd->rq;
3142 struct scsi_request *sreq = scsi_req(rq);
3143 3143
3144 rq->errors = 0; 3144 sreq->result = 0;
3145 3145
3146 if (timeout) 3146 if (timeout)
3147 rq->errors = make_status_bytes(0, 0, 0, DRIVER_TIMEOUT); 3147 sreq->result = make_status_bytes(0, 0, 0, DRIVER_TIMEOUT);
3148 3148
3149 if (cmd->err_info->CommandStatus == 0) /* no error has occurred */ 3149 if (cmd->err_info->CommandStatus == 0) /* no error has occurred */
3150 goto after_error_processing; 3150 goto after_error_processing;
3151 3151
3152 switch (cmd->err_info->CommandStatus) { 3152 switch (cmd->err_info->CommandStatus) {
3153 case CMD_TARGET_STATUS: 3153 case CMD_TARGET_STATUS:
3154 rq->errors = evaluate_target_status(h, cmd, &retry_cmd); 3154 sreq->result = evaluate_target_status(h, cmd, &retry_cmd);
3155 break; 3155 break;
3156 case CMD_DATA_UNDERRUN: 3156 case CMD_DATA_UNDERRUN:
3157 if (!blk_rq_is_passthrough(cmd->rq)) { 3157 if (!blk_rq_is_passthrough(cmd->rq)) {
@@ -3169,7 +3169,7 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3169 case CMD_INVALID: 3169 case CMD_INVALID:
3170 dev_warn(&h->pdev->dev, "cciss: cmd %p is " 3170 dev_warn(&h->pdev->dev, "cciss: cmd %p is "
3171 "reported invalid\n", cmd); 3171 "reported invalid\n", cmd);
3172 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3172 sreq->result = make_status_bytes(SAM_STAT_GOOD,
3173 cmd->err_info->CommandStatus, DRIVER_OK, 3173 cmd->err_info->CommandStatus, DRIVER_OK,
3174 blk_rq_is_passthrough(cmd->rq) ? 3174 blk_rq_is_passthrough(cmd->rq) ?
3175 DID_PASSTHROUGH : DID_ERROR); 3175 DID_PASSTHROUGH : DID_ERROR);
@@ -3177,7 +3177,7 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3177 case CMD_PROTOCOL_ERR: 3177 case CMD_PROTOCOL_ERR:
3178 dev_warn(&h->pdev->dev, "cciss: cmd %p has " 3178 dev_warn(&h->pdev->dev, "cciss: cmd %p has "
3179 "protocol error\n", cmd); 3179 "protocol error\n", cmd);
3180 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3180 sreq->result = make_status_bytes(SAM_STAT_GOOD,
3181 cmd->err_info->CommandStatus, DRIVER_OK, 3181 cmd->err_info->CommandStatus, DRIVER_OK,
3182 blk_rq_is_passthrough(cmd->rq) ? 3182 blk_rq_is_passthrough(cmd->rq) ?
3183 DID_PASSTHROUGH : DID_ERROR); 3183 DID_PASSTHROUGH : DID_ERROR);
@@ -3185,7 +3185,7 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3185 case CMD_HARDWARE_ERR: 3185 case CMD_HARDWARE_ERR:
3186 dev_warn(&h->pdev->dev, "cciss: cmd %p had " 3186 dev_warn(&h->pdev->dev, "cciss: cmd %p had "
3187 " hardware error\n", cmd); 3187 " hardware error\n", cmd);
3188 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3188 sreq->result = make_status_bytes(SAM_STAT_GOOD,
3189 cmd->err_info->CommandStatus, DRIVER_OK, 3189 cmd->err_info->CommandStatus, DRIVER_OK,
3190 blk_rq_is_passthrough(cmd->rq) ? 3190 blk_rq_is_passthrough(cmd->rq) ?
3191 DID_PASSTHROUGH : DID_ERROR); 3191 DID_PASSTHROUGH : DID_ERROR);
@@ -3193,7 +3193,7 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3193 case CMD_CONNECTION_LOST: 3193 case CMD_CONNECTION_LOST:
3194 dev_warn(&h->pdev->dev, "cciss: cmd %p had " 3194 dev_warn(&h->pdev->dev, "cciss: cmd %p had "
3195 "connection lost\n", cmd); 3195 "connection lost\n", cmd);
3196 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3196 sreq->result = make_status_bytes(SAM_STAT_GOOD,
3197 cmd->err_info->CommandStatus, DRIVER_OK, 3197 cmd->err_info->CommandStatus, DRIVER_OK,
3198 blk_rq_is_passthrough(cmd->rq) ? 3198 blk_rq_is_passthrough(cmd->rq) ?
3199 DID_PASSTHROUGH : DID_ERROR); 3199 DID_PASSTHROUGH : DID_ERROR);
@@ -3201,7 +3201,7 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3201 case CMD_ABORTED: 3201 case CMD_ABORTED:
3202 dev_warn(&h->pdev->dev, "cciss: cmd %p was " 3202 dev_warn(&h->pdev->dev, "cciss: cmd %p was "
3203 "aborted\n", cmd); 3203 "aborted\n", cmd);
3204 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3204 sreq->result = make_status_bytes(SAM_STAT_GOOD,
3205 cmd->err_info->CommandStatus, DRIVER_OK, 3205 cmd->err_info->CommandStatus, DRIVER_OK,
3206 blk_rq_is_passthrough(cmd->rq) ? 3206 blk_rq_is_passthrough(cmd->rq) ?
3207 DID_PASSTHROUGH : DID_ABORT); 3207 DID_PASSTHROUGH : DID_ABORT);
@@ -3209,7 +3209,7 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3209 case CMD_ABORT_FAILED: 3209 case CMD_ABORT_FAILED:
3210 dev_warn(&h->pdev->dev, "cciss: cmd %p reports " 3210 dev_warn(&h->pdev->dev, "cciss: cmd %p reports "
3211 "abort failed\n", cmd); 3211 "abort failed\n", cmd);
3212 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3212 sreq->result = make_status_bytes(SAM_STAT_GOOD,
3213 cmd->err_info->CommandStatus, DRIVER_OK, 3213 cmd->err_info->CommandStatus, DRIVER_OK,
3214 blk_rq_is_passthrough(cmd->rq) ? 3214 blk_rq_is_passthrough(cmd->rq) ?
3215 DID_PASSTHROUGH : DID_ERROR); 3215 DID_PASSTHROUGH : DID_ERROR);
@@ -3224,21 +3224,21 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3224 } else 3224 } else
3225 dev_warn(&h->pdev->dev, 3225 dev_warn(&h->pdev->dev,
3226 "%p retried too many times\n", cmd); 3226 "%p retried too many times\n", cmd);
3227 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3227 sreq->result = make_status_bytes(SAM_STAT_GOOD,
3228 cmd->err_info->CommandStatus, DRIVER_OK, 3228 cmd->err_info->CommandStatus, DRIVER_OK,
3229 blk_rq_is_passthrough(cmd->rq) ? 3229 blk_rq_is_passthrough(cmd->rq) ?
3230 DID_PASSTHROUGH : DID_ABORT); 3230 DID_PASSTHROUGH : DID_ABORT);
3231 break; 3231 break;
3232 case CMD_TIMEOUT: 3232 case CMD_TIMEOUT:
3233 dev_warn(&h->pdev->dev, "cmd %p timedout\n", cmd); 3233 dev_warn(&h->pdev->dev, "cmd %p timedout\n", cmd);
3234 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3234 sreq->result = make_status_bytes(SAM_STAT_GOOD,
3235 cmd->err_info->CommandStatus, DRIVER_OK, 3235 cmd->err_info->CommandStatus, DRIVER_OK,
3236 blk_rq_is_passthrough(cmd->rq) ? 3236 blk_rq_is_passthrough(cmd->rq) ?
3237 DID_PASSTHROUGH : DID_ERROR); 3237 DID_PASSTHROUGH : DID_ERROR);
3238 break; 3238 break;
3239 case CMD_UNABORTABLE: 3239 case CMD_UNABORTABLE:
3240 dev_warn(&h->pdev->dev, "cmd %p unabortable\n", cmd); 3240 dev_warn(&h->pdev->dev, "cmd %p unabortable\n", cmd);
3241 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3241 sreq->result = make_status_bytes(SAM_STAT_GOOD,
3242 cmd->err_info->CommandStatus, DRIVER_OK, 3242 cmd->err_info->CommandStatus, DRIVER_OK,
3243 blk_rq_is_passthrough(cmd->rq) ? 3243 blk_rq_is_passthrough(cmd->rq) ?
3244 DID_PASSTHROUGH : DID_ERROR); 3244 DID_PASSTHROUGH : DID_ERROR);
@@ -3247,7 +3247,7 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3247 dev_warn(&h->pdev->dev, "cmd %p returned " 3247 dev_warn(&h->pdev->dev, "cmd %p returned "
3248 "unknown status %x\n", cmd, 3248 "unknown status %x\n", cmd,
3249 cmd->err_info->CommandStatus); 3249 cmd->err_info->CommandStatus);
3250 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3250 sreq->result = make_status_bytes(SAM_STAT_GOOD,
3251 cmd->err_info->CommandStatus, DRIVER_OK, 3251 cmd->err_info->CommandStatus, DRIVER_OK,
3252 blk_rq_is_passthrough(cmd->rq) ? 3252 blk_rq_is_passthrough(cmd->rq) ?
3253 DID_PASSTHROUGH : DID_ERROR); 3253 DID_PASSTHROUGH : DID_ERROR);
@@ -3380,9 +3380,9 @@ static void do_cciss_request(struct request_queue *q)
3380 if (dma_mapping_error(&h->pdev->dev, temp64.val)) { 3380 if (dma_mapping_error(&h->pdev->dev, temp64.val)) {
3381 dev_warn(&h->pdev->dev, 3381 dev_warn(&h->pdev->dev,
3382 "%s: error mapping page for DMA\n", __func__); 3382 "%s: error mapping page for DMA\n", __func__);
3383 creq->errors = make_status_bytes(SAM_STAT_GOOD, 3383 scsi_req(creq)->result =
3384 0, DRIVER_OK, 3384 make_status_bytes(SAM_STAT_GOOD, 0, DRIVER_OK,
3385 DID_SOFT_ERROR); 3385 DID_SOFT_ERROR);
3386 cmd_free(h, c); 3386 cmd_free(h, c);
3387 return; 3387 return;
3388 } 3388 }
@@ -3395,9 +3395,9 @@ static void do_cciss_request(struct request_queue *q)
3395 if (cciss_map_sg_chain_block(h, c, h->cmd_sg_list[c->cmdindex], 3395 if (cciss_map_sg_chain_block(h, c, h->cmd_sg_list[c->cmdindex],
3396 (seg - (h->max_cmd_sgentries - 1)) * 3396 (seg - (h->max_cmd_sgentries - 1)) *
3397 sizeof(SGDescriptor_struct))) { 3397 sizeof(SGDescriptor_struct))) {
3398 creq->errors = make_status_bytes(SAM_STAT_GOOD, 3398 scsi_req(creq)->result =
3399 0, DRIVER_OK, 3399 make_status_bytes(SAM_STAT_GOOD, 0, DRIVER_OK,
3400 DID_SOFT_ERROR); 3400 DID_SOFT_ERROR);
3401 cmd_free(h, c); 3401 cmd_free(h, c);
3402 return; 3402 return;
3403 } 3403 }
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 66d846ba85a9..205b865ebeb9 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -724,7 +724,7 @@ static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command *
724 rq->rq_flags |= RQF_QUIET; 724 rq->rq_flags |= RQF_QUIET;
725 725
726 blk_execute_rq(rq->q, pd->bdev->bd_disk, rq, 0); 726 blk_execute_rq(rq->q, pd->bdev->bd_disk, rq, 0);
727 if (rq->errors) 727 if (scsi_req(rq)->result)
728 ret = -EIO; 728 ret = -EIO;
729out: 729out:
730 blk_put_request(rq); 730 blk_put_request(rq);
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 8378ad480f77..dea2a58d6734 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -119,7 +119,7 @@ static inline void virtblk_scsi_request_done(struct request *req)
119 119
120 sreq->resid_len = virtio32_to_cpu(vblk->vdev, vbr->in_hdr.residual); 120 sreq->resid_len = virtio32_to_cpu(vblk->vdev, vbr->in_hdr.residual);
121 sreq->sense_len = virtio32_to_cpu(vblk->vdev, vbr->in_hdr.sense_len); 121 sreq->sense_len = virtio32_to_cpu(vblk->vdev, vbr->in_hdr.sense_len);
122 req->errors = virtio32_to_cpu(vblk->vdev, vbr->in_hdr.errors); 122 sreq->result = virtio32_to_cpu(vblk->vdev, vbr->in_hdr.errors);
123} 123}
124 124
125static int virtblk_ioctl(struct block_device *bdev, fmode_t mode, 125static int virtblk_ioctl(struct block_device *bdev, fmode_t mode,
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 308501730ab3..76c952fd9ab9 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -2219,7 +2219,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf,
2219 bio = rq->bio; 2219 bio = rq->bio;
2220 2220
2221 blk_execute_rq(q, cdi->disk, rq, 0); 2221 blk_execute_rq(q, cdi->disk, rq, 0);
2222 if (rq->errors) { 2222 if (scsi_req(rq)->result) {
2223 struct request_sense *s = req->sense; 2223 struct request_sense *s = req->sense;
2224 ret = -EIO; 2224 ret = -EIO;
2225 cdi->last_sense = s->sense_key; 2225 cdi->last_sense = s->sense_key;
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index 1524797e1776..5901937284e7 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -108,7 +108,7 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk,
108 if (drive->media == ide_tape) 108 if (drive->media == ide_tape)
109 scsi_req(rq)->cmd[13] = REQ_IDETAPE_PC1; 109 scsi_req(rq)->cmd[13] = REQ_IDETAPE_PC1;
110 blk_execute_rq(drive->queue, disk, rq, 0); 110 blk_execute_rq(drive->queue, disk, rq, 0);
111 error = rq->errors ? -EIO : 0; 111 error = scsi_req(rq)->result ? -EIO : 0;
112put_req: 112put_req:
113 blk_put_request(rq); 113 blk_put_request(rq);
114 return error; 114 return error;
@@ -455,7 +455,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
455 debug_log("%s: I/O error\n", drive->name); 455 debug_log("%s: I/O error\n", drive->name);
456 456
457 if (drive->media != ide_tape) 457 if (drive->media != ide_tape)
458 pc->rq->errors++; 458 scsi_req(pc->rq)->result++;
459 459
460 if (scsi_req(rq)->cmd[0] == REQUEST_SENSE) { 460 if (scsi_req(rq)->cmd[0] == REQUEST_SENSE) {
461 printk(KERN_ERR PFX "%s: I/O error in request " 461 printk(KERN_ERR PFX "%s: I/O error in request "
@@ -489,13 +489,13 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
489 drive->failed_pc = NULL; 489 drive->failed_pc = NULL;
490 490
491 if (ata_misc_request(rq)) { 491 if (ata_misc_request(rq)) {
492 rq->errors = 0; 492 scsi_req(rq)->result = 0;
493 error = 0; 493 error = 0;
494 } else { 494 } else {
495 495
496 if (blk_rq_is_passthrough(rq) && uptodate <= 0) { 496 if (blk_rq_is_passthrough(rq) && uptodate <= 0) {
497 if (rq->errors == 0) 497 if (scsi_req(rq)->result == 0)
498 rq->errors = -EIO; 498 scsi_req(rq)->result = -EIO;
499 } 499 }
500 500
501 error = uptodate ? 0 : -EIO; 501 error = uptodate ? 0 : -EIO;
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 95c40afa9120..07e5ff3a64c3 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -247,10 +247,10 @@ static int ide_cd_breathe(ide_drive_t *drive, struct request *rq)
247 247
248 struct cdrom_info *info = drive->driver_data; 248 struct cdrom_info *info = drive->driver_data;
249 249
250 if (!rq->errors) 250 if (!scsi_req(rq)->result)
251 info->write_timeout = jiffies + ATAPI_WAIT_WRITE_BUSY; 251 info->write_timeout = jiffies + ATAPI_WAIT_WRITE_BUSY;
252 252
253 rq->errors = 1; 253 scsi_req(rq)->result = 1;
254 254
255 if (time_after(jiffies, info->write_timeout)) 255 if (time_after(jiffies, info->write_timeout))
256 return 0; 256 return 0;
@@ -294,8 +294,8 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
294 } 294 }
295 295
296 /* if we have an error, pass CHECK_CONDITION as the SCSI status byte */ 296 /* if we have an error, pass CHECK_CONDITION as the SCSI status byte */
297 if (blk_rq_is_scsi(rq) && !rq->errors) 297 if (blk_rq_is_scsi(rq) && !scsi_req(rq)->result)
298 rq->errors = SAM_STAT_CHECK_CONDITION; 298 scsi_req(rq)->result = SAM_STAT_CHECK_CONDITION;
299 299
300 if (blk_noretry_request(rq)) 300 if (blk_noretry_request(rq))
301 do_end_request = 1; 301 do_end_request = 1;
@@ -325,7 +325,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
325 * Arrange to retry the request but be sure to give up if we've 325 * Arrange to retry the request but be sure to give up if we've
326 * retried too many times. 326 * retried too many times.
327 */ 327 */
328 if (++rq->errors > ERROR_MAX) 328 if (++scsi_req(rq)->result > ERROR_MAX)
329 do_end_request = 1; 329 do_end_request = 1;
330 break; 330 break;
331 case ILLEGAL_REQUEST: 331 case ILLEGAL_REQUEST:
@@ -372,7 +372,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
372 /* go to the default handler for other errors */ 372 /* go to the default handler for other errors */
373 ide_error(drive, "cdrom_decode_status", stat); 373 ide_error(drive, "cdrom_decode_status", stat);
374 return 1; 374 return 1;
375 } else if (++rq->errors > ERROR_MAX) 375 } else if (++scsi_req(rq)->result > ERROR_MAX)
376 /* we've racked up too many retries, abort */ 376 /* we've racked up too many retries, abort */
377 do_end_request = 1; 377 do_end_request = 1;
378 } 378 }
@@ -453,7 +453,7 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
453 } 453 }
454 454
455 blk_execute_rq(drive->queue, info->disk, rq, 0); 455 blk_execute_rq(drive->queue, info->disk, rq, 0);
456 error = rq->errors ? -EIO : 0; 456 error = scsi_req(rq)->result ? -EIO : 0;
457 457
458 if (buffer) 458 if (buffer)
459 *bufflen = scsi_req(rq)->resid_len; 459 *bufflen = scsi_req(rq)->resid_len;
@@ -684,8 +684,8 @@ out_end:
684 if (cmd->nleft == 0) 684 if (cmd->nleft == 0)
685 uptodate = 1; 685 uptodate = 1;
686 } else { 686 } else {
687 if (uptodate <= 0 && rq->errors == 0) 687 if (uptodate <= 0 && scsi_req(rq)->result == 0)
688 rq->errors = -EIO; 688 scsi_req(rq)->result = -EIO;
689 } 689 }
690 690
691 if (uptodate == 0 && rq->bio) 691 if (uptodate == 0 && rq->bio)
@@ -1380,7 +1380,7 @@ static int ide_cdrom_prep_pc(struct request *rq)
1380 * appropriate action 1380 * appropriate action
1381 */ 1381 */
1382 if (c[0] == MODE_SENSE || c[0] == MODE_SELECT) { 1382 if (c[0] == MODE_SENSE || c[0] == MODE_SELECT) {
1383 rq->errors = ILLEGAL_REQUEST; 1383 scsi_req(rq)->result = ILLEGAL_REQUEST;
1384 return BLKPREP_KILL; 1384 return BLKPREP_KILL;
1385 } 1385 }
1386 1386
diff --git a/drivers/ide/ide-cd_ioctl.c b/drivers/ide/ide-cd_ioctl.c
index f1ab726bd430..55cd736c39c6 100644
--- a/drivers/ide/ide-cd_ioctl.c
+++ b/drivers/ide/ide-cd_ioctl.c
@@ -308,7 +308,7 @@ int ide_cdrom_reset(struct cdrom_device_info *cdi)
308 ide_req(rq)->type = ATA_PRIV_MISC; 308 ide_req(rq)->type = ATA_PRIV_MISC;
309 rq->rq_flags = RQF_QUIET; 309 rq->rq_flags = RQF_QUIET;
310 blk_execute_rq(drive->queue, cd->disk, rq, 0); 310 blk_execute_rq(drive->queue, cd->disk, rq, 0);
311 ret = rq->errors ? -EIO : 0; 311 ret = scsi_req(rq)->result ? -EIO : 0;
312 blk_put_request(rq); 312 blk_put_request(rq);
313 /* 313 /*
314 * A reset will unlock the door. If it was previously locked, 314 * A reset will unlock the door. If it was previously locked,
diff --git a/drivers/ide/ide-devsets.c b/drivers/ide/ide-devsets.c
index eea6a7cb80b5..b1223234037d 100644
--- a/drivers/ide/ide-devsets.c
+++ b/drivers/ide/ide-devsets.c
@@ -174,7 +174,7 @@ int ide_devset_execute(ide_drive_t *drive, const struct ide_devset *setting,
174 rq->special = setting->set; 174 rq->special = setting->set;
175 175
176 blk_execute_rq(q, NULL, rq, 0); 176 blk_execute_rq(q, NULL, rq, 0);
177 ret = rq->errors; 177 ret = scsi_req(rq)->result;
178 blk_put_request(rq); 178 blk_put_request(rq);
179 179
180 return ret; 180 return ret;
@@ -186,7 +186,7 @@ ide_startstop_t ide_do_devset(ide_drive_t *drive, struct request *rq)
186 186
187 err = setfunc(drive, *(int *)&scsi_req(rq)->cmd[1]); 187 err = setfunc(drive, *(int *)&scsi_req(rq)->cmd[1]);
188 if (err) 188 if (err)
189 rq->errors = err; 189 scsi_req(rq)->result = err;
190 ide_complete_rq(drive, err, blk_rq_bytes(rq)); 190 ide_complete_rq(drive, err, blk_rq_bytes(rq));
191 return ide_stopped; 191 return ide_stopped;
192} 192}
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 17a65ac56491..51c81223e56d 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -490,7 +490,7 @@ ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error)
490 * make sure request is sane 490 * make sure request is sane
491 */ 491 */
492 if (hwif->rq) 492 if (hwif->rq)
493 hwif->rq->errors = 0; 493 scsi_req(hwif->rq)->result = 0;
494 return ret; 494 return ret;
495} 495}
496 496
diff --git a/drivers/ide/ide-eh.c b/drivers/ide/ide-eh.c
index cf3af6840368..4b7ffd7d158d 100644
--- a/drivers/ide/ide-eh.c
+++ b/drivers/ide/ide-eh.c
@@ -12,7 +12,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq,
12 if ((stat & ATA_BUSY) || 12 if ((stat & ATA_BUSY) ||
13 ((stat & ATA_DF) && (drive->dev_flags & IDE_DFLAG_NOWERR) == 0)) { 13 ((stat & ATA_DF) && (drive->dev_flags & IDE_DFLAG_NOWERR) == 0)) {
14 /* other bits are useless when BUSY */ 14 /* other bits are useless when BUSY */
15 rq->errors |= ERROR_RESET; 15 scsi_req(rq)->result |= ERROR_RESET;
16 } else if (stat & ATA_ERR) { 16 } else if (stat & ATA_ERR) {
17 /* err has different meaning on cdrom and tape */ 17 /* err has different meaning on cdrom and tape */
18 if (err == ATA_ABORTED) { 18 if (err == ATA_ABORTED) {
@@ -25,10 +25,10 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq,
25 drive->crc_count++; 25 drive->crc_count++;
26 } else if (err & (ATA_BBK | ATA_UNC)) { 26 } else if (err & (ATA_BBK | ATA_UNC)) {
27 /* retries won't help these */ 27 /* retries won't help these */
28 rq->errors = ERROR_MAX; 28 scsi_req(rq)->result = ERROR_MAX;
29 } else if (err & ATA_TRK0NF) { 29 } else if (err & ATA_TRK0NF) {
30 /* help it find track zero */ 30 /* help it find track zero */
31 rq->errors |= ERROR_RECAL; 31 scsi_req(rq)->result |= ERROR_RECAL;
32 } 32 }
33 } 33 }
34 34
@@ -39,23 +39,23 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq,
39 ide_pad_transfer(drive, READ, nsect * SECTOR_SIZE); 39 ide_pad_transfer(drive, READ, nsect * SECTOR_SIZE);
40 } 40 }
41 41
42 if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) { 42 if (scsi_req(rq)->result >= ERROR_MAX || blk_noretry_request(rq)) {
43 ide_kill_rq(drive, rq); 43 ide_kill_rq(drive, rq);
44 return ide_stopped; 44 return ide_stopped;
45 } 45 }
46 46
47 if (hwif->tp_ops->read_status(hwif) & (ATA_BUSY | ATA_DRQ)) 47 if (hwif->tp_ops->read_status(hwif) & (ATA_BUSY | ATA_DRQ))
48 rq->errors |= ERROR_RESET; 48 scsi_req(rq)->result |= ERROR_RESET;
49 49
50 if ((rq->errors & ERROR_RESET) == ERROR_RESET) { 50 if ((scsi_req(rq)->result & ERROR_RESET) == ERROR_RESET) {
51 ++rq->errors; 51 ++scsi_req(rq)->result;
52 return ide_do_reset(drive); 52 return ide_do_reset(drive);
53 } 53 }
54 54
55 if ((rq->errors & ERROR_RECAL) == ERROR_RECAL) 55 if ((scsi_req(rq)->result & ERROR_RECAL) == ERROR_RECAL)
56 drive->special_flags |= IDE_SFLAG_RECALIBRATE; 56 drive->special_flags |= IDE_SFLAG_RECALIBRATE;
57 57
58 ++rq->errors; 58 ++scsi_req(rq)->result;
59 59
60 return ide_stopped; 60 return ide_stopped;
61} 61}
@@ -68,7 +68,7 @@ static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq,
68 if ((stat & ATA_BUSY) || 68 if ((stat & ATA_BUSY) ||
69 ((stat & ATA_DF) && (drive->dev_flags & IDE_DFLAG_NOWERR) == 0)) { 69 ((stat & ATA_DF) && (drive->dev_flags & IDE_DFLAG_NOWERR) == 0)) {
70 /* other bits are useless when BUSY */ 70 /* other bits are useless when BUSY */
71 rq->errors |= ERROR_RESET; 71 scsi_req(rq)->result |= ERROR_RESET;
72 } else { 72 } else {
73 /* add decoding error stuff */ 73 /* add decoding error stuff */
74 } 74 }
@@ -77,14 +77,14 @@ static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq,
77 /* force an abort */ 77 /* force an abort */
78 hwif->tp_ops->exec_command(hwif, ATA_CMD_IDLEIMMEDIATE); 78 hwif->tp_ops->exec_command(hwif, ATA_CMD_IDLEIMMEDIATE);
79 79
80 if (rq->errors >= ERROR_MAX) { 80 if (scsi_req(rq)->result >= ERROR_MAX) {
81 ide_kill_rq(drive, rq); 81 ide_kill_rq(drive, rq);
82 } else { 82 } else {
83 if ((rq->errors & ERROR_RESET) == ERROR_RESET) { 83 if ((scsi_req(rq)->result & ERROR_RESET) == ERROR_RESET) {
84 ++rq->errors; 84 ++scsi_req(rq)->result;
85 return ide_do_reset(drive); 85 return ide_do_reset(drive);
86 } 86 }
87 ++rq->errors; 87 ++scsi_req(rq)->result;
88 } 88 }
89 89
90 return ide_stopped; 90 return ide_stopped;
@@ -130,11 +130,11 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat)
130 if (cmd) 130 if (cmd)
131 ide_complete_cmd(drive, cmd, stat, err); 131 ide_complete_cmd(drive, cmd, stat, err);
132 } else if (ata_pm_request(rq)) { 132 } else if (ata_pm_request(rq)) {
133 rq->errors = 1; 133 scsi_req(rq)->result = 1;
134 ide_complete_pm_rq(drive, rq); 134 ide_complete_pm_rq(drive, rq);
135 return ide_stopped; 135 return ide_stopped;
136 } 136 }
137 rq->errors = err; 137 scsi_req(rq)->result = err;
138 ide_complete_rq(drive, err ? -EIO : 0, blk_rq_bytes(rq)); 138 ide_complete_rq(drive, err ? -EIO : 0, blk_rq_bytes(rq));
139 return ide_stopped; 139 return ide_stopped;
140 } 140 }
@@ -149,8 +149,8 @@ static inline void ide_complete_drive_reset(ide_drive_t *drive, int err)
149 149
150 if (rq && ata_misc_request(rq) && 150 if (rq && ata_misc_request(rq) &&
151 scsi_req(rq)->cmd[0] == REQ_DRIVE_RESET) { 151 scsi_req(rq)->cmd[0] == REQ_DRIVE_RESET) {
152 if (err <= 0 && rq->errors == 0) 152 if (err <= 0 && scsi_req(rq)->result == 0)
153 rq->errors = -EIO; 153 scsi_req(rq)->result = -EIO;
154 ide_complete_rq(drive, err ? err : 0, blk_rq_bytes(rq)); 154 ide_complete_rq(drive, err ? err : 0, blk_rq_bytes(rq));
155 } 155 }
156} 156}
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index a69e8013f1df..8ac6048cd2df 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -98,7 +98,7 @@ static int ide_floppy_callback(ide_drive_t *drive, int dsc)
98 } 98 }
99 99
100 if (ata_misc_request(rq)) 100 if (ata_misc_request(rq))
101 rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL; 101 scsi_req(rq)->result = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
102 102
103 return uptodate; 103 return uptodate;
104} 104}
@@ -239,7 +239,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
239 ? rq->rq_disk->disk_name 239 ? rq->rq_disk->disk_name
240 : "dev?")); 240 : "dev?"));
241 241
242 if (rq->errors >= ERROR_MAX) { 242 if (scsi_req(rq)->result >= ERROR_MAX) {
243 if (drive->failed_pc) { 243 if (drive->failed_pc) {
244 ide_floppy_report_error(floppy, drive->failed_pc); 244 ide_floppy_report_error(floppy, drive->failed_pc);
245 drive->failed_pc = NULL; 245 drive->failed_pc = NULL;
@@ -247,7 +247,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
247 printk(KERN_ERR PFX "%s: I/O error\n", drive->name); 247 printk(KERN_ERR PFX "%s: I/O error\n", drive->name);
248 248
249 if (ata_misc_request(rq)) { 249 if (ata_misc_request(rq)) {
250 rq->errors = 0; 250 scsi_req(rq)->result = 0;
251 ide_complete_rq(drive, 0, blk_rq_bytes(rq)); 251 ide_complete_rq(drive, 0, blk_rq_bytes(rq));
252 return ide_stopped; 252 return ide_stopped;
253 } else 253 } else
@@ -301,8 +301,8 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
301 return ide_floppy_issue_pc(drive, &cmd, pc); 301 return ide_floppy_issue_pc(drive, &cmd, pc);
302out_end: 302out_end:
303 drive->failed_pc = NULL; 303 drive->failed_pc = NULL;
304 if (blk_rq_is_passthrough(rq) && rq->errors == 0) 304 if (blk_rq_is_passthrough(rq) && scsi_req(rq)->result == 0)
305 rq->errors = -EIO; 305 scsi_req(rq)->result = -EIO;
306 ide_complete_rq(drive, -EIO, blk_rq_bytes(rq)); 306 ide_complete_rq(drive, -EIO, blk_rq_bytes(rq));
307 return ide_stopped; 307 return ide_stopped;
308} 308}
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 043b1fb963cb..45b3f41a43d4 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -141,12 +141,12 @@ void ide_kill_rq(ide_drive_t *drive, struct request *rq)
141 drive->failed_pc = NULL; 141 drive->failed_pc = NULL;
142 142
143 if ((media == ide_floppy || media == ide_tape) && drv_req) { 143 if ((media == ide_floppy || media == ide_tape) && drv_req) {
144 rq->errors = 0; 144 scsi_req(rq)->result = 0;
145 } else { 145 } else {
146 if (media == ide_tape) 146 if (media == ide_tape)
147 rq->errors = IDE_DRV_ERROR_GENERAL; 147 scsi_req(rq)->result = IDE_DRV_ERROR_GENERAL;
148 else if (blk_rq_is_passthrough(rq) && rq->errors == 0) 148 else if (blk_rq_is_passthrough(rq) && scsi_req(rq)->result == 0)
149 rq->errors = -EIO; 149 scsi_req(rq)->result = -EIO;
150 } 150 }
151 151
152 ide_complete_rq(drive, -EIO, blk_rq_bytes(rq)); 152 ide_complete_rq(drive, -EIO, blk_rq_bytes(rq));
@@ -271,7 +271,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
271#ifdef DEBUG 271#ifdef DEBUG
272 printk("%s: DRIVE_CMD (null)\n", drive->name); 272 printk("%s: DRIVE_CMD (null)\n", drive->name);
273#endif 273#endif
274 rq->errors = 0; 274 scsi_req(rq)->result = 0;
275 ide_complete_rq(drive, 0, blk_rq_bytes(rq)); 275 ide_complete_rq(drive, 0, blk_rq_bytes(rq));
276 276
277 return ide_stopped; 277 return ide_stopped;
diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c
index 3e96e531b367..8c0d17297a7a 100644
--- a/drivers/ide/ide-ioctls.c
+++ b/drivers/ide/ide-ioctls.c
@@ -129,7 +129,7 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
129 scsi_req_init(rq); 129 scsi_req_init(rq);
130 ide_req(rq)->type = ATA_PRIV_TASKFILE; 130 ide_req(rq)->type = ATA_PRIV_TASKFILE;
131 blk_execute_rq(drive->queue, NULL, rq, 0); 131 blk_execute_rq(drive->queue, NULL, rq, 0);
132 err = rq->errors ? -EIO : 0; 132 err = scsi_req(rq)->result ? -EIO : 0;
133 blk_put_request(rq); 133 blk_put_request(rq);
134 134
135 return err; 135 return err;
@@ -229,7 +229,7 @@ static int generic_drive_reset(ide_drive_t *drive)
229 scsi_req(rq)->cmd_len = 1; 229 scsi_req(rq)->cmd_len = 1;
230 scsi_req(rq)->cmd[0] = REQ_DRIVE_RESET; 230 scsi_req(rq)->cmd[0] = REQ_DRIVE_RESET;
231 blk_execute_rq(drive->queue, NULL, rq, 1); 231 blk_execute_rq(drive->queue, NULL, rq, 1);
232 ret = rq->errors; 232 ret = scsi_req(rq)->result;
233 blk_put_request(rq); 233 blk_put_request(rq);
234 return ret; 234 return ret;
235} 235}
diff --git a/drivers/ide/ide-park.c b/drivers/ide/ide-park.c
index b4f577016f5a..94e3107f59b9 100644
--- a/drivers/ide/ide-park.c
+++ b/drivers/ide/ide-park.c
@@ -38,7 +38,7 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout)
38 ide_req(rq)->type = ATA_PRIV_MISC; 38 ide_req(rq)->type = ATA_PRIV_MISC;
39 rq->special = &timeout; 39 rq->special = &timeout;
40 blk_execute_rq(q, NULL, rq, 1); 40 blk_execute_rq(q, NULL, rq, 1);
41 rc = rq->errors ? -EIO : 0; 41 rc = scsi_req(rq)->result ? -EIO : 0;
42 blk_put_request(rq); 42 blk_put_request(rq);
43 if (rc) 43 if (rc)
44 goto out; 44 goto out;
diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c
index bf513f886f3c..277c2bb7616f 100644
--- a/drivers/ide/ide-pm.c
+++ b/drivers/ide/ide-pm.c
@@ -28,7 +28,7 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg)
28 rqpm.pm_state = mesg.event; 28 rqpm.pm_state = mesg.event;
29 29
30 blk_execute_rq(drive->queue, NULL, rq, 0); 30 blk_execute_rq(drive->queue, NULL, rq, 0);
31 ret = rq->errors ? -EIO : 0; 31 ret = scsi_req(rq)->result ? -EIO : 0;
32 blk_put_request(rq); 32 blk_put_request(rq);
33 33
34 if (ret == 0 && ide_port_acpi(hwif)) { 34 if (ret == 0 && ide_port_acpi(hwif)) {
@@ -56,8 +56,8 @@ static int ide_pm_execute_rq(struct request *rq)
56 spin_lock_irq(q->queue_lock); 56 spin_lock_irq(q->queue_lock);
57 if (unlikely(blk_queue_dying(q))) { 57 if (unlikely(blk_queue_dying(q))) {
58 rq->rq_flags |= RQF_QUIET; 58 rq->rq_flags |= RQF_QUIET;
59 rq->errors = -ENXIO; 59 scsi_req(rq)->result = -ENXIO;
60 __blk_end_request_all(rq, rq->errors); 60 __blk_end_request_all(rq, scsi_req(rq)->result);
61 spin_unlock_irq(q->queue_lock); 61 spin_unlock_irq(q->queue_lock);
62 return -ENXIO; 62 return -ENXIO;
63 } 63 }
@@ -67,7 +67,7 @@ static int ide_pm_execute_rq(struct request *rq)
67 67
68 wait_for_completion_io(&wait); 68 wait_for_completion_io(&wait);
69 69
70 return rq->errors ? -EIO : 0; 70 return scsi_req(rq)->result ? -EIO : 0;
71} 71}
72 72
73int generic_ide_resume(struct device *dev) 73int generic_ide_resume(struct device *dev)
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index d8a552b47718..a0651f948b76 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -366,7 +366,7 @@ static int ide_tape_callback(ide_drive_t *drive, int dsc)
366 err = pc->error; 366 err = pc->error;
367 } 367 }
368 } 368 }
369 rq->errors = err; 369 scsi_req(rq)->result = err;
370 370
371 return uptodate; 371 return uptodate;
372} 372}
@@ -879,7 +879,7 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int size)
879 tape->valid = 0; 879 tape->valid = 0;
880 880
881 ret = size; 881 ret = size;
882 if (rq->errors == IDE_DRV_ERROR_GENERAL) 882 if (scsi_req(rq)->result == IDE_DRV_ERROR_GENERAL)
883 ret = -EIO; 883 ret = -EIO;
884out_put: 884out_put:
885 blk_put_request(rq); 885 blk_put_request(rq);
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 78924c7c9478..d71199d23c9e 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -287,7 +287,7 @@ static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd,
287 u8 saved_io_32bit = drive->io_32bit; 287 u8 saved_io_32bit = drive->io_32bit;
288 288
289 if (cmd->tf_flags & IDE_TFLAG_FS) 289 if (cmd->tf_flags & IDE_TFLAG_FS)
290 cmd->rq->errors = 0; 290 scsi_req(cmd->rq)->result = 0;
291 291
292 if (cmd->tf_flags & IDE_TFLAG_IO_16BIT) 292 if (cmd->tf_flags & IDE_TFLAG_IO_16BIT)
293 drive->io_32bit = 0; 293 drive->io_32bit = 0;
@@ -329,7 +329,7 @@ void ide_finish_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat)
329 u8 set_xfer = !!(cmd->tf_flags & IDE_TFLAG_SET_XFER); 329 u8 set_xfer = !!(cmd->tf_flags & IDE_TFLAG_SET_XFER);
330 330
331 ide_complete_cmd(drive, cmd, stat, err); 331 ide_complete_cmd(drive, cmd, stat, err);
332 rq->errors = err; 332 scsi_req(rq)->result = err;
333 333
334 if (err == 0 && set_xfer) { 334 if (err == 0 && set_xfer) {
335 ide_set_xfer_rate(drive, nsect); 335 ide_set_xfer_rate(drive, nsect);
@@ -453,7 +453,7 @@ int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf,
453 cmd->rq = rq; 453 cmd->rq = rq;
454 454
455 blk_execute_rq(drive->queue, NULL, rq, 0); 455 blk_execute_rq(drive->queue, NULL, rq, 0);
456 error = rq->errors ? -EIO : 0; 456 error = scsi_req(rq)->result ? -EIO : 0;
457put_req: 457put_req:
458 blk_put_request(rq); 458 blk_put_request(rq);
459 return error; 459 return error;
diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c
index 5eeab7047d1e..8a1b94816419 100644
--- a/drivers/scsi/osd/osd_initiator.c
+++ b/drivers/scsi/osd/osd_initiator.c
@@ -477,7 +477,7 @@ static void _set_error_resid(struct osd_request *or, struct request *req,
477 int error) 477 int error)
478{ 478{
479 or->async_error = error; 479 or->async_error = error;
480 or->req_errors = req->errors ? : error; 480 or->req_errors = scsi_req(req)->result ? : error;
481 or->sense_len = scsi_req(req)->sense_len; 481 or->sense_len = scsi_req(req)->sense_len;
482 if (or->sense_len) 482 if (or->sense_len)
483 memcpy(or->sense, scsi_req(req)->sense, or->sense_len); 483 memcpy(or->sense, scsi_req(req)->sense, or->sense_len);
@@ -492,7 +492,7 @@ int osd_execute_request(struct osd_request *or)
492 int error; 492 int error;
493 493
494 blk_execute_rq(or->request->q, NULL, or->request, 0); 494 blk_execute_rq(or->request->q, NULL, or->request, 0);
495 error = or->request->errors ? -EIO : 0; 495 error = scsi_req(or->request)->result ? -EIO : 0;
496 496
497 _set_error_resid(or, or->request, error); 497 _set_error_resid(or, or->request, error);
498 return error; 498 return error;
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 41bc1d64bf86..67cbed92f07d 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -327,7 +327,7 @@ static void osst_end_async(struct request *req, int update)
327 struct osst_tape *STp = SRpnt->stp; 327 struct osst_tape *STp = SRpnt->stp;
328 struct rq_map_data *mdata = &SRpnt->stp->buffer->map_data; 328 struct rq_map_data *mdata = &SRpnt->stp->buffer->map_data;
329 329
330 STp->buffer->cmdstat.midlevel_result = SRpnt->result = req->errors; 330 STp->buffer->cmdstat.midlevel_result = SRpnt->result = rq->result;
331#if DEBUG 331#if DEBUG
332 STp->write_pending = 0; 332 STp->write_pending = 0;
333#endif 333#endif
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 84c9098cc089..b6e40fd4c3c1 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -2553,13 +2553,13 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_job)
2553 ql_log(ql_log_warn, vha, 0x7089, 2553 ql_log(ql_log_warn, vha, 0x7089,
2554 "mbx abort_command " 2554 "mbx abort_command "
2555 "failed.\n"); 2555 "failed.\n");
2556 bsg_job->req->errors = 2556 scsi_req(bsg_job->req)->result =
2557 bsg_reply->result = -EIO; 2557 bsg_reply->result = -EIO;
2558 } else { 2558 } else {
2559 ql_dbg(ql_dbg_user, vha, 0x708a, 2559 ql_dbg(ql_dbg_user, vha, 0x708a,
2560 "mbx abort_command " 2560 "mbx abort_command "
2561 "success.\n"); 2561 "success.\n");
2562 bsg_job->req->errors = 2562 scsi_req(bsg_job->req)->result =
2563 bsg_reply->result = 0; 2563 bsg_reply->result = 0;
2564 } 2564 }
2565 spin_lock_irqsave(&ha->hardware_lock, flags); 2565 spin_lock_irqsave(&ha->hardware_lock, flags);
@@ -2570,7 +2570,7 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_job)
2570 } 2570 }
2571 spin_unlock_irqrestore(&ha->hardware_lock, flags); 2571 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2572 ql_log(ql_log_info, vha, 0x708b, "SRB not found to abort.\n"); 2572 ql_log(ql_log_info, vha, 0x708b, "SRB not found to abort.\n");
2573 bsg_job->req->errors = bsg_reply->result = -ENXIO; 2573 scsi_req(bsg_job->req)->result = bsg_reply->result = -ENXIO;
2574 return 0; 2574 return 0;
2575 2575
2576done: 2576done:
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 7bc4513bf4e4..b9298a499e19 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -229,8 +229,8 @@ void scsi_queue_insert(struct scsi_cmnd *cmd, int reason)
229 * @rq_flags: flags for ->rq_flags 229 * @rq_flags: flags for ->rq_flags
230 * @resid: optional residual length 230 * @resid: optional residual length
231 * 231 *
232 * returns the req->errors value which is the scsi_cmnd result 232 * Returns the scsi_cmnd result field if a command was executed, or a negative
233 * field. 233 * Linux error code if we didn't get that far.
234 */ 234 */
235int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, 235int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
236 int data_direction, void *buffer, unsigned bufflen, 236 int data_direction, void *buffer, unsigned bufflen,
@@ -281,7 +281,7 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
281 memcpy(sense, rq->sense, SCSI_SENSE_BUFFERSIZE); 281 memcpy(sense, rq->sense, SCSI_SENSE_BUFFERSIZE);
282 if (sshdr) 282 if (sshdr)
283 scsi_normalize_sense(rq->sense, rq->sense_len, sshdr); 283 scsi_normalize_sense(rq->sense, rq->sense_len, sshdr);
284 ret = req->errors; 284 ret = rq->result;
285 out: 285 out:
286 blk_put_request(req); 286 blk_put_request(req);
287 287
@@ -797,8 +797,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
797 /* 797 /*
798 * __scsi_error_from_host_byte may have reset the host_byte 798 * __scsi_error_from_host_byte may have reset the host_byte
799 */ 799 */
800 req->errors = cmd->result; 800 scsi_req(req)->result = cmd->result;
801
802 scsi_req(req)->resid_len = scsi_get_resid(cmd); 801 scsi_req(req)->resid_len = scsi_get_resid(cmd);
803 802
804 if (scsi_bidi_cmnd(cmd)) { 803 if (scsi_bidi_cmnd(cmd)) {
@@ -835,7 +834,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
835 /* 834 /*
836 * Recovered errors need reporting, but they're always treated as 835 * Recovered errors need reporting, but they're always treated as
837 * success, so fiddle the result code here. For passthrough requests 836 * success, so fiddle the result code here. For passthrough requests
838 * we already took a copy of the original into rq->errors which 837 * we already took a copy of the original into sreq->result which
839 * is what gets returned to the user 838 * is what gets returned to the user
840 */ 839 */
841 if (sense_valid && (sshdr.sense_key == RECOVERED_ERROR)) { 840 if (sense_valid && (sshdr.sense_key == RECOVERED_ERROR)) {
@@ -1281,7 +1280,7 @@ scsi_prep_return(struct request_queue *q, struct request *req, int ret)
1281 switch (ret) { 1280 switch (ret) {
1282 case BLKPREP_KILL: 1281 case BLKPREP_KILL:
1283 case BLKPREP_INVALID: 1282 case BLKPREP_INVALID:
1284 req->errors = DID_NO_CONNECT << 16; 1283 scsi_req(req)->result = DID_NO_CONNECT << 16;
1285 /* release the command and kill it */ 1284 /* release the command and kill it */
1286 if (req->special) { 1285 if (req->special) {
1287 struct scsi_cmnd *cmd = req->special; 1286 struct scsi_cmnd *cmd = req->special;
@@ -1905,7 +1904,7 @@ static int scsi_mq_prep_fn(struct request *req)
1905static void scsi_mq_done(struct scsi_cmnd *cmd) 1904static void scsi_mq_done(struct scsi_cmnd *cmd)
1906{ 1905{
1907 trace_scsi_dispatch_cmd_done(cmd); 1906 trace_scsi_dispatch_cmd_done(cmd);
1908 blk_mq_complete_request(cmd->request, cmd->request->errors); 1907 blk_mq_complete_request(cmd->request, 0);
1909} 1908}
1910 1909
1911static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, 1910static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index cdbb293aca08..a2b279737a4b 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -184,7 +184,7 @@ static void sas_smp_request(struct request_queue *q, struct Scsi_Host *shost,
184 blk_rq_bytes(req->next_rq); 184 blk_rq_bytes(req->next_rq);
185 handler = to_sas_internal(shost->transportt)->f->smp_handler; 185 handler = to_sas_internal(shost->transportt)->f->smp_handler;
186 ret = handler(shost, rphy, req); 186 ret = handler(shost, rphy, req);
187 req->errors = ret; 187 scsi_req(req)->result = ret;
188 188
189 blk_end_request_all(req, ret); 189 blk_end_request_all(req, ret);
190 190
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index b61cc3c512d3..90ee9d926deb 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1298,7 +1298,7 @@ sg_rq_end_io(struct request *rq, int uptodate)
1298 pr_info("%s: device detaching\n", __func__); 1298 pr_info("%s: device detaching\n", __func__);
1299 1299
1300 sense = req->sense; 1300 sense = req->sense;
1301 result = rq->errors; 1301 result = req->result;
1302 resid = req->resid_len; 1302 resid = req->resid_len;
1303 1303
1304 SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sdp, 1304 SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sdp,
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 5408643431bb..1ea34d6f5437 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -480,7 +480,7 @@ static void st_do_stats(struct scsi_tape *STp, struct request *req)
480 atomic64_add(ktime_to_ns(now), &STp->stats->tot_write_time); 480 atomic64_add(ktime_to_ns(now), &STp->stats->tot_write_time);
481 atomic64_add(ktime_to_ns(now), &STp->stats->tot_io_time); 481 atomic64_add(ktime_to_ns(now), &STp->stats->tot_io_time);
482 atomic64_inc(&STp->stats->write_cnt); 482 atomic64_inc(&STp->stats->write_cnt);
483 if (req->errors) { 483 if (scsi_req(req)->result) {
484 atomic64_add(atomic_read(&STp->stats->last_write_size) 484 atomic64_add(atomic_read(&STp->stats->last_write_size)
485 - STp->buffer->cmdstat.residual, 485 - STp->buffer->cmdstat.residual,
486 &STp->stats->write_byte_cnt); 486 &STp->stats->write_byte_cnt);
@@ -494,7 +494,7 @@ static void st_do_stats(struct scsi_tape *STp, struct request *req)
494 atomic64_add(ktime_to_ns(now), &STp->stats->tot_read_time); 494 atomic64_add(ktime_to_ns(now), &STp->stats->tot_read_time);
495 atomic64_add(ktime_to_ns(now), &STp->stats->tot_io_time); 495 atomic64_add(ktime_to_ns(now), &STp->stats->tot_io_time);
496 atomic64_inc(&STp->stats->read_cnt); 496 atomic64_inc(&STp->stats->read_cnt);
497 if (req->errors) { 497 if (scsi_req(req)->result) {
498 atomic64_add(atomic_read(&STp->stats->last_read_size) 498 atomic64_add(atomic_read(&STp->stats->last_read_size)
499 - STp->buffer->cmdstat.residual, 499 - STp->buffer->cmdstat.residual,
500 &STp->stats->read_byte_cnt); 500 &STp->stats->read_byte_cnt);
@@ -518,7 +518,7 @@ static void st_scsi_execute_end(struct request *req, int uptodate)
518 struct scsi_tape *STp = SRpnt->stp; 518 struct scsi_tape *STp = SRpnt->stp;
519 struct bio *tmp; 519 struct bio *tmp;
520 520
521 STp->buffer->cmdstat.midlevel_result = SRpnt->result = req->errors; 521 STp->buffer->cmdstat.midlevel_result = SRpnt->result = rq->result;
522 STp->buffer->cmdstat.residual = rq->resid_len; 522 STp->buffer->cmdstat.residual = rq->resid_len;
523 523
524 st_do_stats(STp, req); 524 st_do_stats(STp, req);
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index c7fa372c527a..a93d94e68ab5 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -1050,7 +1050,7 @@ static void pscsi_req_done(struct request *req, int uptodate)
1050 struct se_cmd *cmd = req->end_io_data; 1050 struct se_cmd *cmd = req->end_io_data;
1051 struct pscsi_plugin_task *pt = cmd->priv; 1051 struct pscsi_plugin_task *pt = cmd->priv;
1052 1052
1053 pt->pscsi_result = req->errors; 1053 pt->pscsi_result = scsi_req(req)->result;
1054 pt->pscsi_resid = scsi_req(req)->resid_len; 1054 pt->pscsi_resid = scsi_req(req)->resid_len;
1055 1055
1056 cmd->scsi_status = status_byte(pt->pscsi_result) << 1; 1056 cmd->scsi_status = status_byte(pt->pscsi_result) << 1;
diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c
index 9f618b77ffee..fb5213afc854 100644
--- a/fs/nfsd/blocklayout.c
+++ b/fs/nfsd/blocklayout.c
@@ -243,9 +243,9 @@ static int nfsd4_scsi_identify_device(struct block_device *bdev,
243 req->cmd_len = COMMAND_SIZE(INQUIRY); 243 req->cmd_len = COMMAND_SIZE(INQUIRY);
244 244
245 blk_execute_rq(rq->q, NULL, rq, 1); 245 blk_execute_rq(rq->q, NULL, rq, 1);
246 if (rq->errors) { 246 if (req->result) {
247 pr_err("pNFS: INQUIRY 0x83 failed with: %x\n", 247 pr_err("pNFS: INQUIRY 0x83 failed with: %x\n",
248 rq->errors); 248 req->result);
249 error = -EIO; 249 error = -EIO;
250 goto out_put_request; 250 goto out_put_request;
251 } 251 }
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 2f51c1724b5a..6980ca322074 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -88,7 +88,7 @@ static inline bool ata_pm_request(struct request *rq)
88 ide_req(rq)->type == ATA_PRIV_PM_RESUME); 88 ide_req(rq)->type == ATA_PRIV_PM_RESUME);
89} 89}
90 90
91/* Error codes returned in rq->errors to the higher part of the driver. */ 91/* Error codes returned in result to the higher part of the driver. */
92enum { 92enum {
93 IDE_DRV_ERROR_GENERAL = 101, 93 IDE_DRV_ERROR_GENERAL = 101,
94 IDE_DRV_ERROR_FILEMARK = 102, 94 IDE_DRV_ERROR_FILEMARK = 102,
diff --git a/include/scsi/scsi_request.h b/include/scsi/scsi_request.h
index 7c583a0f363a..f0c76f9dc285 100644
--- a/include/scsi/scsi_request.h
+++ b/include/scsi/scsi_request.h
@@ -9,6 +9,7 @@ struct scsi_request {
9 unsigned char __cmd[BLK_MAX_CDB]; 9 unsigned char __cmd[BLK_MAX_CDB];
10 unsigned char *cmd; 10 unsigned char *cmd;
11 unsigned short cmd_len; 11 unsigned short cmd_len;
12 int result;
12 unsigned int sense_len; 13 unsigned int sense_len;
13 unsigned int resid_len; /* residual count */ 14 unsigned int resid_len; /* residual count */
14 int retries; 15 int retries;