aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-05-07 22:54:09 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-05-11 03:52:16 -0400
commit06b0608e2b46465e8e663214e7db982ddb000346 (patch)
tree70ad957fc0715fe52fe9dc9b0dac51c63f468518 /drivers/block
parent9e31bebee2d8b5f8abe9677f2a29b90cba848657 (diff)
swim: dequeue in-flight request
swim processes requests one-by-one synchronously and can easily be converted to dequeuing model. Convert it. [ Impact: dequeue in-flight request ] Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Laurent Vivier <Laurent@lvivier.info> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/swim.c47
1 files changed, 23 insertions, 24 deletions
diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index fc6a1c322933..dedd4893f5ea 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -514,7 +514,7 @@ static int floppy_read_sectors(struct floppy_state *fs,
514 ret = swim_read_sector(fs, side, track, sector, 514 ret = swim_read_sector(fs, side, track, sector,
515 buffer); 515 buffer);
516 if (try-- == 0) 516 if (try-- == 0)
517 return -1; 517 return -EIO;
518 } while (ret != 512); 518 } while (ret != 512);
519 519
520 buffer += ret; 520 buffer += ret;
@@ -528,38 +528,37 @@ static void redo_fd_request(struct request_queue *q)
528 struct request *req; 528 struct request *req;
529 struct floppy_state *fs; 529 struct floppy_state *fs;
530 530
531 while ((req = elv_next_request(q))) { 531 req = elv_next_request(q);
532 if (req)
533 blkdev_dequeue_request(req);
534
535 while (req) {
536 int err = -EIO;
532 537
533 fs = req->rq_disk->private_data; 538 fs = req->rq_disk->private_data;
534 if (blk_rq_pos(req) >= fs->total_secs) { 539 if (blk_rq_pos(req) >= fs->total_secs)
535 __blk_end_request_cur(req, -EIO); 540 goto done;
536 continue; 541 if (!fs->disk_in)
537 } 542 goto done;
538 if (!fs->disk_in) { 543 if (rq_data_dir(req) == WRITE && fs->write_protected)
539 __blk_end_request_cur(req, -EIO); 544 goto done;
540 continue; 545
541 }
542 if (rq_data_dir(req) == WRITE) {
543 if (fs->write_protected) {
544 __blk_end_request_cur(req, -EIO);
545 continue;
546 }
547 }
548 switch (rq_data_dir(req)) { 546 switch (rq_data_dir(req)) {
549 case WRITE: 547 case WRITE:
550 /* NOT IMPLEMENTED */ 548 /* NOT IMPLEMENTED */
551 __blk_end_request_cur(req, -EIO);
552 break; 549 break;
553 case READ: 550 case READ:
554 if (floppy_read_sectors(fs, blk_rq_pos(req), 551 err = floppy_read_sectors(fs, blk_rq_pos(req),
555 blk_rq_cur_sectors(req), 552 blk_rq_cur_sectors(req),
556 req->buffer)) { 553 req->buffer);
557 __blk_end_request_cur(req, -EIO);
558 continue;
559 }
560 __blk_end_request_cur(req, 0);
561 break; 554 break;
562 } 555 }
556 done:
557 if (!__blk_end_request_cur(req, err)) {
558 req = elv_next_request(q);
559 if (req)
560 blkdev_dequeue_request(req);
561 }
563 } 562 }
564} 563}
565 564