History | View | Annotate | Download (24.4 kB)
block: vdi image file reopen
There is currently nothing that needs to be done for VDI reopen.
Signed-off-by: Jeff Cody <jcody@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
vdi: Fix warning from clang
ccc-analyzer reports these warnings:
block/vdi.c:704:13: warning: Dereference of null pointer bmap[i] = VDI_UNALLOCATED; ^block/vdi.c:702:13: warning: Dereference of null pointer bmap[i] = i;...
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 pathswhen the O_CLOEXEC macro is defined.
Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>...
qemu-img check -r for repairing images
The QED block driver already provides the functionality to not onlydetect inconsistencies in images, but also fix them. However, thisfunctionality cannot be manually invoked with qemu-img, but thecheck happens only automatically during bdrv_open()....
vdi: basic conversion to coroutines
Even a basic conversion changing the bdrv_aio_readv/bdrv_aio_writev callsto bdrv_co_readv/bdrv_co_writev, and callbacks to goto statements caneliminate a lot of code. This is because error handling is simplifiedand indirections through bottom halves can go away....
vdi: move end-of-I/O handling at the end
The next step is to take code that only triggers after the first operation,and move it at the end of vdi_aio_read_cb and vdi_aio_write_cb.
Acked-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
vdi: merge aio_read_cb and aio_write_cb into callers
Now inline the former AIO callbacks into vdi_co_readv and vdi_co_writev.While many cleanups are possible, the code now really looks synchronous.
vdi: move aiocb fields to locals
Most of the AIOCB really holds local variables that need to persistacross callback invocation. It can go away now.
Acked-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
vdi: leave bounce buffering to block layer
vdi.c really works as if it implemented bdrv_read and bdrv_write. However,because only vector I/O is supported by the asynchronous callbacks, itwent through extra pain to bounce-buffer the I/O. This can be handled...
vdi: do not create useless iovecs
Reads and writes to the underlying file can also occur with the simplenon-vectored I/O interfaces.
vdi: change goto to loop
Finally reindent all code and change goto statements to a loop.
block: push recursive flushing up from drivers
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/vdi: Zero unused parts when allocating a new block (fix #919242)
The new block was filled with zero when it was allocated by g_malloc0,but when it was reused later and only partially used, data from thepreviously allocated block were still present and written to the new...
block: qemu_aio_get does not return NULL
Initially done with the following semantic patch:
rule1 expression E;statement S;@@ E = qemu_aio_get (...);(- if (E == NULL) { ... } |- if (E) { <... S ...> })
rule1
which however missed occurrences in linux-aio.c and posix-aio-compat.c....
block: bdrv_aio_* do not return NULL
rule1 expression E;statement S;@@ E =( bdrv_aio_readv | bdrv_aio_writev | bdrv_aio_flush | bdrv_aio_discard | bdrv_aio_ioctl) (...);(- if (E == NULL) { ... }...
vdi: convert to .bdrv_co_is_allocated()
It is trivial to switch from the synchronous .bdrv_is_allocated()interface to .bdrv_co_is_allocated() since vdi_is_allocated() does notblock.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
vdi: Fix memory leak
The block map is allocated in vdi_open, but was never freed.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
vdi: Add migration blocker
vdi caches the block map. For migration to work, it would have to beinvalidated. Block migration for now.
block: Rename bdrv_co_flush to bdrv_co_flush_to_disk
There are two different types of flush that you can do: Flushing one level upto the OS (i.e. writing data to the host page cache) or flushing it all the waydown to the disk. The existing functions flush to the disk, reflect this in the...
Teach block/vdi about "discarded" (no longer allocated) blocks
An entry in the VDI block map will hold an offset to the actual block ifthe block is allocated, or one of two specially-interpreted values ifnot allocated. Using VirtualBox terminology, value VDI_IMAGE_BLOCK_FREE...
block: change flush to co_flush
Since coroutine operation is now mandatory, convert all bdrv_flushimplementations to coroutines. For qcow2, this means taking the lock.Other implementations are simpler and just forward bdrv_flush to theunderlying protocol, so they can avoid the lock....
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
vdi: Avoid direct AIO callback
bdrv_aio_* must not call the callback before returning to its caller. In vdi,this could happen in some error cases. This starts the real requests processingin a BH to avoid this situation.
qemu-img create: Fix displayed default cluster size
When not specifying a cluster size on the command line, qemu-img printeda cluster size of 0:
Formatting '/tmp/test.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=0
This patch adds the default cluster size to the QEMUOptionParameter list, so...
Fix trivial "endianness bugs"
Replace endianess -> endianness.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
block/vdi: Don't ignore immediate read/write failures
This patch is similar to 171e3d6b9997c98a97d0c525867f7cd9b640caddwhich fixed qcow2:
Returning -EIO is far from optimal, but at least it's an error code.
Cc: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Weil <weil@mail.berlios.de>...
block/vdi: Fix wrong size in conditionally used memset, memcmp
Error report from cppcheck:block/vdi.c:122: error: Using sizeof for array given as function argument returns the size of pointer.block/vdi.c:128: error: Using sizeof for array given as function argument returns the size of pointer....
block: Remove unused s->hd in various drivers
All drivers use bs->file instead of s->hd for quite a while now, so it's timeto remove s->hd.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
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.
qcow2/vdi: Change check to distinguish error cases
This distinguishes between harmless leaks and real corruption. Hopefully usersbetter understand what qemu-img check wants to tell them.
block: Avoid unchecked casts for AIOCBs
Use container_of for one direction and &acb->common for the other one.
block/vdi: Allow disk images of size 0
Even it is not very useful, users may create images of size 0.
Without the special option CONFIG_ZERO_MALLOC, qemu_malloczaborts execution when it is told to allocate 0 bytes,so avoid this kind of call.
Cc: Kevin Wolf <kwolf@redhat.com>...
block/vdi: Fix image opening and creation for odd disk sizes
The fix is based on a patch from Kevin Wolf. Here his comment:
"The number of blocks needs to be rounded up to cover all of the virtual harddisk. Without this fix, we can't even open our own images if their size is not...
block: Open the underlying image file in generic code
Format drivers shouldn't need to bother with things like file names, but ratherjust get an open BlockDriverState for the underlying protocol. This patchintroduces this behaviour for bdrv_open implementation. For protocols which...
block/vdi: allow disk sizes not multiple of block size
The disk image I created from my old laptop disk with VBoxManageinternalcommand converthd obviously was not a multiple of 1MB as whencreated from scratch. This fixes QEMU refusing it. We still require the...
Check availability of uuid header / library
If available, the Universally Unique Identifier libraryis used by the vdi block driver.
Other parts of QEMU (vl.c) could also use it.
Fix signedness warnings on OpenSolaris
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
block/vdi.c: Fix several bugs
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: