aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-tape.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r--drivers/ide/ide-tape.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index fc79cf4812f3..aaeef12f80ad 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -292,6 +292,7 @@ static void idetape_analyze_error(ide_drive_t *drive, u8 *sense)
292{ 292{
293 idetape_tape_t *tape = drive->driver_data; 293 idetape_tape_t *tape = drive->driver_data;
294 struct ide_atapi_pc *pc = drive->failed_pc; 294 struct ide_atapi_pc *pc = drive->failed_pc;
295 struct request *rq = drive->hwif->rq;
295 296
296 tape->sense_key = sense[2] & 0xF; 297 tape->sense_key = sense[2] & 0xF;
297 tape->asc = sense[12]; 298 tape->asc = sense[12];
@@ -302,7 +303,7 @@ static void idetape_analyze_error(ide_drive_t *drive, u8 *sense)
302 303
303 /* Correct pc->xferred by asking the tape. */ 304 /* Correct pc->xferred by asking the tape. */
304 if (pc->flags & PC_FLAG_DMA_ERROR) 305 if (pc->flags & PC_FLAG_DMA_ERROR)
305 pc->xferred = pc->req_xfer - 306 pc->xferred = blk_rq_bytes(rq) -
306 tape->blk_size * 307 tape->blk_size *
307 get_unaligned_be32(&sense[3]); 308 get_unaligned_be32(&sense[3]);
308 309
@@ -484,6 +485,7 @@ static ide_startstop_t ide_tape_issue_pc(ide_drive_t *drive,
484 struct ide_atapi_pc *pc) 485 struct ide_atapi_pc *pc)
485{ 486{
486 idetape_tape_t *tape = drive->driver_data; 487 idetape_tape_t *tape = drive->driver_data;
488 struct request *rq = drive->hwif->rq;
487 489
488 if (drive->failed_pc == NULL && pc->c[0] != REQUEST_SENSE) 490 if (drive->failed_pc == NULL && pc->c[0] != REQUEST_SENSE)
489 drive->failed_pc = pc; 491 drive->failed_pc = pc;
@@ -493,7 +495,6 @@ static ide_startstop_t ide_tape_issue_pc(ide_drive_t *drive,
493 495
494 if (pc->retries > IDETAPE_MAX_PC_RETRIES || 496 if (pc->retries > IDETAPE_MAX_PC_RETRIES ||
495 (pc->flags & PC_FLAG_ABORT)) { 497 (pc->flags & PC_FLAG_ABORT)) {
496 unsigned int done = blk_rq_bytes(drive->hwif->rq);
497 498
498 /* 499 /*
499 * We will "abort" retrying a packet command in case legitimate 500 * We will "abort" retrying a packet command in case legitimate
@@ -517,7 +518,7 @@ static ide_startstop_t ide_tape_issue_pc(ide_drive_t *drive,
517 518
518 drive->failed_pc = NULL; 519 drive->failed_pc = NULL;
519 drive->pc_callback(drive, 0); 520 drive->pc_callback(drive, 0);
520 ide_complete_rq(drive, -EIO, done); 521 ide_complete_rq(drive, -EIO, blk_rq_bytes(rq));
521 return ide_stopped; 522 return ide_stopped;
522 } 523 }
523 debug_log(DBG_SENSE, "Retry #%d, cmd = %02X\n", pc->retries, pc->c[0]); 524 debug_log(DBG_SENSE, "Retry #%d, cmd = %02X\n", pc->retries, pc->c[0]);
@@ -592,9 +593,8 @@ static void ide_tape_create_rw_cmd(idetape_tape_t *tape,
592 put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]); 593 put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]);
593 pc->c[1] = 1; 594 pc->c[1] = 1;
594 pc->buf = NULL; 595 pc->buf = NULL;
595 pc->buf_size = length * tape->blk_size; 596 pc->buf_size = blk_rq_bytes(rq);
596 pc->req_xfer = pc->buf_size; 597 if (pc->buf_size == tape->buffer_size)
597 if (pc->req_xfer == tape->buffer_size)
598 pc->flags |= PC_FLAG_DMA_OK; 598 pc->flags |= PC_FLAG_DMA_OK;
599 599
600 if (opcode == READ_6) 600 if (opcode == READ_6)
@@ -718,7 +718,7 @@ out:
718 718
719 cmd.rq = rq; 719 cmd.rq = rq;
720 720
721 ide_init_sg_cmd(&cmd, pc->req_xfer); 721 ide_init_sg_cmd(&cmd, blk_rq_bytes(rq));
722 ide_map_sg(drive, &cmd); 722 ide_map_sg(drive, &cmd);
723 723
724 return ide_tape_issue_pc(drive, &cmd, pc); 724 return ide_tape_issue_pc(drive, &cmd, pc);