diff options
author | Tejun Heo <tj@kernel.org> | 2009-05-19 05:33:05 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-05-19 05:36:08 -0400 |
commit | 5f49f63178360b07a095bd33b0d850d60edf7590 (patch) | |
tree | 23764399405214c115543eb5dec59982cf0baa26 /drivers/ide/ide-cd.c | |
parent | 3755100dd5f66761aaaa7ae44c70b319a7c78a56 (diff) |
block: set rq->resid_len to blk_rq_bytes() on issue
In commit c3a4d78c580de4edc9ef0f7c59812fb02ceb037f, while introducing
rq->resid_len, the default value of residue count was changed from
full count to zero. The conversion was done under the assumption that
when a request fails residue count wasn't defined. However, Boaz and
James pointed out that this wasn't true and the residue count should
be preserved for failed requests too.
This patchset restores the original behavior by setting rq->resid_len
to blk_rq_bytes(rq) on request start and restoring explicit clearing
in affected drivers. While at it, take advantage of the fact that
rq->resid_len is set to full count where applicable.
* ide-cd: rq->resid_len cleared on pc success
* mptsas: req->resid_len cleared on success
* sas_expander: rsp/req->resid_len cleared on success
* mpt2sas_transport: req->resid_len cleared on success
* ide-cd, ide-tape, mptsas, sas_host_smp, mpt2sas_transport, ub: take
advantage of initial full count to simplify code
Boaz Harrosh spotted bug in resid_len initialization. Fixed as
suggested.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Borislav Petkov <petkovbb@googlemail.com>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r-- | drivers/ide/ide-cd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 4c7792fd5f93..081aed6781cc 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -699,6 +699,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
699 | 699 | ||
700 | out_end: | 700 | out_end: |
701 | if (blk_pc_request(rq) && rc == 0) { | 701 | if (blk_pc_request(rq) && rc == 0) { |
702 | rq->resid_len = 0; | ||
702 | blk_end_request_all(rq, 0); | 703 | blk_end_request_all(rq, 0); |
703 | hwif->rq = NULL; | 704 | hwif->rq = NULL; |
704 | } else { | 705 | } else { |
@@ -718,8 +719,7 @@ out_end: | |||
718 | 719 | ||
719 | /* make sure it's fully ended */ | 720 | /* make sure it's fully ended */ |
720 | if (blk_fs_request(rq) == 0) { | 721 | if (blk_fs_request(rq) == 0) { |
721 | rq->resid_len = blk_rq_bytes(rq) - | 722 | rq->resid_len -= cmd->nbytes - cmd->nleft; |
722 | (cmd->nbytes - cmd->nleft); | ||
723 | if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE)) | 723 | if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE)) |
724 | rq->resid_len += cmd->last_xfer_len; | 724 | rq->resid_len += cmd->last_xfer_len; |
725 | } | 725 | } |