Skip to content

Commit

Permalink
[PATCH] Fix cfq_find_next_crq()
Browse files Browse the repository at this point in the history
In cfq_find_next_crq(), cfq tries to find the next request by choosing
one of two requests before and after the current one.  Currently, when
choosing the next request, if there's no next request, the next
candidate is NULL, resulting in selection of the previous request.  This
results in weird scheduling.  Once we reach the end, we always seek
backward.

The correct behavior is using the first request as the next candidate.
cfq_choose_req() already has logics for handling wrapped requests.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Jens Axboe authored and Linus Torvalds committed Jun 27, 2005
1 parent 22e2c50 commit 3d25f35
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,10 @@ cfq_find_next_crq(struct cfq_data *cfqd, struct cfq_queue *cfqq,
struct cfq_rq *crq_next = NULL, *crq_prev = NULL;
struct rb_node *rbnext, *rbprev;

rbnext = NULL;
if (ON_RB(&last->rb_node))
rbnext = rb_next(&last->rb_node);
else {
if (!rbnext) {
rbnext = rb_first(&cfqq->sort_list);
if (rbnext == &last->rb_node)
rbnext = NULL;
Expand Down

0 comments on commit 3d25f35

Please sign in to comment.