Fix gcc 3 warning about uninitialized variable
If nb_sectors is 0, cluster_offset will not be initialized.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
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...
qcow2: Metadata preallocation
This introduces a qemu-img create option for qcow2 which allows the metadata tobe preallocated, i.e. clusters are reserved in the refcount table and L1/L2tables, but no data is written to them. Metadata is quite small, so this...
block/vdi.c: Fix several bugs
eliminate errors about unused results in block/vpc.c
These errors come up when compiling with gcc-4.3.3 and some older headers:
/scratch/froydnj/qemu.git/block/vpc.c: In function 'vpc_create':/scratch/froydnj/qemu.git/block/vpc.c:514: error: value computed is not used...
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>...
Use pstrcpy to avoid OpenBSD linker warnings
Add new block driver for the VDI format (only aio supported)
This is a new block driver written from scratchto support the VDI format in QEMU.
VDI is the native format used by Innotek / SUN VirtualBox.
Latest changes:
Fix Sparse warning about "expression using sizeof on a function"
rename HOST_BSD to CONFIG_BSD
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
vmdk: Fix backing file handling
Instead of storing the backing file in its own BlockDriverState, VMDK uses theBlockDriverState of the raw image file it opened. This is wrong and breaksfunctions that access the backing file or protocols. This fix replaces all...
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' * /* *//*
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...
replace bdrv_{get, put}_buffer with bdrv_{load, save}_vmstate
The VM state offset is a concept internal to the image format. Replacethe old bdrv_{get,put}_buffer method that require an index into theimage file that is constructed from the VM state offset and an offset...
qcow1: Fix qcow_aio_writev
Pass is_write = 1 to qcow_aio_setup when writing.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qcow2: Fix L1 table memory allocation
Contrary to what one could expect, the size of L1 tables is not clusteraligned. So as we're writing whole sectors now instead of single entries,we need to ensure that the L1 table in memory is large enough; otherwise...
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>
Allow adjustment of http block device's readahead size, via a new":readahead=###:" suffix.
Signed-off-by: Nolan Leake <nolan <at> sigbus.net>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>
qcow2: Make cache=writethrough default
The performance of qcow2 has improved meanwhile, so we don't need tospecial-case it any more. Switch the default to write-through cachinglike all other block drivers.
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...
qcow2: Cache refcount blocks during snapshot creation
The really time consuming part of snapshotting is to adjust the reference countof all clusters. Currently after each adjusted cluster the refcount block iswritten to disk.
Don't write each single byte immediately to disk but cache all writes to 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 QCOW2 debugging code to compile again
Updated to use C99 comments.
Signed-off-by: Filip Navara <filip.navara@gmail.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Fix opening of read only raw images
update_refcount: Write complete sectors
When updating the refcount blocks in update_refcount(), write complete sectorsinstead of updating single entries.
qcow2: Change default cluster size to 64k
Larger cluster sizes mean less metadata. This has been discussion a few times,let's do it now. This turns 64k clusters on by default for new images.
qcow2: Split out refcount handling
qcow2-refcount.c contains all functions which are related to clusterallocation and management in the image file. A large part of this is thereference counting of these clusters.
Also a header file qcow2.h is introduced which will contain the interface of...
qcow2: Split out guest cluster functions
qcow2-cluster.c contains all functions related to the management of guestclusters, i.e. what the guest sees on its virtual disk. This code is aboutmapping these guest clusters to host clusters in the image file using the...
qcow2: Split out snapshot functions
qcow2-snapshot.c contains the code related to snapshotting.
qcow2: Rename global functions
The qcow2 source is now split into several more manageable files. During theconversion quite some functions that were static before needed to be changed tobe global to make the source compile again.
We were lucky enough not to get name conflicts with these additional global...
l2_allocate: Write complete sectors
When modifying the L1 table, l2_allocate() needs to write complete sectorsinstead of single entries. The L1 table is already in memory, reading it fromdisk in the block layer to align the request is wasted performance....
alloc_cluster_link_l2: Write complete sectors
When updating the L2 tables in alloc_cluster_link_l2(), write completesectors instead of updating single entries.
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>
vvfat: one more missing BlockDriver C99 initializer conversion
Signed-off-by: Christoph Hellwig <hch@lst.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.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...
qcow: add qcow_aio_setup helper
[this one is required for [PATCH] fully split aio_pool from BlockDriver, sorry for not sending it out earlier]
Add a qcow_aio_setup helper to qcow to shared common code betweenthe aio_readv and aio_writev methods. Based on the function with...
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....
Drop bdrv_create2
This patch converts the remaining users of bdrv_create2 to bdrv_create andremoves the now unused function.
qcow2: Update multiple refcounts at once
Don't write each single changed refcount block entry to the disk after it iswritten, but update all entries of the block and write all of them at once.
qcow2: Refactor update_refcount
This is a preparation patch with no functional changes. It moves the allocationof new refcounts block to a new function and makes update_cluster_refcount (forone cluster) call update_refcount (for multiple clusters) instead the other way...
qcow/qcow2: Drop synchronous qcow_write()
There is only one (internal) user left and it can be switched to the normalemulation provided in block.c
Add HTTP protocol using curl v6
Currently Qemu can read from posix I/O and NBD. This patch adds athird protocol to the game: HTTP.
In certain situations it can be useful to access HTTP data directly,for example if you want to try out an http provided OS image, but...
qcow2: Allow different cluster sizes
Add an option to specify the cluster size of a newly created qcow2 image.Default is 4k which is the same value that was hard-coded before.
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....
Do not attempt to allocate sn_tab when there are no snapshots
This was caught by a7d27b536ffc0773028a90f14580552c0c3ddb2a whichaborted on this attempt, thanks to Alex Ivanov for report.
Signed-off-by: malc <av1474@comtv.ru>
Fix warning on WIN32
Move block drivers into their own directory