Re: ioevent queues (was Re: Proposed new poll2() syscall)

Mike Jagdis (mike@roan.co.uk)
Tue, 26 Aug 1997 09:24:16 +0100 (GMT/BST)


On Sat, 23 Aug 1997, Erik Corry wrote:

> The next question is how to implement asynchronous IO
> efficiently. In practice you need a thread for each
> outstanding IO because the kernel is written under the
> assumption that there is a kernel stack for each IO going
> on. David Miller and Mike Jagdis are looking at doing some
> clever trickery on AIO on raw devices (which is what
> database people use AIO for) so that only a kernel thread is
> necessary, that has no user-space stack, etc.

My current thoughts are that AIO is even simpler than that, even
for files rather than just raw devices. Consider the way we do
page-ahead by simply sticking some anonymous buffer heads on a
page and letting the I/O go ahead and happen asynchronously.
It seems that doing async write is just as easy.

We just need to find out what page we are dealing with, pin it
down (incrementing the count should do?), add some buffer heads,
queue the I/O, and arrange for a call back (call out, magic
function call, whatever your terminology) to happen when the
operation finishes. For block devices we map offset to block
number directly. For files we map inode, offset to block number
using bmap just like the paging code.

The job is open if anyone wants to take a shot at it...

Mike

-- 
.----------------------------------------------------------------------.
|  Mike Jagdis                  |  Internet:  mailto:mike@roan.co.uk   |
|  Roan Technology Ltd.         |                                      |
|  54A Peach Street, Wokingham  |  Telephone:  +44 118 989 0403        |
|  RG40 1XG, ENGLAND            |  Fax:        +44 118 989 1195        |
`----------------------------------------------------------------------'