diff options
author | Tejun Heo <tj@kernel.org> | 2009-04-18 19:46:02 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-04-28 01:37:31 -0400 |
commit | eb6a61bb9543aa54d62595e27206b3d3c0293bcc (patch) | |
tree | 97d165ad28f62ff4754caff4ebde30e0506259d7 /drivers/ide/ide-floppy.c | |
parent | 08f370f0a2fb223bf48d0bfa2a173be0393c19dc (diff) |
ide-atapi,tape,floppy: allow ->pc_callback() to change rq->data_len
Impact: allow residual count implementation in ->pc_callback()
rq->data_len has two duties - carrying the number of input bytes on
issue and carrying residual count back to the issuer on completion.
ide-atapi completion callback ->pc_callback() is the right place to do
this but currently ide-atapi depends on rq->data_len carrying the
original request size after calling ->pc_callback() to complete the pc
request.
This patch makes ide_pc_intr(), ide_tape_issue_pc() and
ide_floppy_issue_pc() cache length to complete before calling
->pc_callback() so that it can modify rq->data_len as necessary.
Note: As using rq->data_len for two purposes can make cases like this
incorrect in subtle ways, future changes will introduce separate
field for residual count.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r-- | drivers/ide/ide-floppy.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index d20704ac3183..537b7c558033 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -134,14 +134,17 @@ static ide_startstop_t ide_floppy_issue_pc(ide_drive_t *drive, | |||
134 | drive->pc = pc; | 134 | drive->pc = pc; |
135 | 135 | ||
136 | if (pc->retries > IDEFLOPPY_MAX_PC_RETRIES) { | 136 | if (pc->retries > IDEFLOPPY_MAX_PC_RETRIES) { |
137 | unsigned int done = blk_rq_bytes(drive->hwif->rq); | ||
138 | |||
137 | if (!(pc->flags & PC_FLAG_SUPPRESS_ERROR)) | 139 | if (!(pc->flags & PC_FLAG_SUPPRESS_ERROR)) |
138 | ide_floppy_report_error(floppy, pc); | 140 | ide_floppy_report_error(floppy, pc); |
141 | |||
139 | /* Giving up */ | 142 | /* Giving up */ |
140 | pc->error = IDE_DRV_ERROR_GENERAL; | 143 | pc->error = IDE_DRV_ERROR_GENERAL; |
141 | 144 | ||
142 | drive->failed_pc = NULL; | 145 | drive->failed_pc = NULL; |
143 | drive->pc_callback(drive, 0); | 146 | drive->pc_callback(drive, 0); |
144 | ide_complete_rq(drive, -EIO, blk_rq_bytes(drive->hwif->rq)); | 147 | ide_complete_rq(drive, -EIO, done); |
145 | return ide_stopped; | 148 | return ide_stopped; |
146 | } | 149 | } |
147 | 150 | ||