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/scsi | |
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/scsi')
-rw-r--r-- | drivers/scsi/libsas/sas_expander.c | 4 | ||||
-rw-r--r-- | drivers/scsi/libsas/sas_host_smp.c | 3 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_transport.c | 4 |
3 files changed, 6 insertions, 5 deletions
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 531af9ed7199..54fa1e42dc4d 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
@@ -1937,7 +1937,11 @@ int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1937 | if (ret > 0) { | 1937 | if (ret > 0) { |
1938 | /* positive number is the untransferred residual */ | 1938 | /* positive number is the untransferred residual */ |
1939 | rsp->resid_len = ret; | 1939 | rsp->resid_len = ret; |
1940 | req->resid_len = 0; | ||
1940 | ret = 0; | 1941 | ret = 0; |
1942 | } else if (ret == 0) { | ||
1943 | rsp->resid_len = 0; | ||
1944 | req->resid_len = 0; | ||
1941 | } | 1945 | } |
1942 | 1946 | ||
1943 | return ret; | 1947 | return ret; |
diff --git a/drivers/scsi/libsas/sas_host_smp.c b/drivers/scsi/libsas/sas_host_smp.c index be9a951b977d..1bc3b7567994 100644 --- a/drivers/scsi/libsas/sas_host_smp.c +++ b/drivers/scsi/libsas/sas_host_smp.c | |||
@@ -176,9 +176,6 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req, | |||
176 | resp_data[1] = req_data[1]; | 176 | resp_data[1] = req_data[1]; |
177 | resp_data[2] = SMP_RESP_FUNC_UNK; | 177 | resp_data[2] = SMP_RESP_FUNC_UNK; |
178 | 178 | ||
179 | req->resid_len = blk_rq_bytes(req); | ||
180 | rsp->resid_len = blk_rq_bytes(rsp); | ||
181 | |||
182 | switch (req_data[1]) { | 179 | switch (req_data[1]) { |
183 | case SMP_REPORT_GENERAL: | 180 | case SMP_REPORT_GENERAL: |
184 | req->resid_len -= 8; | 181 | req->resid_len -= 8; |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c index af95a449930e..5c65da519e39 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_transport.c +++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c | |||
@@ -1170,8 +1170,8 @@ transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1170 | 1170 | ||
1171 | memcpy(req->sense, mpi_reply, sizeof(*mpi_reply)); | 1171 | memcpy(req->sense, mpi_reply, sizeof(*mpi_reply)); |
1172 | req->sense_len = sizeof(*mpi_reply); | 1172 | req->sense_len = sizeof(*mpi_reply); |
1173 | rsp->resid_len = blk_rq_bytes(rsp) - | 1173 | req->resid_len = 0; |
1174 | mpi_reply->ResponseDataLength; | 1174 | rsp->resid_len -= mpi_reply->ResponseDataLength; |
1175 | } else { | 1175 | } else { |
1176 | dtransportprintk(ioc, printk(MPT2SAS_DEBUG_FMT | 1176 | dtransportprintk(ioc, printk(MPT2SAS_DEBUG_FMT |
1177 | "%s - no reply\n", ioc->name, __func__)); | 1177 | "%s - no reply\n", ioc->name, __func__)); |