aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2008-02-19 05:36:56 -0500
committerJens Axboe <jens.axboe@oracle.com>2008-02-19 05:36:56 -0500
commitdde2020754aeb14e17052d61784dcb37f252aac2 (patch)
tree1b6d57c6eff2024fd13e4b3b115d0a6770d8cb80 /drivers/scsi
parentdb0a2e0099be3a1cff55879225881465f16c67d3 (diff)
libata: eliminate the home grown dma padding in favour of
that provided by the block layer ATA requires that all DMA transfers begin and end on word boundaries. Because of this, a large amount of machinery grew up in ide to adjust scatterlists on this basis. However, as of 2.5, the block layer has a dma_alignment variable which ensures both the beginning and length of a DMA transfer are aligned on the dma_alignment boundary. Although the block layer does adjust the beginning of the transfer to ensure this happens, it doesn't actually adjust the length, it merely makes sure that space is allocated for transfers beyond the declared length. The upshot of this is that scatterlists may be padded to any size between the actual length and the length adjusted to the dma_alignment safely knowing that memory is allocated in this region. Right at the moment, SCSI takes the default dma_aligment which is on a 512 byte boundary. Note that this aligment only applies to transfers coming in from user space. However, since all kernel allocations are automatically aligned on a minimum of 32 byte boundaries, it is safe to adjust them in this manner as well. tj: * Adjusting sg after padding is done in block layer. Make libata set queue alignment correctly for ATAPI devices and drop broken sg mangling from ata_sg_setup(). * Use request->raw_data_len for ATAPI transfer chunk size. * Killed qc->raw_nbytes. * Separated out killing qc->n_iter. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/ipr.c4
-rw-r--r--drivers/scsi/libsas/sas_ata.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 2074701f7e76..c72014a3e7d4 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -5140,7 +5140,7 @@ static void ipr_build_ata_ioadl(struct ipr_cmnd *ipr_cmd,
5140 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; 5140 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
5141 struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl; 5141 struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl;
5142 struct ipr_ioadl_desc *last_ioadl = NULL; 5142 struct ipr_ioadl_desc *last_ioadl = NULL;
5143 int len = qc->nbytes + qc->pad_len; 5143 int len = qc->nbytes;
5144 struct scatterlist *sg; 5144 struct scatterlist *sg;
5145 unsigned int si; 5145 unsigned int si;
5146 5146
@@ -5206,7 +5206,7 @@ static unsigned int ipr_qc_issue(struct ata_queued_cmd *qc)
5206 ioarcb->cmd_pkt.request_type = IPR_RQTYPE_ATA_PASSTHRU; 5206 ioarcb->cmd_pkt.request_type = IPR_RQTYPE_ATA_PASSTHRU;
5207 ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_NO_LINK_DESC; 5207 ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_NO_LINK_DESC;
5208 ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_NO_ULEN_CHK; 5208 ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_NO_ULEN_CHK;
5209 ipr_cmd->dma_use_sg = qc->pad_len ? qc->n_elem + 1 : qc->n_elem; 5209 ipr_cmd->dma_use_sg = qc->n_elem;
5210 5210
5211 ipr_build_ata_ioadl(ipr_cmd, qc); 5211 ipr_build_ata_ioadl(ipr_cmd, qc);
5212 regs->flags |= IPR_ATA_FLAG_STATUS_ON_GOOD_COMPLETION; 5212 regs->flags |= IPR_ATA_FLAG_STATUS_ON_GOOD_COMPLETION;
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 0996f866f14c..7cd05b599a12 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -178,8 +178,8 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
178 task->uldd_task = qc; 178 task->uldd_task = qc;
179 if (ata_is_atapi(qc->tf.protocol)) { 179 if (ata_is_atapi(qc->tf.protocol)) {
180 memcpy(task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len); 180 memcpy(task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len);
181 task->total_xfer_len = qc->nbytes + qc->pad_len; 181 task->total_xfer_len = qc->nbytes;
182 task->num_scatter = qc->pad_len ? qc->n_elem + 1 : qc->n_elem; 182 task->num_scatter = qc->n_elem;
183 } else { 183 } else {
184 for_each_sg(qc->sg, sg, qc->n_elem, si) 184 for_each_sg(qc->sg, sg, qc->n_elem, si)
185 xfer += sg->length; 185 xfer += sg->length;