Commit 404c384f authored by Linus Torvalds's avatar Linus Torvalds

Fix floppy driver end_request() handling - it used to do insane

contortions instead of just calling "end_that_request_first()" with
the proper sector count.
parent 109667f8
......@@ -2295,16 +2295,15 @@ static inline void end_request(struct request *req, int uptodate)
{
kdev_t dev = req->rq_dev;
if (end_that_request_first(req, uptodate, req->hard_cur_sectors))
if (end_that_request_first(req, uptodate, current_count_sectors))
return;
add_blkdev_randomness(major(dev));
floppy_off(DEVICE_NR(dev));
blkdev_dequeue_request(req);
end_that_request_last(req);
/* Get the next request */
req = elv_next_request(QUEUE);
CURRENT = req;
/* We're done with the request */
CURRENT = NULL;
}
......@@ -2335,27 +2334,8 @@ static void request_done(int uptodate)
/* unlock chained buffers */
spin_lock_irqsave(q->queue_lock, flags);
while (current_count_sectors && CURRENT &&
current_count_sectors >= req->current_nr_sectors){
current_count_sectors -= req->current_nr_sectors;
req->nr_sectors -= req->current_nr_sectors;
req->sector += req->current_nr_sectors;
end_request(req, 1);
}
end_request(req, 1);
spin_unlock_irqrestore(q->queue_lock, flags);
if (current_count_sectors && CURRENT) {
/* "unlock" last subsector */
req->buffer += current_count_sectors <<9;
req->current_nr_sectors -= current_count_sectors;
req->nr_sectors -= current_count_sectors;
req->sector += current_count_sectors;
return;
}
if (current_count_sectors && !CURRENT)
DPRINT("request list destroyed in floppy request done\n");
} else {
if (rq_data_dir(req) == WRITE) {
/* record write error information */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment