X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=block%2Fdeadline-iosched.c;h=342448c3d2ddf20432410b121ef3060859c998d3;hb=9ea319b61613085f501a79cf8d405cb221d084f3;hp=cb94c838087a75f544df130bb51873270b55fa25;hpb=dfb3d72a9aa519672c9ae06f0d2f93eccb35482f;p=linux-2.6 diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c index cb94c83808..342448c3d2 100644 --- a/block/deadline-iosched.c +++ b/block/deadline-iosched.c @@ -306,27 +306,20 @@ dispatch_writes: dispatch_find_request: /* * we are not running a batch, find best request for selected data_dir - * and start a new batch */ - if (deadline_check_fifo(dd, data_dir)) { - /* An expired request exists - satisfy it */ + if (deadline_check_fifo(dd, data_dir) || !dd->next_rq[data_dir]) { + /* + * A deadline has expired, the last request was in the other + * direction, or we have run out of higher-sectored requests. + * Start again from the request with the earliest expiry time. + */ rq = rq_entry_fifo(dd->fifo_list[data_dir].next); - } else if (dd->next_rq[data_dir]) { + } else { /* * The last req was the same dir and we have a next request in * sort order. No expired requests so continue on from here. */ rq = dd->next_rq[data_dir]; - } else { - struct rb_node *node; - /* - * The last req was the other direction or we have run out of - * higher-sectored requests. Go back to the lowest sectored - * request (1 way elevator) and start a new batch. - */ - node = rb_first(&dd->sort_list[data_dir]); - if (node) - rq = rb_entry_rq(node); } dd->batching = 0; @@ -474,7 +467,9 @@ static struct elevator_type iosched_deadline = { static int __init deadline_init(void) { - return elv_register(&iosched_deadline); + elv_register(&iosched_deadline); + + return 0; } static void __exit deadline_exit(void)