diff options
author | Tejun Heo <tj@kernel.org> | 2009-05-07 22:54:05 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-05-11 03:52:15 -0400 |
commit | 2d75ce084eec2a8154225c7e978191b364029003 (patch) | |
tree | 98e529e9acb8b370841ff30a3b967e79c1ac7e05 /drivers/block/xsysace.c | |
parent | f4bd4b90bfa86e867111aa182895cb5ac203aa7a (diff) |
xsysace: dequeue in-flight request
xsysace already tracks in-flight request using ace->req. Converting
to dequeueing model is mostly a matter of adding dequeueing call after
request fetching. The only tricky part is handling CF removal which
should complete both in flight and on queue requests. Convert to
dequeueing model.
While at it, remove explicit blk_rq_cur_bytes() and use
__blk_end_request_cur() instead.
[ Impact: dequeue in-flight request ]
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block/xsysace.c')
-rw-r--r-- | drivers/block/xsysace.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index 97c99b43f881..edf137b6c379 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
@@ -466,7 +466,8 @@ struct request *ace_get_next_request(struct request_queue * q) | |||
466 | while ((req = elv_next_request(q)) != NULL) { | 466 | while ((req = elv_next_request(q)) != NULL) { |
467 | if (blk_fs_request(req)) | 467 | if (blk_fs_request(req)) |
468 | break; | 468 | break; |
469 | __blk_end_request_cur(req, -EIO); | 469 | blkdev_dequeue_request(req); |
470 | __blk_end_request_all(req, -EIO); | ||
470 | } | 471 | } |
471 | return req; | 472 | return req; |
472 | } | 473 | } |
@@ -492,9 +493,15 @@ static void ace_fsm_dostate(struct ace_device *ace) | |||
492 | set_capacity(ace->gd, 0); | 493 | set_capacity(ace->gd, 0); |
493 | dev_info(ace->dev, "No CF in slot\n"); | 494 | dev_info(ace->dev, "No CF in slot\n"); |
494 | 495 | ||
495 | /* Drop all pending requests */ | 496 | /* Drop all in-flight and pending requests */ |
496 | while ((req = elv_next_request(ace->queue)) != NULL) | 497 | if (ace->req) { |
497 | __blk_end_request_cur(req, -EIO); | 498 | __blk_end_request_all(ace->req, -EIO); |
499 | ace->req = NULL; | ||
500 | } | ||
501 | while ((req = elv_next_request(ace->queue)) != NULL) { | ||
502 | blkdev_dequeue_request(req); | ||
503 | __blk_end_request_all(req, -EIO); | ||
504 | } | ||
498 | 505 | ||
499 | /* Drop back to IDLE state and notify waiters */ | 506 | /* Drop back to IDLE state and notify waiters */ |
500 | ace->fsm_state = ACE_FSM_STATE_IDLE; | 507 | ace->fsm_state = ACE_FSM_STATE_IDLE; |
@@ -642,6 +649,7 @@ static void ace_fsm_dostate(struct ace_device *ace) | |||
642 | ace->fsm_state = ACE_FSM_STATE_IDLE; | 649 | ace->fsm_state = ACE_FSM_STATE_IDLE; |
643 | break; | 650 | break; |
644 | } | 651 | } |
652 | blkdev_dequeue_request(req); | ||
645 | 653 | ||
646 | /* Okay, it's a data request, set it up for transfer */ | 654 | /* Okay, it's a data request, set it up for transfer */ |
647 | dev_dbg(ace->dev, | 655 | dev_dbg(ace->dev, |
@@ -718,8 +726,7 @@ static void ace_fsm_dostate(struct ace_device *ace) | |||
718 | } | 726 | } |
719 | 727 | ||
720 | /* bio finished; is there another one? */ | 728 | /* bio finished; is there another one? */ |
721 | if (__blk_end_request(ace->req, 0, | 729 | if (__blk_end_request_cur(ace->req, 0)) { |
722 | blk_rq_cur_bytes(ace->req))) { | ||
723 | /* dev_dbg(ace->dev, "next block; h=%u c=%u\n", | 730 | /* dev_dbg(ace->dev, "next block; h=%u c=%u\n", |
724 | * blk_rq_sectors(ace->req), | 731 | * blk_rq_sectors(ace->req), |
725 | * blk_rq_cur_sectors(ace->req)); | 732 | * blk_rq_cur_sectors(ace->req)); |