aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-io.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-28 16:51:32 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-28 16:51:32 -0500
commitf0f0052069989b80d2a3e50c9cd2f2a650bc1aea (patch)
tree40ff39bc341aed8318a54d1bd61a381f41844f71 /drivers/ide/ide-io.c
parent68fbda7de07e56eb90dd6e58a162527411b388b1 (diff)
parenta65b58663d983e588aed8d1bfc75edaac2527fa7 (diff)
Merge branch 'blk-end-request' of git://git.kernel.dk/linux-2.6-block
* 'blk-end-request' of git://git.kernel.dk/linux-2.6-block: (30 commits) blk_end_request: changing xsysace (take 4) blk_end_request: changing ub (take 4) blk_end_request: cleanup of request completion (take 4) blk_end_request: cleanup 'uptodate' related code (take 4) blk_end_request: remove/unexport end_that_request_* (take 4) blk_end_request: changing scsi (take 4) blk_end_request: add bidi completion interface (take 4) blk_end_request: changing ide-cd (take 4) blk_end_request: add callback feature (take 4) blk_end_request: changing ide normal caller (take 4) blk_end_request: changing cpqarray (take 4) blk_end_request: changing cciss (take 4) blk_end_request: changing ide-scsi (take 4) blk_end_request: changing s390 (take 4) blk_end_request: changing mmc (take 4) blk_end_request: changing i2o_block (take 4) blk_end_request: changing viocd (take 4) blk_end_request: changing xen-blkfront (take 4) blk_end_request: changing viodasd (take 4) blk_end_request: changing sx8 (take 4) ...
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r--drivers/ide/ide-io.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 6f8f544392a8..e6bb9cf24e3d 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -58,15 +58,19 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq,
58 int uptodate, unsigned int nr_bytes, int dequeue) 58 int uptodate, unsigned int nr_bytes, int dequeue)
59{ 59{
60 int ret = 1; 60 int ret = 1;
61 int error = 0;
62
63 if (uptodate <= 0)
64 error = uptodate ? uptodate : -EIO;
61 65
62 /* 66 /*
63 * if failfast is set on a request, override number of sectors and 67 * if failfast is set on a request, override number of sectors and
64 * complete the whole request right now 68 * complete the whole request right now
65 */ 69 */
66 if (blk_noretry_request(rq) && end_io_error(uptodate)) 70 if (blk_noretry_request(rq) && error)
67 nr_bytes = rq->hard_nr_sectors << 9; 71 nr_bytes = rq->hard_nr_sectors << 9;
68 72
69 if (!blk_fs_request(rq) && end_io_error(uptodate) && !rq->errors) 73 if (!blk_fs_request(rq) && error && !rq->errors)
70 rq->errors = -EIO; 74 rq->errors = -EIO;
71 75
72 /* 76 /*
@@ -78,14 +82,9 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq,
78 ide_dma_on(drive); 82 ide_dma_on(drive);
79 } 83 }
80 84
81 if (!end_that_request_chunk(rq, uptodate, nr_bytes)) { 85 if (!__blk_end_request(rq, error, nr_bytes)) {
82 add_disk_randomness(rq->rq_disk); 86 if (dequeue)
83 if (dequeue) {
84 if (!list_empty(&rq->queuelist))
85 blkdev_dequeue_request(rq);
86 HWGROUP(drive)->rq = NULL; 87 HWGROUP(drive)->rq = NULL;
87 }
88 end_that_request_last(rq, uptodate);
89 ret = 0; 88 ret = 0;
90 } 89 }
91 90
@@ -290,9 +289,9 @@ static void ide_complete_pm_request (ide_drive_t *drive, struct request *rq)
290 drive->blocked = 0; 289 drive->blocked = 0;
291 blk_start_queue(drive->queue); 290 blk_start_queue(drive->queue);
292 } 291 }
293 blkdev_dequeue_request(rq);
294 HWGROUP(drive)->rq = NULL; 292 HWGROUP(drive)->rq = NULL;
295 end_that_request_last(rq, 1); 293 if (__blk_end_request(rq, 0, 0))
294 BUG();
296 spin_unlock_irqrestore(&ide_lock, flags); 295 spin_unlock_irqrestore(&ide_lock, flags);
297} 296}
298 297
@@ -387,10 +386,10 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
387 } 386 }
388 387
389 spin_lock_irqsave(&ide_lock, flags); 388 spin_lock_irqsave(&ide_lock, flags);
390 blkdev_dequeue_request(rq);
391 HWGROUP(drive)->rq = NULL; 389 HWGROUP(drive)->rq = NULL;
392 rq->errors = err; 390 rq->errors = err;
393 end_that_request_last(rq, !rq->errors); 391 if (__blk_end_request(rq, (rq->errors ? -EIO : 0), 0))
392 BUG();
394 spin_unlock_irqrestore(&ide_lock, flags); 393 spin_unlock_irqrestore(&ide_lock, flags);
395} 394}
396 395