aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-12-05 02:43:11 -0500
committerJeff Garzik <jeff@garzik.org>2008-01-23 05:24:14 -0500
commitff2aeb1eb64c8a4770a6304f9addbae9f9828646 (patch)
treec6febbec290ec6c40bf3abc7bcdb7188f5039443 /drivers/scsi/libsas
parentf92a26365a72333f418abe82700c6030d4a1a807 (diff)
libata: convert to chained sg
libata used private sg iterator to handle padding sg. Now that sg can be chained, padding can be handled using standard sg ops. Convert to chained sg. * s/qc->__sg/qc->sg/ * s/qc->pad_sgent/qc->extra_sg[]/. Because chaining consumes one sg entry. There need to be two extra sg entries. The renaming is also for future addition of other extra sg entries. * Padding setup is moved into ata_sg_setup_extra() which is organized in a way that future addition of other extra sg entries is easy. * qc->orig_n_elem is unused and removed. * qc->n_elem now contains the number of sg entries that LLDs should map. qc->mapped_n_elem is added to carry the original number of mapped sgs for unmapping. * The last sg of the original sg list is used to chain to extra sg list. The original last sg is pointed to by qc->last_sg and the content is stored in qc->saved_last_sg. It's restored during ata_sg_clean(). * All sg walking code has been updated. Unnecessary assertions and checks for conditions the core layer already guarantees are removed. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: Jens Axboe <jens.axboe@oracle.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/scsi/libsas')
-rw-r--r--drivers/scsi/libsas/sas_ata.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index f78d0605747d..827cfb132f21 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -158,8 +158,8 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
158 struct Scsi_Host *host = sas_ha->core.shost; 158 struct Scsi_Host *host = sas_ha->core.shost;
159 struct sas_internal *i = to_sas_internal(host->transportt); 159 struct sas_internal *i = to_sas_internal(host->transportt);
160 struct scatterlist *sg; 160 struct scatterlist *sg;
161 unsigned int num = 0;
162 unsigned int xfer = 0; 161 unsigned int xfer = 0;
162 unsigned int si;
163 163
164 task = sas_alloc_task(GFP_ATOMIC); 164 task = sas_alloc_task(GFP_ATOMIC);
165 if (!task) 165 if (!task)
@@ -181,17 +181,15 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
181 task->total_xfer_len = qc->nbytes + qc->pad_len; 181 task->total_xfer_len = qc->nbytes + qc->pad_len;
182 task->num_scatter = qc->pad_len ? qc->n_elem + 1 : qc->n_elem; 182 task->num_scatter = qc->pad_len ? qc->n_elem + 1 : qc->n_elem;
183 } else { 183 } else {
184 ata_for_each_sg(sg, qc) { 184 for_each_sg(qc->sg, sg, qc->n_elem, si)
185 num++;
186 xfer += sg->length; 185 xfer += sg->length;
187 }
188 186
189 task->total_xfer_len = xfer; 187 task->total_xfer_len = xfer;
190 task->num_scatter = num; 188 task->num_scatter = si;
191 } 189 }
192 190
193 task->data_dir = qc->dma_dir; 191 task->data_dir = qc->dma_dir;
194 task->scatter = qc->__sg; 192 task->scatter = qc->sg;
195 task->ata_task.retry_count = 1; 193 task->ata_task.retry_count = 1;
196 task->task_state_flags = SAS_TASK_STATE_PENDING; 194 task->task_state_flags = SAS_TASK_STATE_PENDING;
197 qc->lldd_task = task; 195 qc->lldd_task = task;