Skip to content

Commit

Permalink
xsysace: dequeue in-flight request
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tejun Heo authored and Jens Axboe committed May 11, 2009
1 parent f4bd4b9 commit 2d75ce0
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions drivers/block/xsysace.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,8 @@ struct request *ace_get_next_request(struct request_queue * q)
while ((req = elv_next_request(q)) != NULL) {
if (blk_fs_request(req))
break;
__blk_end_request_cur(req, -EIO);
blkdev_dequeue_request(req);
__blk_end_request_all(req, -EIO);
}
return req;
}
Expand All @@ -492,9 +493,15 @@ static void ace_fsm_dostate(struct ace_device *ace)
set_capacity(ace->gd, 0);
dev_info(ace->dev, "No CF in slot\n");

/* Drop all pending requests */
while ((req = elv_next_request(ace->queue)) != NULL)
__blk_end_request_cur(req, -EIO);
/* Drop all in-flight and pending requests */
if (ace->req) {
__blk_end_request_all(ace->req, -EIO);
ace->req = NULL;
}
while ((req = elv_next_request(ace->queue)) != NULL) {
blkdev_dequeue_request(req);
__blk_end_request_all(req, -EIO);
}

/* Drop back to IDLE state and notify waiters */
ace->fsm_state = ACE_FSM_STATE_IDLE;
Expand Down Expand Up @@ -642,6 +649,7 @@ static void ace_fsm_dostate(struct ace_device *ace)
ace->fsm_state = ACE_FSM_STATE_IDLE;
break;
}
blkdev_dequeue_request(req);

/* Okay, it's a data request, set it up for transfer */
dev_dbg(ace->dev,
Expand Down Expand Up @@ -718,8 +726,7 @@ static void ace_fsm_dostate(struct ace_device *ace)
}

/* bio finished; is there another one? */
if (__blk_end_request(ace->req, 0,
blk_rq_cur_bytes(ace->req))) {
if (__blk_end_request_cur(ace->req, 0)) {
/* dev_dbg(ace->dev, "next block; h=%u c=%u\n",
* blk_rq_sectors(ace->req),
* blk_rq_cur_sectors(ace->req));
Expand Down

0 comments on commit 2d75ce0

Please sign in to comment.