2003-07-09 00:42:33

by Daniel McNeil

[permalink] [raw]
Subject: [PATCH libaio] add timeout to io_queue_run and remove io_queue_wait

Here is a patch to libaio which adds a timeout parameter to
io_queue_run() and removes io_queue_wait(). This makes my
earlier kernel patch to fs/aio.c unnecessary, since I removed
io_queue_wait() which was calling the io_getevents() syscall
with a zero number of events. This keeps the callback interface
in the library and allows a user process to wait for i/o's to
complete if it wants to. I also changed io_queue_run() to
batch up to 8 completions at a time, so it is more efficient.
This requires no kernel changes. I also updated the io_queue_run()
man page and that is in a separate patch.

Thoughts?

Daniel McNeil <[email protected]


Attachments:
patch.libaio.io_queue_run (2.90 kB)
patch.libaio.man.io_queue_run (1.39 kB)
Download all attachments

2003-07-09 23:38:50

by Daniel McNeil

[permalink] [raw]
Subject: Re: [PATCH libaio] add timeout to io_queue_run and remove io_queue_wait

On Wed, 2003-07-09 at 15:31, John Myers wrote:
> Daniel McNeil wrote:
>
> >Thoughts?
> >
> >
> I don't think io_queue_run() is particularly worthwhile. Applications
> are much better off coding that loop themselves, so they can control
> such things as how many events they ask for in a call to io_getevents()
> and how they handle process shutdown. Besides, io_queue_run()'s
> handling of EINTR isn't particularly good.
>
> io_queue_run() is basically for legacy apps. Your patch changes its
> signature, which breaks its only use.
>

If any application is using io_queue_run()/io_queue_wait(), it is
wasting a bunch of cpu time because io_queue_wait() is never waiting.
So, yes, this would break any existing application which is using
the currently broken io_queue_wait(). Is there any "legacy" app using
this? How long have the interfaces been around?

If io_queue_run()/io_queue_wait() isn't worthwhile, then it should be
removed. If having a callback interface is worthwhile, I vote for
fixing it. So the choices are:

1. patch kernel to get io_queue_wait() to actually wait. (see my earlier
patch).

2. Change the libaio callback interfaces so that it blocks without
patching the kernel. (This patch does that).

3. remove io_queue_run()/io_queue_wait() if they are not worthwhile.

I agree that the io_getevents() is sufficient, but it doesn't hurt
having the callback interface (if it actually worked correctly).

Daniel

2003-07-10 22:22:47

by John Myers

[permalink] [raw]
Subject: Re: [PATCH libaio] add timeout to io_queue_run and remove io_queue_wait

Looking through the linux-aio archives, it seems I was confusing
io_queue_run() with io_queue_init() and io_queue_release(), which Ben
LaHaise reports as being used by Oracle. In any case, I have no
objection to removing io_queue_run() or io_queue_wait(). But then I
don't maintain the library.