diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-27 07:46:45 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-27 07:46:45 -0400 |
commit | 130e886708d6e11f3d54e5d27c266578de56f343 (patch) | |
tree | af6c09224bd1aa21119c052cd3664719916ec795 /drivers/ide/ide-io.c | |
parent | ba7d479c36dde12821c01ad0696d678635b8fb92 (diff) |
ide: remove ide_end_request()
* Add ide_rq_bytes() helper.
* Add blk_noretry_request() quirk to ide_complete_rq() (currently only fs
requests can be marked as "noretry" so there is no change in behavior).
* Switch current ide_end_request() users to use ide_complete_rq().
[ No need to check for rq->nr_sectors == 0 in {ide_dma,task_pio}_intr(),
nsectors == 0 in cdrom_end_request() and err == 0 in ide_do_devset(). ]
* Remove no longer needed ide_end_request().
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r-- | drivers/ide/ide-io.c | 61 |
1 files changed, 18 insertions, 43 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 8e2868617a46..f59c709052d2 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -71,48 +71,6 @@ int ide_end_rq(ide_drive_t *drive, struct request *rq, int error, | |||
71 | } | 71 | } |
72 | EXPORT_SYMBOL_GPL(ide_end_rq); | 72 | EXPORT_SYMBOL_GPL(ide_end_rq); |
73 | 73 | ||
74 | /** | ||
75 | * ide_end_request - complete an IDE I/O | ||
76 | * @drive: IDE device for the I/O | ||
77 | * @uptodate: | ||
78 | * @nr_sectors: number of sectors completed | ||
79 | * | ||
80 | * This is our end_request wrapper function. We complete the I/O | ||
81 | * update random number input and dequeue the request, which if | ||
82 | * it was tagged may be out of order. | ||
83 | */ | ||
84 | |||
85 | int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) | ||
86 | { | ||
87 | unsigned int nr_bytes = nr_sectors << 9; | ||
88 | struct request *rq = drive->hwif->rq; | ||
89 | int rc, error = 0; | ||
90 | |||
91 | if (!nr_bytes) { | ||
92 | if (blk_pc_request(rq)) | ||
93 | nr_bytes = rq->data_len; | ||
94 | else | ||
95 | nr_bytes = rq->hard_cur_sectors << 9; | ||
96 | } | ||
97 | |||
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 (uptodate <= 0) | ||
106 | error = uptodate ? uptodate : -EIO; | ||
107 | |||
108 | rc = ide_end_rq(drive, rq, error, nr_bytes); | ||
109 | if (rc == 0) | ||
110 | drive->hwif->rq = NULL; | ||
111 | |||
112 | return rc; | ||
113 | } | ||
114 | EXPORT_SYMBOL(ide_end_request); | ||
115 | |||
116 | void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) | 74 | void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) |
117 | { | 75 | { |
118 | struct ide_taskfile *tf = &cmd->tf; | 76 | struct ide_taskfile *tf = &cmd->tf; |
@@ -141,12 +99,29 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) | |||
141 | kfree(cmd); | 99 | kfree(cmd); |
142 | } | 100 | } |
143 | 101 | ||
102 | /* obsolete, blk_rq_bytes() should be used instead */ | ||
103 | unsigned int ide_rq_bytes(struct request *rq) | ||
104 | { | ||
105 | if (blk_pc_request(rq)) | ||
106 | return rq->data_len; | ||
107 | else | ||
108 | return rq->hard_cur_sectors << 9; | ||
109 | } | ||
110 | EXPORT_SYMBOL_GPL(ide_rq_bytes); | ||
111 | |||
144 | int ide_complete_rq(ide_drive_t *drive, int error, unsigned int nr_bytes) | 112 | int ide_complete_rq(ide_drive_t *drive, int error, unsigned int nr_bytes) |
145 | { | 113 | { |
146 | ide_hwif_t *hwif = drive->hwif; | 114 | ide_hwif_t *hwif = drive->hwif; |
147 | struct request *rq = hwif->rq; | 115 | struct request *rq = hwif->rq; |
148 | int rc; | 116 | int rc; |
149 | 117 | ||
118 | /* | ||
119 | * if failfast is set on a request, override number of sectors | ||
120 | * and complete the whole request right now | ||
121 | */ | ||
122 | if (blk_noretry_request(rq) && error <= 0) | ||
123 | nr_bytes = rq->hard_nr_sectors << 9; | ||
124 | |||
150 | rc = ide_end_rq(drive, rq, error, nr_bytes); | 125 | rc = ide_end_rq(drive, rq, error, nr_bytes); |
151 | if (rc == 0) | 126 | if (rc == 0) |
152 | hwif->rq = NULL; | 127 | hwif->rq = NULL; |
@@ -170,7 +145,7 @@ void ide_kill_rq(ide_drive_t *drive, struct request *rq) | |||
170 | rq->errors = IDE_DRV_ERROR_GENERAL; | 145 | rq->errors = IDE_DRV_ERROR_GENERAL; |
171 | else if (blk_fs_request(rq) == 0 && rq->errors == 0) | 146 | else if (blk_fs_request(rq) == 0 && rq->errors == 0) |
172 | rq->errors = -EIO; | 147 | rq->errors = -EIO; |
173 | ide_end_request(drive, 0, 0); | 148 | ide_complete_rq(drive, -EIO, ide_rq_bytes(rq)); |
174 | } | 149 | } |
175 | } | 150 | } |
176 | 151 | ||