Statistics
| Branch: | Revision:

root / block / raw-posix.c @ cc84d90f

History | View | Annotate | Download (50.1 kB)

# Date Author Comment
d5124c00 09/12/2013 11:12 am Max Reitz

bdrv: Use "Error" for creating images

Add an Error ** parameter to BlockDriver.bdrv_create to allow more
specific error messages.

Signed-off-by: Max Reitz <>

015a1036 09/12/2013 11:12 am Max Reitz

bdrv: Use "Error" for opening images

Add an Error ** parameter to BlockDriver.bdrv_open and
BlockDriver.bdrv_file_open to allow more specific error messages.

Signed-off-by: Max Reitz <>

b6b8a333 09/06/2013 04:25 pm Paolo Bonzini

block: introduce bdrv_get_block_status API

For now, bdrv_get_block_status is just another name for bdrv_is_allocated.
The next patches will add more flags.

This also touches all block drivers with a mostly mechanical rename. The
sole exception is cow; because it calls cow_co_is_allocated from the read...

63390a8d 09/06/2013 04:25 pm Paolo Bonzini

raw-posix: return get_block_status data and flags

Reviewed-by: Eric Blake <>
Signed-off-by: Paolo Bonzini <>
Signed-off-by: Stefan Hajnoczi <>

f5f7abcf 09/06/2013 04:25 pm Paolo Bonzini

raw-posix: report unwritten extents as zero

These are created for example with XFS_IOC_ZERO_RANGE.

Reviewed-by: Eric Blake <>
Signed-off-by: Paolo Bonzini <>
Signed-off-by: Stefan Hajnoczi <>

3ac21627 06/28/2013 02:52 pm Peter Lieven

block: change default of .has_zero_init to 0

.has_zero_init defaults to 1 for all formats and protocols.

this is a dangerous default since this means that all
new added drivers need to manually overwrite it to 0 if
they do not ensure that a device is zero initialized...

a5c5ea3f 06/28/2013 10:20 am Kevin Wolf

raw-posix: Fix /dev/cdrom magic on OS X

The raw-posix driver has code to provide a /dev/cdrom on OS X even
though it doesn't really exist. However, since commit c66a6157 the real
filename is dismissed after finding it, so opening /dev/cdrom fails.
Put the filename back into the options QDict to make this work again....

56d1b4d2 04/22/2013 12:34 pm Kevin Wolf

block: Remove filename parameter from .bdrv_file_open()

It is unused now in all block drivers.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>

c66a6157 04/22/2013 11:27 am Kevin Wolf

raw-posix: Use bdrv_open options instead of filename

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>

787e4a85 03/22/2013 06:51 pm Kevin Wolf

block: Add options QDict to bdrv_file_open() prototypes

The new parameter is unused yet.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>

c4d9d196 03/15/2013 05:07 pm Stefan Hajnoczi

threadpool: drop global thread pool

Now that each AioContext has a ThreadPool and the main loop AioContext
can be fetched with bdrv_get_aio_context(), we can eliminate the concept
of a global thread pool from thread-pool.c.

The submit functions must take a ThreadPool* argument....

da888d37 02/12/2013 01:22 pm Stefan Hajnoczi

block/raw-posix: detect readonly Linux block devices using BLKROGET

Linux block devices can be set read-only with "blockdev --setro
<device>". The same thing can be done for LVM volumes using "lvchange
--permission r <volume>". This read-only setting is independent of...

fdf263f6 02/01/2013 04:11 pm Andreas Färber

block/raw-posix: Build fix for O_ASYNC

Commit eeb6b45d48800e96f67ef2a5c80332557fd45ddb (block: raw-posix image
file reopen) broke the build on OpenIndiana.

illumos has no O_ASYNC. Exclude it from flags to be compared
and instead assert that it is not set where defined....

c36dd8a0 01/19/2013 04:35 pm Andreas Färber

block/raw-posix: Make hdev_aio_discard() available outside Linux

Fixes the build on OpenBSD among others.

Suggested-by: Kevin Wolf <>
Signed-off-by: Andreas Färber <>
Cc: Paolo Bonzini <>
Signed-off-by: Blue Swirl <>

3d4fa43e 01/15/2013 11:03 am Kusanagi Kouichi

raw-posix: support discard on more filesystems

Linux 2.6.38 introduced the filesystem independent interface to
deallocate part of a file. As of Linux 3.7, btrfs, ext4, ocfs2,
tmpfs and xfs support it.

Even though the system calls here are in practice issued on Linux,...

c85191e5 01/15/2013 11:03 am Paolo Bonzini

raw-posix: remember whether discard failed

Avoid sending system calls repeatedly if they shall fail. This
does not apply to XFS: if the filesystem-specific ioctl fails,
something weird is happening.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Stefan Hajnoczi <>

fcd9d455 01/15/2013 11:03 am Paolo Bonzini

raw: support discard on block devices

Block devices use a ioctl instead of fallocate, so add a separate
implementation.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Stefan Hajnoczi <>

8238010b 01/15/2013 11:03 am Paolo Bonzini

block: make discard asynchronous

This is easy with the thread pool, because we can use s->is_xfs and
s->has_discard from the worker function.

QEMU has a widespread assumption that each I/O operation writes less
than 2^32 bytes. This patch doesn't fix it throughout of course,...

b608c8dc 01/14/2013 11:06 am Paolo Bonzini

raw-posix: fix bdrv_aio_ioctl

When the raw-posix aio=thread code was moved from posix-aio-compat.c
to block/raw-posix.c, there was an unintended change to the ioctl code.
The code used to return the ioctl command, which posix_aio_read()
would later morph into a zero. This hack is not necessary anymore,...

c53b1c51 01/14/2013 11:06 am Stefan Hajnoczi

block: make qiov_is_aligned() public

The qiov_is_aligned() function checks whether a QEMUIOVector meets a
BlockDriverState's alignment requirements. This is needed by
virtio-blk-data-plane so:

1. Move the function from block/raw-posix.c to block/block.c....

4065742a 01/02/2013 04:31 pm Stefan Hajnoczi

raw-posix: add raw_get_aio_fd() for virtio-blk-data-plane

The raw_get_aio_fd() function allows virtio-blk-data-plane to get the
file descriptor of a raw image file with Linux AIO enabled. This
interface is really a layering violation that can be resolved once the...

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

737e150e 12/19/2012 09:31 am Paolo Bonzini

block: move include files to include/block/

Signed-off-by: Paolo Bonzini <>

f8fe7964 12/19/2012 09:29 am Paolo Bonzini

janitor: do not include qemu-char everywhere

Touching char/char.h basically causes the whole of QEMU to
be rebuilt. Avoid this, it is usually unnecessary.

Signed-off-by: Paolo Bonzini <>

c208e8c2 12/11/2012 12:04 pm Paolo Bonzini

raw-posix: inline paio_ioctl into hdev_aio_ioctl

clang now warns about an unused function:
CC block/raw-posix.o
block/raw-posix.c:707:26: warning: unused function paio_ioctl
[-Wunused-function]
static BlockDriverAIOCB *paio_ioctl(BlockDriverState *bs, int fd,...

1bc6b705 11/21/2012 10:40 am Jeff Cody

block: add bdrv_reopen() support for raw hdev, floppy, and cdrom

For hdev, floppy, and cdrom, the reopen() handlers are the same as
for the file reopen handler. For floppy and cdrom types, however,
we keep O_NONBLOCK, as in the _open function.

Signed-off-by: Jeff Cody <>...

47e6b251 10/31/2012 11:38 am Paolo Bonzini

block: switch posix-aio-compat to threadpool

This is not meant for portability, but to remove code duplication.

Signed-off-by: Paolo Bonzini <>

de81a169 10/31/2012 11:38 am Paolo Bonzini

raw: merge posix-aio-compat.c into block/raw-posix.c

Making the qemu_paiocb specific to raw devices will let us access members
of the BDRVRawState arbitrarily.

Signed-off-by: Paolo Bonzini <>

9f8540ec 10/31/2012 11:38 am Paolo Bonzini

raw-posix: rename raw-posix-aio.h, hide unavailable prototypes

Signed-off-by: Paolo Bonzini <>

3d1807ac 09/24/2012 04:15 pm Jeff Cody

block: purge s->aligned_buf and s->aligned_buf_size from raw-posix.c

The aligned_buf pointer and aligned_buf size are no longer used in
raw_posix.c, so remove all references to them.

Signed-off-by: Jeff Cody <>
Signed-off-by: Kevin Wolf <>

eeb6b45d 09/24/2012 04:15 pm Jeff Cody

block: raw-posix image file reopen

This is derived from the Supriya Kannery's reopen patches.

This contains the raw-posix driver changes for the bdrv_reopen_*
functions. All changes are staged into a temporary scratch buffer
during the prepare() stage, and copied over to the live structure...

fc32a72d 09/24/2012 04:15 pm Jeff Cody

block: move aio initialization into a helper function

Move AIO initialization for raw-posix block driver into a helper function.

In addition to just code motion, the aio_ctx pointer is checked for NULL,
prior to calling laio_init(), to make sure laio_init() is only run once....

6a8dc042 09/24/2012 04:15 pm Jeff Cody

block: move open flag parsing in raw block drivers to helper functions

Code motion, to move parsing of open flags into a helper function.

Signed-off-by: Jeff Cody <>
Signed-off-by: Kevin Wolf <>

39c9fb95 09/24/2012 04:15 pm Jeff Cody

block: do not parse BDRV_O_CACHE_WB in block drivers

Block drivers should ignore BDRV_O_CACHE_WB in .bdrv_open flags,
and in the bs->open_flags.

This patch removes the code, leaving the behaviour behind as if
BDRV_O_CACHE_WB was set.

Signed-off-by: Jeff Cody <>...

9acc5a06 09/24/2012 04:15 pm Jeff Cody

block: use BDRV_O_NOCACHE instead of s->aligned_buf in raw-posix.c

Rather than check for a non-NULL aligned_buf to determine if
raw_aio_submit needs to check for alignment, check for the presence
of BDRV_O_NOCACHE in the bs->open_flags.

Signed-off-by: Jeff Cody <>...

e1740828 08/15/2012 11:48 am Corey Bryant

block: Prevent detection of /dev/fdset/ as floppy

Signed-off-by: Corey Bryant <>
Signed-off-by: Kevin Wolf <>

6165f4d8 08/15/2012 11:48 am Corey Bryant

block: Convert open calls to qemu_open

This patch converts all block layer open calls to qemu_open.

Note that this adds the O_CLOEXEC flag to the changed open paths
when the O_CLOEXEC macro is defined.

Signed-off-by: Corey Bryant <>...

2e1e79da 08/15/2012 11:48 am Corey Bryant

block: Convert close calls to qemu_close

This patch converts all block layer close calls, that correspond
to qemu_open calls, to qemu_close.

Signed-off-by: Corey Bryant <>
Signed-off-by: Kevin Wolf <>

94282e71 06/24/2012 02:04 am Kevin Wolf

raw-posix: Fix build without is_allocated support

Move the declaration of s into the #ifdef sections that actually make
use of it.

Signed-off-by: Kevin Wolf <>
Signed-off-by: Alexander Graf <>

5500316d 06/15/2012 03:03 pm Paolo Bonzini

block: implement is_allocated for raw

Either FIEMAP, or SEEK_DATA+SEEK_HOLE can be used to implement the
is_allocated callback for raw files. On Linux ext4, btrfs and XFS
all support it.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

83affaa6 05/01/2012 01:16 am Pavel Borzenkov

raw-posix: Do not use CONFIG_COCOA macro

Use APPLE and MACH macros instead of CONFIG_COCOA to detect Mac
OS X host. The patch is based on Ben Leslie's patch:
http://patchwork.ozlabs.org/patch/97859/

Signed-off-by: Ben Leslie <>
Signed-off-by: Pavel Borzenkov <>...

f36f3949 02/22/2012 09:23 pm Luiz Capitulino

block: bdrv_eject(): Make eject_flag a real bool

Signed-off-by: Luiz Capitulino <>
Reviewed-by: Markus Armbruster <>
Acked-by: Kevin Wolf <>

9b2260cb 12/02/2011 12:50 pm Dong Xu Wang

fix spelling in block sub directory

Cc: Kevin Wolf <>
Signed-off-by: Dong Xu Wang <>
Signed-off-by: Stefan Hajnoczi <>

6db39ae2 10/21/2011 06:34 pm Paolo Bonzini

block: change discard to co_discard

Since coroutine operation is now mandatory, convert both bdrv_discard
implementations to coroutines. For qcow2, this means taking the lock
around the operation. raw-posix remains synchronous.

The bdrv_discard callback is then unused and can be eliminated....

6f6dc656 10/21/2011 06:34 pm Stefan Hajnoczi

block: drop redundant bdrv_flush implementation

Block drivers now only need to provide either of .bdrv_co_flush,
.bdrv_aio_flush() or for legacy drivers .bdrv_flush(). Remove
the redundant .bdrv_flush() implementations.

[Paolo Bonzini: change raw driver to bdrv_co_flush]...

1b1e8c6e 10/14/2011 06:31 pm Stefan Hajnoczi

raw-posix: remove bdrv_read()/bdrv_write()

Block drivers only need to provide one of sync, aio, or coroutine
interfaces. Since raw-posix.c provides aio interfaces, simply drop the
synchronous interfaces since they can be emulated using aio and
coroutines....

55b949c8 10/11/2011 10:41 am Christoph Hellwig

block: allow resizing of images residing on host devices

Allow to resize images that reside on host devices up to the available
space. This allows to grow images after resizing the device manually or
vice versa.

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

074abad3 09/19/2011 12:34 pm Kevin Wolf

raw-posix: Fix bdrv_flush error return values

bdrv_flush is supposed to use 0/-errno return values

Signed-off-by: Kevin Wolf <>

025e849a 09/12/2011 04:17 pm Markus Armbruster

block: Rename bdrv_set_locked() to bdrv_lock_medium()

While there, make the locked parameter bool.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

c30e624d 09/06/2011 12:23 pm Frediano Ziglio

linux aio: some comments

Add some notes about Linux AIO explaining why we don't use AIO in
some situations.

Signed-off-by: Frediano Ziglio <>
Signed-off-by: Kevin Wolf <>

c1ee7d56 08/01/2011 01:10 pm Frediano Ziglio

raw-posix: Typo fix

Signed-off-by: Frediano Ziglio <>
Signed-off-by: Kevin Wolf <>

f6e8ffc2 08/01/2011 01:10 pm Frediano Ziglio

raw-posix: Always check paio_init result

Signed-off-by: Frediano Ziglio <>
Signed-off-by: Kevin Wolf <>

7bf37fed 08/01/2011 01:10 pm Markus Armbruster

block: Make BlockDriver method bdrv_set_locked() return void

The only caller is bdrv_set_locked(), and it ignores the value.

Callees always return 0, except for FreeBSD's cdrom_set_locked(),
which returns -ENOTSUP when the device is in a terminally wedged...

822e1cd1 08/01/2011 01:10 pm Markus Armbruster

block: Make BlockDriver method bdrv_eject() return void

Callees always return 0, except for FreeBSD's cdrom_eject(), which
returns -ENOTSUP when the device is in a terminally wedged state.

The only caller is bdrv_eject(), and it maps -ENOTSUP to 0 since...

4a1d5e1f 07/19/2011 04:39 pm Fam Zheng

block: add bdrv_get_allocated_file_size() operation

qemu-img.c wants to count allocated file size of image. Previously it
counts a single bs->file by 'stat' or Window API. As VMDK introduces
multiple file support, the operation becomes format specific with...

343f8568 07/05/2011 12:23 pm Johannes Stezenbach

block/raw-posix: Linux compat-ioctl warning workaround

On Linux x86_64 host with 32bit userspace, running
qemu or even just "qemu-img create -f qcow2 some.img 1G"
causes a kernel warning:

ioctl32(qemu-img:5296): Unknown cmd fd(3) cmd(00005326){t:'S';sz:0} arg(7fffffff) on some.img...

13748cf4 06/08/2011 08:13 pm Anthony Liguori

Merge remote-tracking branch 'stefanha/trivial-patches' into staging

d1f6fd8d 06/08/2011 12:56 pm Christoph Egger

block/raw-posix: get right partition size

use the correct way to get the size of a disk device or partition

From: Adam Hamsik <>
Signed-off-by: Christoph Egger <>
Signed-off-by: Kevin Wolf <>

a6599793 06/08/2011 11:39 am Christoph Hellwig

block: clarify the meaning of BDRV_O_NOCACHE

Change BDRV_O_NOCACHE to only imply bypassing the host OS file cache,
but no writeback semantics. All existing callers are changed to also
specify BDRV_O_CACHE_WB to give them writeback semantics.

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

1de1ae0a 06/08/2011 11:39 am Christoph Egger

block/raw-posix: use a character device if a block device is given

On NetBSD a userland process is better with the character device
interface. In addition, a block device can't be opened twice; if a Xen
backend opens it, qemu can't and vice-versa.

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

9bf0960a 06/08/2011 11:04 am Alexandre Raymond

Fix compilation warning due to missing header for sigaction (followup)

This patch removes all references to signal.h when qemu-common.h is included
as they become redundant.

Signed-off-by: Alexandre Raymond <>
Signed-off-by: Stefan Hajnoczi <>

dce512de 12/17/2010 05:11 pm Christoph Hellwig

raw-posix: add discard support

Add support to discard blocks in a raw image residing on an XFS filesystem
by calling the XFS_IOC_UNRESVSP64 ioctl to punch holes. Support for other
hole punching mechanisms can be added when they become available.

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

11a3cb81 11/26/2010 08:02 pm Christoph Hellwig

raw-posix: raw_pwrite comment fixup

Signed-off-by: Christoph Hellwig <>
Signed-off-by: Kevin Wolf <>

205ef796 11/04/2010 01:52 pm Kevin Wolf

block: Allow bdrv_flush to return errors

This changes bdrv_flush to return 0 on success and -errno in case of failure.
It's a requirement for implementing proper error handle in users of bdrv_flush.

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

c57c846a 10/23/2010 06:24 pm Blue Swirl

qemu-timer: move commonly used timer code to qemu-timer-common

Move timer init functions to a new file, qemu-timer-common.c. Make other
critical timer functions inlined to preserve performance in
qemu-timer.c, also move muldiv64() (used by the inline functions)...

581b9e29 09/21/2010 04:39 pm Christoph Hellwig

raw-posix: handle > 512 byte alignment correctly

Replace the hardcoded handling of 512 byte alignment with bs->buffer_alignment
to handle larger sector size devices correctly.

Note that we can not rely on it to be initialize in bdrv_open, so deal
with the worst case there....

05acda4d 09/08/2010 01:39 pm Bernhard Kohl

raw-posix: improve detection of scsi-generic devices

Allow symbolic links which point to /dev/sgX devices.

Signed-off-by: Bernhard Kohl <>
Signed-off-by: Kevin Wolf <>

897804d6 09/08/2010 01:39 pm Kevin Wolf

raw-posix: Don't use file name for host_cdrom detection on Linux

On Linux, we have code to detect CD-ROMs using an ioctl. We shouldn't lose
anything but false positives by removing the check for a /dev/cd* path.

Signed-off-by: Kevin Wolf <>

336c1c12 08/03/2010 04:57 pm Kevin Wolf

block: Fix bdrv_has_zero_init

Assuming that any image on a block device is not properly zero-initialized is
actually wrong: Only raw images have this problem. Any other image format
shouldn't care about it, they initialize everything properly themselves....

2ee9fb48 07/25/2010 05:59 pm Stefan Weil

block: Replace u_int8_t, u_int16_t, u_int32_t, u_int64_t by standard int types

There is no need to have a second set of integral types.
Replace them by the standard types from stdint.h.

Signed-off-by: Stefan Weil <>
Signed-off-by: Aurelien Jarno <>

65d21bc7 07/06/2010 06:05 pm Markus Armbruster

raw-posix: Fix test for host CD-ROM

raw_pread_aligned() retries up to two times if the block device backs
a virtual CD-ROM (a drive with media=cdrom and if=ide, scsi, xen or
none). This makes no sense. Whether retrying reads can correct read
errors can only depend on what we're reading, not on how the result...

9040385d 06/04/2010 12:43 pm Jes Sorensen

Cleanup: raw-posix.c: Be more consistent using BDRV_SECTOR_SIZE instead of 512

Clean up raw-posix.c to be more consistent using BDRV_SECTOR_SIZE
instead of hard coded 512 values.

Signed-off-by: Jes Sorensen <>
Signed-off-by: Kevin Wolf <>

4899d10d 05/03/2010 11:07 am Stefan Hajnoczi

raw-posix: Use pread/pwrite instead of lseek+read/write

This patch combines the lseek+read/write calls to use pread/pwrite
instead. This will result in fewer system calls and is already used by
AIO.

Thanks to Jan Kiszka <> for identifying excessive...

84a12e66 05/03/2010 11:07 am Christoph Hellwig

block: separate raw images from the file protocol

We're running into various problems because the "raw" file access, which
is used internally by the various image formats is entangled with the
"raw" image format, which maps the VM view 1:1 to a file system....

66f82cee 05/03/2010 11:07 am Kevin Wolf

block: Open the underlying image file in generic code

Format drivers shouldn't need to bother with things like file names, but rather
just get an open BlockDriverState for the underlying protocol. This patch
introduces this behaviour for bdrv_open implementation. For protocols which...

50779cc2 04/23/2010 05:08 pm Christoph Hellwig

block: split raw_getlength

Split up the raw_getlength into separate generic, solaris and BSD
versions to reduce the ifdef maze a bit. The BSD variant still
is a complete maze, but to clean it up properly we'd need some
people using the BSD variants to figure out what code is used...

6e0a47aa 04/10/2010 03:22 am Christoph Hellwig

raw-posix: don't assign bs->read_only

bdrv_open already takes care of this for us.

Signed-off-by: Christoph Hellwig <>
Acked-by: Kevin Wolf <>
Signed-off-by: Aurelien Jarno <>

57e69b7d 03/27/2010 01:00 pm Kevin Wolf

raw-posix: Better error return values for hdev_create

Now that we output an error message according to the returned error code in
qemu-img, let's return the real error codes. "Input/output error" for
everything isn't helpful.

Signed-off-by: Kevin Wolf <>...

053965c7 01/27/2010 12:41 am Kevin Wolf

block/raw-posix: Abort on pread beyond end of non-growable file

This shouldn't happen under any normal circumstances. However, it looks like
it's possible to achieve this with corrupted images. Without this patch
raw_pread is hanging in an endless loop in such cases....

f8a83245 01/27/2010 12:41 am Herve Poussineau

win32: pair qemu_memalign() with qemu_vfree()

Win32 suffers from a very big memory leak when dealing with SCSI devices.
Each read/write request allocates memory with qemu_memalign (ie
VirtualAlloc) but frees it with qemu_free (ie free).
Pair all qemu_memalign() calls with qemu_vfree() to prevent such leaks....

9a2d77ad 01/26/2010 11:42 pm Christoph Hellwig

block: kill BDRV_O_CREAT

The BDRV_O_CREAT option is unused inside qemu and partially duplicates
the bdrv_create method. Remove it, and the -C option to qemu-io which
isn't used in qemu-iotests anyway.

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

f5edb014 01/20/2010 04:25 pm Naphtali Sprei

Clean-up a little bit the RW related bits of BDRV_O_FLAGS. BDRV_O_RDONLY gone (and so is BDRV_O_ACCESS). Default value for bdrv_flags (0/zero) is READ-ONLY. Need to explicitly request READ-WRITE.

Instead of using the field 'readonly' of the BlockDriverState struct for passing the request,...

3baf720e 01/20/2010 12:31 am Cole Robinson

raw-posix: Detect CDROM via ioctl on linux

Current CDROM detection is hardcoded based on source file name.
Make this smarter on linux by attempting a CDROM specific ioctl.

This makes '-cdrom /dev/sr0' succeed with no media present.

v2:
Give ioctl check higher priority than filename check....

2ebf7c4b 01/20/2010 12:31 am Cole Robinson

raw-posix: Detect legacy floppy via ioctl on linux

Current legacy floppy detection is hardcoded based on source file
name. Make this smarter on linux by attempting a floppy specific
ioctl.

v2:
Give ioctl check higher priority than filename check
s/IDE/legacy/...

12c09b8c 12/03/2009 07:45 pm Kevin Wolf

qemu-img: There is more than one host device driver

I haven't heard yet of anyone using qemu-img to copy an image to a real floppy,
but it's a valid use case.

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 <>

a167ba50 11/29/2009 07:00 pm Aurelien Jarno

Add support for GNU/kFreeBSD

Signed-off-by: Aurelien Jarno <>

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...

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

raw/linux-aio: Also initialize POSIX AIO

When using Linux AIO raw still falls back to POSIX AIO sometimes, so we should
initialize it.

Not initializing it happens to work if POSIX AIO is used by another drive, or
if the format is not specified (probing the format uses POSIX AIO) or by pure...

0b4ce02e 10/05/2009 10:20 pm Kevin Wolf

block/raw: Add create_options for host_device

Today host_devices have a create function, so they also need a create_options
field to prevent qemu-img from complaining.

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

6f1953c4 09/11/2009 06:19 pm Christoph Hellwig

block: use fdatasync instead of fsync if possible

If we are flushing the caches for our image files we only care about the
data (including the metadata required for accessing it) but not things
like timestamp updates. So try to use fdatasync instead of fsync to...

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...

e44bd6fc 08/28/2009 04:57 pm Stefan Weil

Don't compile aio code if CONFIG_LINUX_AIO is undefined

This patch fixes linker errors when building QEMU without Linux AIO support.

It is based on suggestions from malc and Kevin Wolf.

Signed-off-by: Stefan Weil <>
Signed-off-by: Anthony Liguori <>

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....

5c6c3a6c 08/28/2009 04:30 am Christoph Hellwig

raw-posix: add Linux native AIO support

Now that do have a nicer interface to work against we can add Linux native
AIO support. It's an extremly thing layer just setting up an iocb for
the io_submit system call in the submission path, and registering an...

4dd75c70 08/24/2009 04:46 pm Christoph Hellwig

make pthreads mandatory

As requested by Anthony make pthreads mandatory. This means we will always
have AIO available on posix hosts, and it will also allow enabling the I/O
thread unconditionally once it's ready.

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

71e72a19 07/27/2009 10:09 pm Juan Quintela

rename HOST_BSD to CONFIG_BSD

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

0bf9e31a 07/20/2009 08:19 pm Blue Swirl

Fix most warnings (errors with -Werror) when debugging is enabled

I used the following command to enable debugging:
perl -p -i -e 's/^\/\/#define DEBUG/#define DEBUG/g' * /* *//*

Signed-off-by: Blue Swirl <>

1e37d059 07/17/2009 01:28 am Stefan Weil

raw-posix: Handle errors in raw_create

In qemu-iotests, some large images are created using qemu-img.

Without checks for errors, qemu-img will just create an
empty image, and later read / write tests will fail.

With the patch, failures during image creation are detected...

1c27a8b3 07/10/2009 12:58 am G 3

Substitute O_DSYNC with O_SYNC or O_FSYNC when needed.

Signed-off-by: John Arbuckle <>
Signed-off-by: Anthony Liguori <>