History | View | Annotate | Download (35.9 kB)
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,...
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....
raw-posix: Detect legacy floppy via ioctl on linux
Current legacy floppy detection is hardcoded based on source filename. Make this smarter on linux by attempting a floppy specificioctl.
v2: Give ioctl check higher priority than filename check s/IDE/legacy/...
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 <kwolf@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Don't leak file descriptors
We're leaking file descriptors to child processes. Set FD_CLOEXEC on filedescriptors that don't need to be passed to children to stop this misbehaviour.
Add support for GNU/kFreeBSD
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Remove aio_ctx from paio_* interface
The context parameter in paio_submit isn't used anyway, so there is no reasonwhy block drivers should need to remember it. This also avoids passing a LinuxAIO context to paio_submit (which doesn't do any harm as long as the parameter...
raw/linux-aio: Also initialize POSIX AIO
When using Linux AIO raw still falls back to POSIX AIO sometimes, so we shouldinitialize it.
Not initializing it happens to work if POSIX AIO is used by another drive, orif the format is not specified (probing the format uses POSIX AIO) or by pure...
block/raw: Add create_options for host_device
Today host_devices have a create function, so they also need a create_optionsfield to prevent qemu-img from complaining.
block: use fdatasync instead of fsync if possible
If we are flushing the caches for our image files we only care about thedata (including the metadata required for accessing it) but not thingslike timestamp updates. So try to use fdatasync instead of fsync to...
block: add aio_flush operation
Instead stalling the VCPU while serving a cache flush try to do itasynchronously. Use our good old helper thread pool to issue anasynchronous fdatasync for raw-posix. Note that while Linux AIOimplements a fdatasync operation it is not useful for us because...
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 <weil@mail.berlios.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
raw-posix: refactor AIO support
Currently the raw-posix.c code contains a lot of knowledge about theasynchronous 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 theway of implementing native AIO on Linux....
raw-posix: add Linux native AIO support
Now that do have a nicer interface to work against we can add Linux nativeAIO support. It's an extremly thing layer just setting up an iocb forthe io_submit system call in the submission path, and registering an...
make pthreads mandatory
As requested by Anthony make pthreads mandatory. This means we will alwayshave AIO available on posix hosts, and it will also allow enabling the I/Othread unconditionally once it's ready.
Signed-off-by: Christoph Hellwig <hch@lst.de>...
rename HOST_BSD to CONFIG_BSD
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
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 <blauwirbel@gmail.com>
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 anempty image, and later read / write tests will fail.
With the patch, failures during image creation are detected...
Substitute O_DSYNC with O_SYNC or O_FSYNC when needed.
Signed-off-by: John Arbuckle <programmingkidx@gmail.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Revert "support colon in filenames"
This reverts commit 707c0dbc97cddfe8d2441b8259c6c526d99f2dd8.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
block-raw: Allow pread beyond the end of growable images
When using O_DIRECT, qcow2 snapshots didn't work any more for me. In theprocess of creating the snapshot, qcow2 tries to pwrite some new information(e.g. new L1 table) which will often end up being after the old end of the...
support colon in filenames
Problem: It is impossible to feed filenames with the character colon becauseqemu interprets such names as a protocol. For example filename scsi:0, isinterpreted as a protocol by name "scsi".
This patch allows user to espace colon characters. For example the above...
Fix opening of read only raw images
raw-posix: open flags use BDRV_ namespace, not posix namespace
The flags argument to raw_common_open() contain bits defined by the BDRV_O_*namespace, not the posix O_* namespace.
Adjust to use the correct constants.
Signed-off-by: Avi Kivity <avi@redhat.com>...
raw-posix: Remove O_RDWR when attempting to open a file read-only
When we open a file, we first attempt to open it read-write, then fall backto read-only. Unfortunately we reuse the flags from the previous attempt,so both attempts try to open the file with write permissions, and fail....
raw-posix: cleanup ioctl methods
Rename raw_ioctl and raw_aio_ioctl to hdev_ioctl and hdev_aio_ioctl as theyare only used for the host device. Also only add them to the method tablefor the cases where we need them (generic hdev if linux and linux CDROM)...
block: add bdrv_probe_device method
Add a bdrv_probe_device method to all BlockDriver instances implementinghost devices to move matching of host device types into the actual drivers.For now we keep exacly the old matching behaviour based on the devices names,...
raw-posix: split hdev drivers
Instead of declaring one BlockDriver for all host devices declared onefor each type: a generic one for normal disk devices, a Linux floppydriver and a CDROM driver for Linux and FreeBSD. This gets rid of a lotof messy ifdefs and switching based on the type in the various removal...
raw-posix: add a raw_open_common helper
raw_open and hdev_open contain the same basic logic. Add a newraw_open_common helper containing the guts of the open routineand call it from raw_open and hdev_open.
We use the new open_flags field in BDRVRawState to allow passing...
raw-posix: always store open flags
Both the Linux floppy and the FreeBSD CDROM host device need to storethe open flags so that they can re-open the device later. Store theopen flags unconditionally to remove the ifdef mess and simply thecalling conventions for the later patches in the series....
qemu-img: Print available options with -o ?
This patch adds a small help text to each of the options in the block driverswhich can be displayed by using qemu-img create -f fmt -o ?
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
fully split aio_pool from BlockDriver
Now that we have a separate aio pool structure we can remove thoseaio pool details from BlockDriver.
Every driver supporting AIO now needs to declare a static AIOPoolwith the aiocb size and the cancellation method. This cleans up the...
raw-posix: fix hdev_create
We do need hdev_create unconditionally on all platforms so that qemu-imgcreate support for host device works on all platforms.
Also relax the check to allow character devices in addition to blockdevices. On many Unix platforms block devices have buffered block...
fix raw_pread_aligned return value
raw_pread_aligned currently returns the raw return value fromlseek/read, which is always -1 in case of an error. But thecallers higher up the stack expect it to return the negatederrno just like raw_pwrite_aligned....
Convert all block drivers to new bdrv_create
Now we can make use of the newly introduced option structures. Instead ofhaving bdrv_create carry more and more parameters (which are format specific inmost cases), just pass a option structure as defined by the driver itself....
Move block drivers into their own directory