aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2005-06-27 04:55:49 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-27 17:33:29 -0400
commit3d25f3566bb606720a67caef77b16190df10dd98 (patch)
treeb80225d86859487b6a8eb62126d9de31c7cbf26e
parent22e2c507c301c3dbbcf91b4948b88f78842ee6c9 (diff)
[PATCH] Fix cfq_find_next_crq()
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>
-rw-r--r--drivers/block/cfq-iosched.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/block/cfq-iosched.c b/drivers/block/cfq-iosched.c
index 35f6e569d5e5..baa3e268250a 100644
--- a/drivers/block/cfq-iosched.c
+++ b/drivers/block/cfq-iosched.c
@@ -375,9 +375,10 @@ cfq_find_next_crq(struct cfq_data *cfqd, struct cfq_queue *cfqq,
375 struct cfq_rq *crq_next = NULL, *crq_prev = NULL; 375 struct cfq_rq *crq_next = NULL, *crq_prev = NULL;
376 struct rb_node *rbnext, *rbprev; 376 struct rb_node *rbnext, *rbprev;
377 377
378 rbnext = NULL;
378 if (ON_RB(&last->rb_node)) 379 if (ON_RB(&last->rb_node))
379 rbnext = rb_next(&last->rb_node); 380 rbnext = rb_next(&last->rb_node);
380 else { 381 if (!rbnext) {
381 rbnext = rb_first(&cfqq->sort_list); 382 rbnext = rb_first(&cfqq->sort_list);
382 if (rbnext == &last->rb_node) 383 if (rbnext == &last->rb_node)
383 rbnext = NULL; 384 rbnext = NULL;