| Branch: | Revision:

root / posix-aio-compat.c @ a74cdab4

History | View | Annotate | Download (15.9 kB)

# Date Author Comment
5be4aab7 05/18/2011 03:38 pm Kevin Wolf

posix-aio-compat: Fix idle_threads counter

A thread should only be counted as idle when it really is waiting for new
requests. Without this patch, sometimes too few threads are started as busy
threads are counted as idle.

Not sure if it makes a difference in practice outside some artificial...

ddca9fb2 03/07/2011 05:34 pm Stefan Hajnoczi

trace: Trace posix-aio-compat.c completion and cancellation

This patch adds paio_complete() and paio_cancel() trace events to
complement the paio_submit() event.

Signed-off-by: Stefan Hajnoczi <>

dc786bc9 10/30/2010 11:02 am Jes Sorensen

Move qemu_gettimeofday() to OS specific files

Signed-off-by: Jes Sorensen <>
Signed-off-by: Blue Swirl <>

b0cd712c 10/05/2010 09:53 pm Stefan Weil

Fix spelling in comments

multifuction -> multifunction
successfull -> successful.

Signed-off-by: Stefan Weil <>

72aef731 09/21/2010 04:39 pm Christoph Hellwig

use qemu_blockalign consistently

Use qemu_blockalign for all allocations in the block layer. This allows
increasing the required alignment, which is need to support O_DIRECT on
devices with large block sizes.

Signed-off-by: Christoph Hellwig <>...

6d519a5f 09/10/2010 12:22 am Stefan Hajnoczi

trace: Trace virtio-blk, multiwrite, and paio_submit

This patch adds trace events that make it possible to observe

Signed-off-by: Stefan Hajnoczi <>

34cf0081 08/30/2010 07:29 pm Andrew de Quincey

posix-aio-compat: Fix async_conmtext for ioctl

Set the async_context_id field when queuing an async ioctl call

Signed-off-by: Andrew de Quincey <>
Signed-off-by: Kevin Wolf <>

b587a52c 05/28/2010 02:14 pm Stefan Hajnoczi

posix-aio-compat: Expand tabs that have crept in

This patch expands tabs on a few lines so the code formats nicely and
follows the QEMU coding style.

Signed-off-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

4817d327 01/26/2010 10:59 pm Kirill A. Shutemov

posix-aio-compat.c: fix warning with _FORTIFY_SOURCE

CC posix-aio-compat.o
cc1: warnings being treated as errors
posix-aio-compat.c: In function 'aio_signal_handler':
posix-aio-compat.c:505: error: ignoring return value of 'write', declared with attribute warn_unused_result...

6769da29 12/03/2009 11:26 pm Kevin Wolf

posix-aio-compat: Fix error check

Checking for nbytes < 0 is pointless as long as it's a size_t. If we want to
use negative numbers for error codes, we should use signed types.

Signed-off-by: Kevin Wolf <>
Signed-off-by: Anthony Liguori <>

40ff6d7e 12/03/2009 07:45 pm Kevin Wolf

Don't leak file descriptors

We're leaking file descriptors to child processes. Set FD_CLOEXEC on file
descriptors that don't need to be passed to children to stop this misbehaviour.

Signed-off-by: Kevin Wolf <>
Signed-off-by: Anthony Liguori <>

1e5b9d2f 10/30/2009 03:39 pm Kevin Wolf

Remove aio_ctx from paio_* interface

The context parameter in paio_submit isn't used anyway, so there is no reason
why block drivers should need to remember it. This also avoids passing a Linux
AIO context to paio_submit (which doesn't do any harm as long as the parameter...

8febfa26 10/27/2009 07:28 pm Kevin Wolf

Add qemu_aio_process_queue()

We'll leave some AIO completions unhandled when we can't call the callback.
qemu_aio_process_queue() is used later to run any callbacks that are left and
can be run then.

Signed-off-by: Kevin Wolf <>
Signed-off-by: Anthony Liguori <>

e5f37649 10/27/2009 07:28 pm Kevin Wolf

posix-aio-compat: Honour AsyncContext

Don't call callbacks that don't belong to the active AsyncContext.

Signed-off-by: Kevin Wolf <>
Signed-off-by: Anthony Liguori <>

59c7b155 10/27/2009 07:28 pm Kevin Wolf

posix-aio-compat: Split out posix_aio_process_queue

We need to process the request queue and run callbacks separately from reading
out the queue in a later patch, so split it out.

Signed-off-by: Kevin Wolf <>
Signed-off-by: Anthony Liguori <>

ee399306 09/27/2009 03:16 am malc

posix-aio-compat: avoid signal race when spawning a thread

Signed-off-by: malc <>

72cf2d4f 09/12/2009 10:36 am Blue Swirl

Fix sys-queue.h conflict for good

Problem: Our file sys-queue.h is a copy of the BSD file, but there are
some additions and it's not entirely compatible. Because of that, there have
been conflicts with system headers on BSD systems. Some hacks have been
introduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,...

47faadc6 09/12/2009 09:19 am Blue Swirl

Unbreak BSD: use qemu_fdatasync instead of fdatasync

Signed-off-by: Blue Swirl <>

b2e12bc6 09/11/2009 06:19 pm Christoph Hellwig

block: add aio_flush operation

Instead stalling the VCPU while serving a cache flush try to do it
asynchronously. Use our good old helper thread pool to issue an
asynchronous fdatasync for raw-posix. Note that while Linux AIO
implements a fdatasync operation it is not useful for us because...

9ef91a67 08/28/2009 04:30 am Christoph Hellwig

raw-posix: refactor AIO support

Currently the raw-posix.c code contains a lot of knowledge about the
asynchronous I/O scheme that is mostly implemented in posix-aio-compat.c.
All this code does not really belong here and is getting a bit in the
way of implementing native AIO on Linux....

2341f9a1 07/27/2009 10:09 pm Juan Quintela


Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

e7d54ae8 05/08/2009 11:51 pm Christoph Hellwig

fix asynchronous ioctls

posix_aio_read expect aio requests to return the number of bytes
requests to be successfull, so we need to fake this up for ioctls.

Signed-off-by: Christoph Hellwig <>
Signed-off-by: Anthony Liguori <>

ceb42de8 04/07/2009 09:43 pm aliguori

native preadv/pwritev support (Christoph Hellwig)

This ties up the preadv/pwritev syscalls to qemu if they are declared in
unistd.h. This is the case currently on at least NetBSD and OpenBSD and
will hopefully soon be the case on Linux.

Thanks to Blue Swirl and Gerd Hoffmann for the configure autodetection...

f141eafe 04/07/2009 09:43 pm aliguori

push down vector linearization to posix-aio-compat.c (Christoph Hellwig)

Make all AIO requests vectored and defer linearization until the actual
I/O thread. This prepares for using native preadv/pwritev.

Also enables asynchronous direct I/O by handling that case in the I/O thread....

221f715d 03/28/2009 07:28 pm aliguori

new scsi-generic abstraction, use SG_IO (Christoph Hellwig)

Okay, I started looking into how to handle scsi-generic I/O in the
new world order.

I think the best is to use the SG_IO ioctl instead of the read/write
interface as that allows us to support scsi passthrough on disk/cdrom...

514f7a27 02/21/2009 07:48 am malc

Properly handle pthread_cond_timedwait timing out

pthread_cond_timedwait is allowed to both consume the signal and
return with the value indicating the timeout, hence predicate should
always be (re)checked before taking an action

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

a8227a5a 02/21/2009 07:48 am malc


Avoid repeated creation/initalization/destruction of attr and calls to

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

5d47e372 02/21/2009 07:48 am malc

Avoid thundering herd problem

Broadcast was used so that the I/O threads would wakeup, reset their
ts values and all but one go to sleep, in other words an optimization
to prevent threads from exiting in presence of continuing I/O
activity. Spurious wakeups make the looping around cond_timedwait with...

30525aff 02/21/2009 07:48 am malc

Avoid infinite loop around timed condition variable

This can happen due to spurious wakeups

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

8653c015 02/21/2009 07:48 am malc

Error checking

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

55f11ca3 01/24/2009 01:54 pm blueswir1

Rename sigev_signo to avoid FreeBSD problems (Juergen Lock)

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

c9db92fc 01/17/2009 08:49 am blueswir1

Use kill instead of sigqueue: re-enables AIO on OpenBSD

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

f094a782 01/13/2009 05:13 pm aliguori

Fix race in POSIX AIO emulation (Jan Kiszka)

When we cancel an AIO request that is already being processed by
aio_thread, qemu_paio_cancel should return QEMU_PAIO_NOTCANCELED as long
as aio_thread isn't done with this request. But as the latter currently...

1d6198c3 12/13/2008 11:32 am blueswir1

Remove unnecessary trailing newlines

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

3c529d93 12/12/2008 06:41 pm aliguori

Replace posix-aio with custom thread pool

glibc implements posix-aio as a thread pool and imposes a number of limitations.

1) it limits one request per-file descriptor. we hack around this by dup()'ing
file descriptors which is hideously ugly

2) it's impossible to add new interfaces and we need a vectored read/write...