diff options
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r-- | drivers/ide/ide-io.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index e5fcb283702a..c38426de6041 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -54,24 +54,9 @@ | |||
54 | #include <asm/uaccess.h> | 54 | #include <asm/uaccess.h> |
55 | #include <asm/io.h> | 55 | #include <asm/io.h> |
56 | 56 | ||
57 | int ide_end_rq(ide_drive_t *drive, struct request *rq, int uptodate, | 57 | int ide_end_rq(ide_drive_t *drive, struct request *rq, int error, |
58 | unsigned int nr_bytes) | 58 | unsigned int nr_bytes) |
59 | { | 59 | { |
60 | int error = 0; | ||
61 | |||
62 | if (uptodate <= 0) | ||
63 | error = uptodate ? uptodate : -EIO; | ||
64 | |||
65 | /* | ||
66 | * if failfast is set on a request, override number of sectors and | ||
67 | * complete the whole request right now | ||
68 | */ | ||
69 | if (blk_noretry_request(rq) && error) | ||
70 | nr_bytes = rq->hard_nr_sectors << 9; | ||
71 | |||
72 | if (!blk_fs_request(rq) && error && !rq->errors) | ||
73 | rq->errors = -EIO; | ||
74 | |||
75 | /* | 60 | /* |
76 | * decide whether to reenable DMA -- 3 is a random magic for now, | 61 | * decide whether to reenable DMA -- 3 is a random magic for now, |
77 | * if we DMA timeout more than 3 times, just stay in PIO | 62 | * if we DMA timeout more than 3 times, just stay in PIO |
@@ -101,7 +86,7 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) | |||
101 | { | 86 | { |
102 | unsigned int nr_bytes = nr_sectors << 9; | 87 | unsigned int nr_bytes = nr_sectors << 9; |
103 | struct request *rq = drive->hwif->rq; | 88 | struct request *rq = drive->hwif->rq; |
104 | int rc; | 89 | int rc, error = 0; |
105 | 90 | ||
106 | if (!nr_bytes) { | 91 | if (!nr_bytes) { |
107 | if (blk_pc_request(rq)) | 92 | if (blk_pc_request(rq)) |
@@ -110,7 +95,20 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) | |||
110 | nr_bytes = rq->hard_cur_sectors << 9; | 95 | nr_bytes = rq->hard_cur_sectors << 9; |
111 | } | 96 | } |
112 | 97 | ||
113 | rc = ide_end_rq(drive, rq, uptodate, nr_bytes); | 98 | /* |
99 | * if failfast is set on a request, override number of sectors | ||
100 | * and complete the whole request right now | ||
101 | */ | ||
102 | if (blk_noretry_request(rq) && uptodate <= 0) | ||
103 | nr_bytes = rq->hard_nr_sectors << 9; | ||
104 | |||
105 | if (blk_fs_request(rq) == 0 && uptodate <= 0 && rq->errors == 0) | ||
106 | rq->errors = -EIO; | ||
107 | |||
108 | if (uptodate <= 0) | ||
109 | error = uptodate ? uptodate : -EIO; | ||
110 | |||
111 | rc = ide_end_rq(drive, rq, error, nr_bytes); | ||
114 | if (rc == 0) | 112 | if (rc == 0) |
115 | drive->hwif->rq = NULL; | 113 | drive->hwif->rq = NULL; |
116 | 114 | ||