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/ide/ide-taskfile.c | |
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/ide/ide-taskfile.c')
-rw-r--r-- | drivers/ide/ide-taskfile.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index aa06dafb74ac..2a3c8d498343 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/hdreg.h> | 45 | #include <linux/hdreg.h> |
46 | #include <linux/ide.h> | 46 | #include <linux/ide.h> |
47 | #include <linux/bitops.h> | 47 | #include <linux/bitops.h> |
48 | #include <linux/scatterlist.h> | ||
48 | 49 | ||
49 | #include <asm/byteorder.h> | 50 | #include <asm/byteorder.h> |
50 | #include <asm/irq.h> | 51 | #include <asm/irq.h> |
@@ -263,6 +264,7 @@ static void ide_pio_sector(ide_drive_t *drive, unsigned int write) | |||
263 | { | 264 | { |
264 | ide_hwif_t *hwif = drive->hwif; | 265 | ide_hwif_t *hwif = drive->hwif; |
265 | struct scatterlist *sg = hwif->sg_table; | 266 | struct scatterlist *sg = hwif->sg_table; |
267 | struct scatterlist *cursg = hwif->cursg; | ||
266 | struct page *page; | 268 | struct page *page; |
267 | #ifdef CONFIG_HIGHMEM | 269 | #ifdef CONFIG_HIGHMEM |
268 | unsigned long flags; | 270 | unsigned long flags; |
@@ -270,8 +272,14 @@ static void ide_pio_sector(ide_drive_t *drive, unsigned int write) | |||
270 | unsigned int offset; | 272 | unsigned int offset; |
271 | u8 *buf; | 273 | u8 *buf; |
272 | 274 | ||
273 | page = sg[hwif->cursg].page; | 275 | cursg = hwif->cursg; |
274 | offset = sg[hwif->cursg].offset + hwif->cursg_ofs * SECTOR_SIZE; | 276 | if (!cursg) { |
277 | cursg = sg; | ||
278 | hwif->cursg = sg; | ||
279 | } | ||
280 | |||
281 | page = cursg->page; | ||
282 | offset = cursg->offset + hwif->cursg_ofs * SECTOR_SIZE; | ||
275 | 283 | ||
276 | /* get the current page and offset */ | 284 | /* get the current page and offset */ |
277 | page = nth_page(page, (offset >> PAGE_SHIFT)); | 285 | page = nth_page(page, (offset >> PAGE_SHIFT)); |
@@ -285,8 +293,8 @@ static void ide_pio_sector(ide_drive_t *drive, unsigned int write) | |||
285 | hwif->nleft--; | 293 | hwif->nleft--; |
286 | hwif->cursg_ofs++; | 294 | hwif->cursg_ofs++; |
287 | 295 | ||
288 | if ((hwif->cursg_ofs * SECTOR_SIZE) == sg[hwif->cursg].length) { | 296 | if ((hwif->cursg_ofs * SECTOR_SIZE) == cursg->length) { |
289 | hwif->cursg++; | 297 | hwif->cursg = sg_next(hwif->cursg); |
290 | hwif->cursg_ofs = 0; | 298 | hwif->cursg_ofs = 0; |
291 | } | 299 | } |
292 | 300 | ||
@@ -367,6 +375,8 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq, | |||
367 | 375 | ||
368 | static void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) | 376 | static void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) |
369 | { | 377 | { |
378 | HWIF(drive)->cursg = NULL; | ||
379 | |||
370 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { | 380 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { |
371 | ide_task_t *task = rq->special; | 381 | ide_task_t *task = rq->special; |
372 | 382 | ||