diff options
-rw-r--r-- | block/elevator.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/block/elevator.c b/block/elevator.c index 99a4d7b2f8ad..1d0759178e4b 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -610,23 +610,23 @@ void elv_completed_request(request_queue_t *q, struct request *rq) | |||
610 | * request is released from the driver, io must be done | 610 | * request is released from the driver, io must be done |
611 | */ | 611 | */ |
612 | if (blk_account_rq(rq)) { | 612 | if (blk_account_rq(rq)) { |
613 | struct request *first_rq = list_entry_rq(q->queue_head.next); | ||
614 | |||
615 | q->in_flight--; | 613 | q->in_flight--; |
614 | if (blk_sorted_rq(rq) && e->ops->elevator_completed_req_fn) | ||
615 | e->ops->elevator_completed_req_fn(q, rq); | ||
616 | } | ||
616 | 617 | ||
617 | /* | 618 | /* |
618 | * Check if the queue is waiting for fs requests to be | 619 | * Check if the queue is waiting for fs requests to be |
619 | * drained for flush sequence. | 620 | * drained for flush sequence. |
620 | */ | 621 | */ |
621 | if (q->ordseq && q->in_flight == 0 && | 622 | if (unlikely(q->ordseq)) { |
623 | struct request *first_rq = list_entry_rq(q->queue_head.next); | ||
624 | if (q->in_flight == 0 && | ||
622 | blk_ordered_cur_seq(q) == QUEUE_ORDSEQ_DRAIN && | 625 | blk_ordered_cur_seq(q) == QUEUE_ORDSEQ_DRAIN && |
623 | blk_ordered_req_seq(first_rq) > QUEUE_ORDSEQ_DRAIN) { | 626 | blk_ordered_req_seq(first_rq) > QUEUE_ORDSEQ_DRAIN) { |
624 | blk_ordered_complete_seq(q, QUEUE_ORDSEQ_DRAIN, 0); | 627 | blk_ordered_complete_seq(q, QUEUE_ORDSEQ_DRAIN, 0); |
625 | q->request_fn(q); | 628 | q->request_fn(q); |
626 | } | 629 | } |
627 | |||
628 | if (blk_sorted_rq(rq) && e->ops->elevator_completed_req_fn) | ||
629 | e->ops->elevator_completed_req_fn(q, rq); | ||
630 | } | 630 | } |
631 | } | 631 | } |
632 | 632 | ||