diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 13:09:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 13:09:16 -0400 |
commit | 92d15c2ccbb3e31a3fc71ad28fdb55e1319383c0 (patch) | |
tree | 8d83c0dc3c6b935d8367e331872f242b742f0a8a /drivers/ata | |
parent | f20bf6125605acbbc7eb8c9420d7221c91aa83eb (diff) | |
parent | 644bd2f048972d75eb1979b1fdca257d528ce687 (diff) |
Merge branch 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block: (63 commits)
Fix memory leak in dm-crypt
SPARC64: sg chaining support
SPARC: sg chaining support
PPC: sg chaining support
PS3: sg chaining support
IA64: sg chaining support
x86-64: enable sg chaining
x86-64: update pci-gart iommu to sg helpers
x86-64: update nommu to sg helpers
x86-64: update calgary iommu to sg helpers
swiotlb: sg chaining support
i386: enable sg chaining
i386 dma_map_sg: convert to using sg helpers
mmc: need to zero sglist on init
Panic in blk_rq_map_sg() from CCISS driver
remove sglist_len
remove blk_queue_max_phys_segments in libata
revert sg segment size ifdefs
Fixup u14-34f ENABLE_SG_CHAINING
qla1280: enable use_sg_chaining option
...
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-core.c | 35 | ||||
-rw-r--r-- | drivers/ata/libata-scsi.c | 2 |
2 files changed, 21 insertions, 16 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 68699b3e7998..bbaa545ea999 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -1410,7 +1410,7 @@ static void ata_qc_complete_internal(struct ata_queued_cmd *qc) | |||
1410 | */ | 1410 | */ |
1411 | unsigned ata_exec_internal_sg(struct ata_device *dev, | 1411 | unsigned ata_exec_internal_sg(struct ata_device *dev, |
1412 | struct ata_taskfile *tf, const u8 *cdb, | 1412 | struct ata_taskfile *tf, const u8 *cdb, |
1413 | int dma_dir, struct scatterlist *sg, | 1413 | int dma_dir, struct scatterlist *sgl, |
1414 | unsigned int n_elem, unsigned long timeout) | 1414 | unsigned int n_elem, unsigned long timeout) |
1415 | { | 1415 | { |
1416 | struct ata_link *link = dev->link; | 1416 | struct ata_link *link = dev->link; |
@@ -1472,11 +1472,12 @@ unsigned ata_exec_internal_sg(struct ata_device *dev, | |||
1472 | qc->dma_dir = dma_dir; | 1472 | qc->dma_dir = dma_dir; |
1473 | if (dma_dir != DMA_NONE) { | 1473 | if (dma_dir != DMA_NONE) { |
1474 | unsigned int i, buflen = 0; | 1474 | unsigned int i, buflen = 0; |
1475 | struct scatterlist *sg; | ||
1475 | 1476 | ||
1476 | for (i = 0; i < n_elem; i++) | 1477 | for_each_sg(sgl, sg, n_elem, i) |
1477 | buflen += sg[i].length; | 1478 | buflen += sg->length; |
1478 | 1479 | ||
1479 | ata_sg_init(qc, sg, n_elem); | 1480 | ata_sg_init(qc, sgl, n_elem); |
1480 | qc->nbytes = buflen; | 1481 | qc->nbytes = buflen; |
1481 | } | 1482 | } |
1482 | 1483 | ||
@@ -4292,7 +4293,7 @@ void ata_sg_clean(struct ata_queued_cmd *qc) | |||
4292 | if (qc->n_elem) | 4293 | if (qc->n_elem) |
4293 | dma_unmap_sg(ap->dev, sg, qc->n_elem, dir); | 4294 | dma_unmap_sg(ap->dev, sg, qc->n_elem, dir); |
4294 | /* restore last sg */ | 4295 | /* restore last sg */ |
4295 | sg[qc->orig_n_elem - 1].length += qc->pad_len; | 4296 | sg_last(sg, qc->orig_n_elem)->length += qc->pad_len; |
4296 | if (pad_buf) { | 4297 | if (pad_buf) { |
4297 | struct scatterlist *psg = &qc->pad_sgent; | 4298 | struct scatterlist *psg = &qc->pad_sgent; |
4298 | void *addr = kmap_atomic(psg->page, KM_IRQ0); | 4299 | void *addr = kmap_atomic(psg->page, KM_IRQ0); |
@@ -4547,6 +4548,7 @@ void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen) | |||
4547 | qc->orig_n_elem = 1; | 4548 | qc->orig_n_elem = 1; |
4548 | qc->buf_virt = buf; | 4549 | qc->buf_virt = buf; |
4549 | qc->nbytes = buflen; | 4550 | qc->nbytes = buflen; |
4551 | qc->cursg = qc->__sg; | ||
4550 | 4552 | ||
4551 | sg_init_one(&qc->sgent, buf, buflen); | 4553 | sg_init_one(&qc->sgent, buf, buflen); |
4552 | } | 4554 | } |
@@ -4572,6 +4574,7 @@ void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, | |||
4572 | qc->__sg = sg; | 4574 | qc->__sg = sg; |
4573 | qc->n_elem = n_elem; | 4575 | qc->n_elem = n_elem; |
4574 | qc->orig_n_elem = n_elem; | 4576 | qc->orig_n_elem = n_elem; |
4577 | qc->cursg = qc->__sg; | ||
4575 | } | 4578 | } |
4576 | 4579 | ||
4577 | /** | 4580 | /** |
@@ -4661,7 +4664,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc) | |||
4661 | { | 4664 | { |
4662 | struct ata_port *ap = qc->ap; | 4665 | struct ata_port *ap = qc->ap; |
4663 | struct scatterlist *sg = qc->__sg; | 4666 | struct scatterlist *sg = qc->__sg; |
4664 | struct scatterlist *lsg = &sg[qc->n_elem - 1]; | 4667 | struct scatterlist *lsg = sg_last(qc->__sg, qc->n_elem); |
4665 | int n_elem, pre_n_elem, dir, trim_sg = 0; | 4668 | int n_elem, pre_n_elem, dir, trim_sg = 0; |
4666 | 4669 | ||
4667 | VPRINTK("ENTER, ata%u\n", ap->print_id); | 4670 | VPRINTK("ENTER, ata%u\n", ap->print_id); |
@@ -4825,7 +4828,6 @@ void ata_data_xfer_noirq(struct ata_device *adev, unsigned char *buf, | |||
4825 | static void ata_pio_sector(struct ata_queued_cmd *qc) | 4828 | static void ata_pio_sector(struct ata_queued_cmd *qc) |
4826 | { | 4829 | { |
4827 | int do_write = (qc->tf.flags & ATA_TFLAG_WRITE); | 4830 | int do_write = (qc->tf.flags & ATA_TFLAG_WRITE); |
4828 | struct scatterlist *sg = qc->__sg; | ||
4829 | struct ata_port *ap = qc->ap; | 4831 | struct ata_port *ap = qc->ap; |
4830 | struct page *page; | 4832 | struct page *page; |
4831 | unsigned int offset; | 4833 | unsigned int offset; |
@@ -4834,8 +4836,8 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) | |||
4834 | if (qc->curbytes == qc->nbytes - qc->sect_size) | 4836 | if (qc->curbytes == qc->nbytes - qc->sect_size) |
4835 | ap->hsm_task_state = HSM_ST_LAST; | 4837 | ap->hsm_task_state = HSM_ST_LAST; |
4836 | 4838 | ||
4837 | page = sg[qc->cursg].page; | 4839 | page = qc->cursg->page; |
4838 | offset = sg[qc->cursg].offset + qc->cursg_ofs; | 4840 | offset = qc->cursg->offset + qc->cursg_ofs; |
4839 | 4841 | ||
4840 | /* get the current page and offset */ | 4842 | /* get the current page and offset */ |
4841 | page = nth_page(page, (offset >> PAGE_SHIFT)); | 4843 | page = nth_page(page, (offset >> PAGE_SHIFT)); |
@@ -4863,8 +4865,8 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) | |||
4863 | qc->curbytes += qc->sect_size; | 4865 | qc->curbytes += qc->sect_size; |
4864 | qc->cursg_ofs += qc->sect_size; | 4866 | qc->cursg_ofs += qc->sect_size; |
4865 | 4867 | ||
4866 | if (qc->cursg_ofs == (&sg[qc->cursg])->length) { | 4868 | if (qc->cursg_ofs == qc->cursg->length) { |
4867 | qc->cursg++; | 4869 | qc->cursg = sg_next(qc->cursg); |
4868 | qc->cursg_ofs = 0; | 4870 | qc->cursg_ofs = 0; |
4869 | } | 4871 | } |
4870 | } | 4872 | } |
@@ -4950,16 +4952,18 @@ static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes) | |||
4950 | { | 4952 | { |
4951 | int do_write = (qc->tf.flags & ATA_TFLAG_WRITE); | 4953 | int do_write = (qc->tf.flags & ATA_TFLAG_WRITE); |
4952 | struct scatterlist *sg = qc->__sg; | 4954 | struct scatterlist *sg = qc->__sg; |
4955 | struct scatterlist *lsg = sg_last(qc->__sg, qc->n_elem); | ||
4953 | struct ata_port *ap = qc->ap; | 4956 | struct ata_port *ap = qc->ap; |
4954 | struct page *page; | 4957 | struct page *page; |
4955 | unsigned char *buf; | 4958 | unsigned char *buf; |
4956 | unsigned int offset, count; | 4959 | unsigned int offset, count; |
4960 | int no_more_sg = 0; | ||
4957 | 4961 | ||
4958 | if (qc->curbytes + bytes >= qc->nbytes) | 4962 | if (qc->curbytes + bytes >= qc->nbytes) |
4959 | ap->hsm_task_state = HSM_ST_LAST; | 4963 | ap->hsm_task_state = HSM_ST_LAST; |
4960 | 4964 | ||
4961 | next_sg: | 4965 | next_sg: |
4962 | if (unlikely(qc->cursg >= qc->n_elem)) { | 4966 | if (unlikely(no_more_sg)) { |
4963 | /* | 4967 | /* |
4964 | * The end of qc->sg is reached and the device expects | 4968 | * The end of qc->sg is reached and the device expects |
4965 | * more data to transfer. In order not to overrun qc->sg | 4969 | * more data to transfer. In order not to overrun qc->sg |
@@ -4982,7 +4986,7 @@ next_sg: | |||
4982 | return; | 4986 | return; |
4983 | } | 4987 | } |
4984 | 4988 | ||
4985 | sg = &qc->__sg[qc->cursg]; | 4989 | sg = qc->cursg; |
4986 | 4990 | ||
4987 | page = sg->page; | 4991 | page = sg->page; |
4988 | offset = sg->offset + qc->cursg_ofs; | 4992 | offset = sg->offset + qc->cursg_ofs; |
@@ -5021,7 +5025,10 @@ next_sg: | |||
5021 | qc->cursg_ofs += count; | 5025 | qc->cursg_ofs += count; |
5022 | 5026 | ||
5023 | if (qc->cursg_ofs == sg->length) { | 5027 | if (qc->cursg_ofs == sg->length) { |
5024 | qc->cursg++; | 5028 | if (qc->cursg == lsg) |
5029 | no_more_sg = 1; | ||
5030 | |||
5031 | qc->cursg = sg_next(qc->cursg); | ||
5025 | qc->cursg_ofs = 0; | 5032 | qc->cursg_ofs = 0; |
5026 | } | 5033 | } |
5027 | 5034 | ||
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 5237a491622b..9fbb39cd0f58 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -801,8 +801,6 @@ int ata_scsi_slave_config(struct scsi_device *sdev) | |||
801 | 801 | ||
802 | ata_scsi_sdev_config(sdev); | 802 | ata_scsi_sdev_config(sdev); |
803 | 803 | ||
804 | blk_queue_max_phys_segments(sdev->request_queue, LIBATA_MAX_PRD); | ||
805 | |||
806 | sdev->manage_start_stop = 1; | 804 | sdev->manage_start_stop = 1; |
807 | 805 | ||
808 | if (dev) | 806 | if (dev) |