summaryrefslogtreecommitdiff
path: root/drivers/ide/ide-tape.c
diff options
context:
space:
mode:
authorBorislav Petkov <petkovbb@gmail.com>2009-05-01 20:35:21 +0200
committerBorislav Petkov <petkovbb@gmail.com>2009-05-15 06:43:59 +0200
commitdfb7e621fa12c0579e88560ab176c5768f9e0bfb (patch)
tree9a0fc84735ee3290c366b4244763013ba07bcdd7 /drivers/ide/ide-tape.c
parent10c0b3437c4dc0d14ac254bbe71e54ea5f238d97 (diff)
ide-atapi: switch to blk_rq_bytes() on do_request() path
After the recent struct request cleanups, blk_rq_bytes() is guaranteed to be valid and is the current total length of the rq's bio. Use that instead of pc->req_xfer in the do_request() path after the command has been queued The remaining usage of pc->req_xfer now is only until we map the rq to a bio. While at it: - remove local caching of rq completion length in ide_tape_issue_pc() Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
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)
{
idetape_tape_t *tape = drive->driver_data;
struct ide_atapi_pc *pc = drive->failed_pc;
+ struct request *rq = drive->hwif->rq;
tape->sense_key = sense[2] & 0xF;
tape->asc = sense[12];
@@ -302,7 +303,7 @@ static void idetape_analyze_error(ide_drive_t *drive, u8 *sense)
/* Correct pc->xferred by asking the tape. */
if (pc->flags & PC_FLAG_DMA_ERROR)
- pc->xferred = pc->req_xfer -
+ pc->xferred = blk_rq_bytes(rq) -
tape->blk_size *
get_unaligned_be32(&sense[3]);
@@ -484,6 +485,7 @@ static ide_startstop_t ide_tape_issue_pc(ide_drive_t *drive,
struct ide_atapi_pc *pc)
{
idetape_tape_t *tape = drive->driver_data;
+ struct request *rq = drive->hwif->rq;
if (drive->failed_pc == NULL && pc->c[0] != REQUEST_SENSE)
drive->failed_pc = pc;
@@ -493,7 +495,6 @@ static ide_startstop_t ide_tape_issue_pc(ide_drive_t *drive,
if (pc->retries > IDETAPE_MAX_PC_RETRIES ||
(pc->flags & PC_FLAG_ABORT)) {
- unsigned int done = blk_rq_bytes(drive->hwif->rq);
/*
* 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,
drive->failed_pc = NULL;
drive->pc_callback(drive, 0);
- ide_complete_rq(drive, -EIO, done);
+ ide_complete_rq(drive, -EIO, blk_rq_bytes(rq));
return ide_stopped;
}
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,
put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]);
pc->c[1] = 1;
pc->buf = NULL;
- pc->buf_size = length * tape->blk_size;
- pc->req_xfer = pc->buf_size;
- if (pc->req_xfer == tape->buffer_size)
+ pc->buf_size = blk_rq_bytes(rq);
+ if (pc->buf_size == tape->buffer_size)
pc->flags |= PC_FLAG_DMA_OK;
if (opcode == READ_6)
@@ -718,7 +718,7 @@ out:
cmd.rq = rq;
- ide_init_sg_cmd(&cmd, pc->req_xfer);
+ ide_init_sg_cmd(&cmd, blk_rq_bytes(rq));
ide_map_sg(drive, &cmd);
return ide_tape_issue_pc(drive, &cmd, pc);