diff options
author | Tejun Heo <tj@kernel.org> | 2009-05-07 09:24:42 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-05-11 03:50:55 -0400 |
commit | b0790410300abaaf4f25f702803beff701baebf1 (patch) | |
tree | 63d8fcd38e4cd5927fd83e482e306480bb68a689 /drivers/message | |
parent | 2e46e8b27aa57c6bd34b3102b40ee4d0144b4fab (diff) |
block: cleanup rq->data_len usages
With recent unification of fields, it's now guaranteed that
rq->data_len always equals blk_rq_bytes(). Convert all non-IDE direct
users to accessors. IDE will be converted in a separate patch.
Boaz: spotted incorrect data_len/resid_len conversion in osd.
[ Impact: convert direct rq->data_len usages to blk_rq_bytes() ]
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: Markus Lidel <Markus.Lidel@shadowconnect.com>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/message')
-rw-r--r-- | drivers/message/fusion/mptsas.c | 20 | ||||
-rw-r--r-- | drivers/message/i2o/i2o_block.c | 2 |
2 files changed, 11 insertions, 11 deletions
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 5d5f34715de4..4e6fcf06a6f2 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c | |||
@@ -1277,8 +1277,8 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1277 | /* do we need to support multiple segments? */ | 1277 | /* do we need to support multiple segments? */ |
1278 | if (req->bio->bi_vcnt > 1 || rsp->bio->bi_vcnt > 1) { | 1278 | if (req->bio->bi_vcnt > 1 || rsp->bio->bi_vcnt > 1) { |
1279 | printk(MYIOC_s_ERR_FMT "%s: multiple segments req %u %u, rsp %u %u\n", | 1279 | printk(MYIOC_s_ERR_FMT "%s: multiple segments req %u %u, rsp %u %u\n", |
1280 | ioc->name, __func__, req->bio->bi_vcnt, req->data_len, | 1280 | ioc->name, __func__, req->bio->bi_vcnt, blk_rq_bytes(req), |
1281 | rsp->bio->bi_vcnt, rsp->data_len); | 1281 | rsp->bio->bi_vcnt, blk_rq_bytes(rsp)); |
1282 | return -EINVAL; | 1282 | return -EINVAL; |
1283 | } | 1283 | } |
1284 | 1284 | ||
@@ -1295,7 +1295,7 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1295 | smpreq = (SmpPassthroughRequest_t *)mf; | 1295 | smpreq = (SmpPassthroughRequest_t *)mf; |
1296 | memset(smpreq, 0, sizeof(*smpreq)); | 1296 | memset(smpreq, 0, sizeof(*smpreq)); |
1297 | 1297 | ||
1298 | smpreq->RequestDataLength = cpu_to_le16(req->data_len - 4); | 1298 | smpreq->RequestDataLength = cpu_to_le16(blk_rq_bytes(req) - 4); |
1299 | smpreq->Function = MPI_FUNCTION_SMP_PASSTHROUGH; | 1299 | smpreq->Function = MPI_FUNCTION_SMP_PASSTHROUGH; |
1300 | 1300 | ||
1301 | if (rphy) | 1301 | if (rphy) |
@@ -1321,10 +1321,10 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1321 | MPI_SGE_FLAGS_END_OF_BUFFER | | 1321 | MPI_SGE_FLAGS_END_OF_BUFFER | |
1322 | MPI_SGE_FLAGS_DIRECTION | | 1322 | MPI_SGE_FLAGS_DIRECTION | |
1323 | mpt_addr_size()) << MPI_SGE_FLAGS_SHIFT; | 1323 | mpt_addr_size()) << MPI_SGE_FLAGS_SHIFT; |
1324 | flagsLength |= (req->data_len - 4); | 1324 | flagsLength |= (blk_rq_bytes(req) - 4); |
1325 | 1325 | ||
1326 | dma_addr_out = pci_map_single(ioc->pcidev, bio_data(req->bio), | 1326 | dma_addr_out = pci_map_single(ioc->pcidev, bio_data(req->bio), |
1327 | req->data_len, PCI_DMA_BIDIRECTIONAL); | 1327 | blk_rq_bytes(req), PCI_DMA_BIDIRECTIONAL); |
1328 | if (!dma_addr_out) | 1328 | if (!dma_addr_out) |
1329 | goto put_mf; | 1329 | goto put_mf; |
1330 | mpt_add_sge(psge, flagsLength, dma_addr_out); | 1330 | mpt_add_sge(psge, flagsLength, dma_addr_out); |
@@ -1332,9 +1332,9 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1332 | 1332 | ||
1333 | /* response */ | 1333 | /* response */ |
1334 | flagsLength = MPT_SGE_FLAGS_SSIMPLE_READ; | 1334 | flagsLength = MPT_SGE_FLAGS_SSIMPLE_READ; |
1335 | flagsLength |= rsp->data_len + 4; | 1335 | flagsLength |= blk_rq_bytes(rsp) + 4; |
1336 | dma_addr_in = pci_map_single(ioc->pcidev, bio_data(rsp->bio), | 1336 | dma_addr_in = pci_map_single(ioc->pcidev, bio_data(rsp->bio), |
1337 | rsp->data_len, PCI_DMA_BIDIRECTIONAL); | 1337 | blk_rq_bytes(rsp), PCI_DMA_BIDIRECTIONAL); |
1338 | if (!dma_addr_in) | 1338 | if (!dma_addr_in) |
1339 | goto unmap; | 1339 | goto unmap; |
1340 | mpt_add_sge(psge, flagsLength, dma_addr_in); | 1340 | mpt_add_sge(psge, flagsLength, dma_addr_in); |
@@ -1357,7 +1357,7 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1357 | smprep = (SmpPassthroughReply_t *)ioc->sas_mgmt.reply; | 1357 | smprep = (SmpPassthroughReply_t *)ioc->sas_mgmt.reply; |
1358 | memcpy(req->sense, smprep, sizeof(*smprep)); | 1358 | memcpy(req->sense, smprep, sizeof(*smprep)); |
1359 | req->sense_len = sizeof(*smprep); | 1359 | req->sense_len = sizeof(*smprep); |
1360 | rsp->resid_len = rsp->data_len - smprep->ResponseDataLength; | 1360 | rsp->resid_len = blk_rq_bytes(rsp) - smprep->ResponseDataLength; |
1361 | } else { | 1361 | } else { |
1362 | printk(MYIOC_s_ERR_FMT "%s: smp passthru reply failed to be returned\n", | 1362 | printk(MYIOC_s_ERR_FMT "%s: smp passthru reply failed to be returned\n", |
1363 | ioc->name, __func__); | 1363 | ioc->name, __func__); |
@@ -1365,10 +1365,10 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1365 | } | 1365 | } |
1366 | unmap: | 1366 | unmap: |
1367 | if (dma_addr_out) | 1367 | if (dma_addr_out) |
1368 | pci_unmap_single(ioc->pcidev, dma_addr_out, req->data_len, | 1368 | pci_unmap_single(ioc->pcidev, dma_addr_out, blk_rq_bytes(req), |
1369 | PCI_DMA_BIDIRECTIONAL); | 1369 | PCI_DMA_BIDIRECTIONAL); |
1370 | if (dma_addr_in) | 1370 | if (dma_addr_in) |
1371 | pci_unmap_single(ioc->pcidev, dma_addr_in, rsp->data_len, | 1371 | pci_unmap_single(ioc->pcidev, dma_addr_in, blk_rq_bytes(rsp), |
1372 | PCI_DMA_BIDIRECTIONAL); | 1372 | PCI_DMA_BIDIRECTIONAL); |
1373 | put_mf: | 1373 | put_mf: |
1374 | if (mf) | 1374 | if (mf) |
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c index 510eb4726374..6b61d289d6c9 100644 --- a/drivers/message/i2o/i2o_block.c +++ b/drivers/message/i2o/i2o_block.c | |||
@@ -430,7 +430,7 @@ static void i2o_block_end_request(struct request *req, int error, | |||
430 | int leftover = (blk_rq_sectors(req) << KERNEL_SECTOR_SHIFT); | 430 | int leftover = (blk_rq_sectors(req) << KERNEL_SECTOR_SHIFT); |
431 | 431 | ||
432 | if (blk_pc_request(req)) | 432 | if (blk_pc_request(req)) |
433 | leftover = req->data_len; | 433 | leftover = blk_rq_bytes(req); |
434 | 434 | ||
435 | if (error) | 435 | if (error) |
436 | blk_end_request(req, -EIO, leftover); | 436 | blk_end_request(req, -EIO, leftover); |