lkml.org 
[lkml]   [2007]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Need information on elevator_dispatch_fn
On Wed, Oct 31 2007, Philipp Gruber wrote:
> Hello everyone,
>
> I'm just working on an I/O-scheduler that implements some QoS
> functionality.
>
> Now I get some weird problems and need to know what triggers my
> elevator_dispatch_fn, and how the return value of it is handled.
> For now, I found that the dispatch function is called as long as there
> are requests in my queue, so probably as long as it returns 1. On the
> other hand, only every second dispatch call returns 1, the others 0, but
> still it's working. I couldn't find any documentation about that (but
> would like to write some, if I understood it). Could someone please
> explain me when and why exactly elevator_dispatch_fn is triggered?

elevator_dispatch_fn() is in charge of putting request on the dispatch
list. So it'll be called, if q->queue_head is empty to refill that. The
core is __elv_next_request(), which is called when a block driver wants
to queue more IO. The logic is essentially:

elv_next_request()
{
while (1) {
if (!list_empty(&q->queue_head))
return first rq of list
if (!elevator_dispatch_fn())
return NULL;
}
}

So if you queue_head is empty AND elevator_dispatch_fn returns 0, then
no request is given to the driver. IF elevator_dispatch_fn returns
non-zero, then it MUST have put request on the queue_head list.

--
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-10-31 12:03    [W:0.036 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site