Skip to content

Commit 2d75ce0

Browse files
htejunJens Axboe
authored andcommitted
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>
1 parent f4bd4b9 commit 2d75ce0

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

‎drivers/block/xsysace.c‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,8 @@ struct request *ace_get_next_request(struct request_queue * q)
466466
while ((req = elv_next_request(q)) != NULL) {
467467
if (blk_fs_request(req))
468468
break;
469-
__blk_end_request_cur(req, -EIO);
469+
blkdev_dequeue_request(req);
470+
__blk_end_request_all(req, -EIO);
470471
}
471472
return req;
472473
}
@@ -492,9 +493,15 @@ static void ace_fsm_dostate(struct ace_device *ace)
492493
set_capacity(ace->gd, 0);
493494
dev_info(ace->dev, "No CF in slot\n");
494495

495-
/* Drop all pending requests */
496-
while ((req = elv_next_request(ace->queue)) != NULL)
497-
__blk_end_request_cur(req, -EIO);
496+
/* Drop all in-flight and pending requests */
497+
if (ace->req) {
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+
}
498505

499506
/* Drop back to IDLE state and notify waiters */
500507
ace->fsm_state = ACE_FSM_STATE_IDLE;
@@ -642,6 +649,7 @@ static void ace_fsm_dostate(struct ace_device *ace)
642649
ace->fsm_state = ACE_FSM_STATE_IDLE;
643650
break;
644651
}
652+
blkdev_dequeue_request(req);
645653

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

720728
/* bio finished; is there another one? */
721-
if (__blk_end_request(ace->req, 0,
722-
blk_rq_cur_bytes(ace->req))) {
729+
if (__blk_end_request_cur(ace->req, 0)) {
723730
/* dev_dbg(ace->dev, "next block; h=%u c=%u\n",
724731
* blk_rq_sectors(ace->req),
725732
* blk_rq_cur_sectors(ace->req));

0 commit comments

Comments
 (0)