From dfb7e621fa12c0579e88560ab176c5768f9e0bfb Mon Sep 17 00:00:00 2001 From: Borislav Petkov Date: Fri, 1 May 2009 20:35:21 +0200 Subject: 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 --- drivers/ide/ide-atapi.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'drivers/ide/ide-atapi.c') diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 8a894fa37b53..7129495b3e40 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c @@ -370,7 +370,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) ? "write" : "read"); pc->flags |= PC_FLAG_DMA_ERROR; } else - pc->xferred = pc->req_xfer; + pc->xferred = blk_rq_bytes(rq); debug_log("%s: DMA finished\n", drive->name); } @@ -627,7 +627,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) ide_hwif_t *hwif = drive->hwif; ide_expiry_t *expiry = NULL; struct request *rq = hwif->rq; - unsigned int timeout; + unsigned int timeout, bytes; u16 bcount; u8 valid_tf; u8 drq_int = !!(drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT); @@ -647,9 +647,11 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) pc->xferred = 0; valid_tf = IDE_VALID_DEVICE; - bcount = ((drive->media == ide_tape) ? - pc->req_xfer : - min(pc->req_xfer, 63 * 1024)); + bytes = blk_rq_bytes(rq); + + bcount = ((drive->media == ide_tape) ? bytes + : min_t(unsigned int, + bytes, 63 * 1024)); if (pc->flags & PC_FLAG_DMA_ERROR) { pc->flags &= ~PC_FLAG_DMA_ERROR; -- cgit v1.2.3