QEMU silently ignores aio=native if libaio is unavailable. It is confusing when aio=native performance is identical to aio=threads because the binary was accidentally built without libaio.
Use error_report() because failing would break backward compatibility. There are probably users using aio=native who would be inconvenienced if QEMU suddenly refused to start their guests. Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com> --- blockdev.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/blockdev.c b/blockdev.c index 62a4586..f30828a 100644 --- a/blockdev.c +++ b/blockdev.c @@ -405,10 +405,14 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, bdrv_flags |= BDRV_O_NO_FLUSH; } -#ifdef CONFIG_LINUX_AIO if ((buf = qemu_opt_get(opts, "aio")) != NULL) { if (!strcmp(buf, "native")) { +#ifdef CONFIG_LINUX_AIO bdrv_flags |= BDRV_O_NATIVE_AIO; +#else + error_report("warning: aio=native support unavailable, " + "using default instead"); +#endif } else if (!strcmp(buf, "threads")) { /* this is the default */ } else { @@ -416,7 +420,6 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, goto early_err; } } -#endif if ((buf = qemu_opt_get(opts, "format")) != NULL) { if (is_help_option(buf)) { -- 2.4.3