mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
Use AIO only if host supports it (based on OpenBSD patches by Todd T. Fries)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5010 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
53c3748794
commit
414f0dab09
2 changed files with 59 additions and 0 deletions
|
@ -28,7 +28,9 @@
|
|||
#endif
|
||||
#include "block_int.h"
|
||||
#include <assert.h>
|
||||
#ifdef CONFIG_AIO
|
||||
#include <aio.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_COCOA
|
||||
#include <paths.h>
|
||||
|
@ -418,6 +420,7 @@ static int raw_pwrite(BlockDriverState *bs, int64_t offset,
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef CONFIG_AIO
|
||||
/***********************************************************/
|
||||
/* Unix AIO using POSIX AIO */
|
||||
|
||||
|
@ -688,6 +691,37 @@ static void raw_aio_cancel(BlockDriverAIOCB *blockacb)
|
|||
}
|
||||
}
|
||||
|
||||
# else /* CONFIG_AIO */
|
||||
|
||||
void qemu_aio_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
void qemu_aio_poll(void)
|
||||
{
|
||||
}
|
||||
|
||||
void qemu_aio_flush(void)
|
||||
{
|
||||
}
|
||||
|
||||
void qemu_aio_wait_start(void)
|
||||
{
|
||||
}
|
||||
|
||||
void qemu_aio_wait(void)
|
||||
{
|
||||
#if !defined(QEMU_IMG) && !defined(QEMU_NBD)
|
||||
qemu_bh_poll();
|
||||
#endif
|
||||
}
|
||||
|
||||
void qemu_aio_wait_end(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_AIO */
|
||||
|
||||
static void raw_close(BlockDriverState *bs)
|
||||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
|
@ -792,10 +826,12 @@ BlockDriver bdrv_raw = {
|
|||
raw_create,
|
||||
raw_flush,
|
||||
|
||||
#ifdef CONFIG_AIO
|
||||
.bdrv_aio_read = raw_aio_read,
|
||||
.bdrv_aio_write = raw_aio_write,
|
||||
.bdrv_aio_cancel = raw_aio_cancel,
|
||||
.aiocb_size = sizeof(RawAIOCB),
|
||||
#endif
|
||||
.protocol_name = "file",
|
||||
.bdrv_pread = raw_pread,
|
||||
.bdrv_pwrite = raw_pwrite,
|
||||
|
@ -1144,10 +1180,12 @@ BlockDriver bdrv_host_device = {
|
|||
NULL,
|
||||
raw_flush,
|
||||
|
||||
#ifdef CONFIG_AIO
|
||||
.bdrv_aio_read = raw_aio_read,
|
||||
.bdrv_aio_write = raw_aio_write,
|
||||
.bdrv_aio_cancel = raw_aio_cancel,
|
||||
.aiocb_size = sizeof(RawAIOCB),
|
||||
#endif
|
||||
.bdrv_pread = raw_pread,
|
||||
.bdrv_pwrite = raw_pwrite,
|
||||
.bdrv_getlength = raw_getlength,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue