History

blk_end_request: changing ide normal caller (take 4)

This patch converts "normal" parts of ide to use blk_end_request interfaces. Related 'uptodate' arguments are converted to 'error'. The conversion of 'uptodate' to 'error' is done only for the internal function, __ide_end_request(). ide_end_request() was not changed since it's exported and used by many ide drivers. With this patch, blkdev_dequeue_request() in __ide_end_request() is moved to blk_end_request, since blk_end_request takes care of dequeueing request like below: if (!list_empty(&rq->queuelist)) blkdev_dequeue_request(rq); In the case of ide, o 'dequeue' variable of __ide_end_request() is 1 only when the request is still linked to the queue (i.e. rq->queuelist is not empty) o 'dequeue' variable of __ide_end_request() is 0 only when the request has already been removed from the queue (i.e. rq->queuelist is empty) So blk_end_request can handle it correctly although ide always run thought the code above.

Kiyoshi Ueda committed 18 years ago

Commit 5e36bb61 parent ea6f06f2 files · +15 −16Browse files

Unified · Split

2 files
  1. drivers/ide/ide-cd.c +3 −3
  2. drivers/ide/ide-io.c +12 −13
drivers/ide/ide-cd.c+3−3
@@ -655,9 +655,9 @@ static void cdrom_end_request (ide_drive_t *drive, int uptodate) · 654 unmodified lines
655655 BUG();
656656 } else {
657657 spin_lock_irqsave(&ide_lock, flags);
658− end_that_request_chunk(failed, 0,
659− failed->data_len);
660− end_that_request_last(failed, 0);
658+ if (__blk_end_request(failed, -EIO,
659+ failed->data_len))
660+ BUG();
661661 spin_unlock_irqrestore(&ide_lock, flags);
662662 }
663663 } else
drivers/ide/ide-io.c+12−13
@@ -58,15 +58,19 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq, · 57 unmodified lines
5858 int uptodate, unsigned int nr_bytes, int dequeue)
5959 {
6060 int ret = 1;
61+ int error = 0;
62+
63+ if (uptodate <= 0)
64+ error = uptodate ? uptodate : -EIO;
6165
6266 /*
6367 * if failfast is set on a request, override number of sectors and
6468 * complete the whole request right now
6569 */
66− if (blk_noretry_request(rq) && end_io_error(uptodate))
70+ if (blk_noretry_request(rq) && error)
6771 nr_bytes = rq->hard_nr_sectors << 9;
6872
69− if (!blk_fs_request(rq) && end_io_error(uptodate) && !rq->errors)
73+ if (!blk_fs_request(rq) && error && !rq->errors)
7074 rq->errors = -EIO;
7175
7276 /*
@@ -78,14 +82,9 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq, · 5 unmodified lines
7882 ide_dma_on(drive);
7983 }
8084
81− if (!end_that_request_chunk(rq, uptodate, nr_bytes)) {
82− add_disk_randomness(rq->rq_disk);
83− if (dequeue) {
84− if (!list_empty(&rq->queuelist))
85− blkdev_dequeue_request(rq);
85+ if (!__blk_end_request(rq, error, nr_bytes)) {
86+ if (dequeue)
8687 HWGROUP(drive)->rq = NULL;
87− }
88− end_that_request_last(rq, uptodate);
8988 ret = 0;
9089 }
9190
@@ -290,9 +289,9 @@ static void ide_complete_pm_request (ide_drive_t *drive, struct request *rq) · 198 unmodified lines
290289 drive->blocked = 0;
291290 blk_start_queue(drive->queue);
292291 }
293− blkdev_dequeue_request(rq);
294292 HWGROUP(drive)->rq = NULL;
295− end_that_request_last(rq, 1);
293+ if (__blk_end_request(rq, 0, 0))
294+ BUG();
296295 spin_unlock_irqrestore(&ide_lock, flags);
297296 }
298297
@@ -387,10 +386,10 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) · 88 unmodified lines
387386 }
388387
389388 spin_lock_irqsave(&ide_lock, flags);
390− blkdev_dequeue_request(rq);
391389 HWGROUP(drive)->rq = NULL;
392390 rq->errors = err;
393− end_that_request_last(rq, !rq->errors);
391+ if (__blk_end_request(rq, (rq->errors ? -EIO : 0), 0))
392+ BUG();
394393 spin_unlock_irqrestore(&ide_lock, flags);
395394 }
396395

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t