History | View | Annotate | Download (36.4 kB)
qcow2: Remove abort on free_clusters failure
While it's true that during regular operation free_clusters failure would be abug, an I/O error can always happen. There's no need to kill the VM, the worstthing that can happen (and it will) is that we leak some clusters....
qcow2: Avoid shadowing variable in alloc_clusters_noref()
The i loop iterator is shadowed by the next free cluster index. Bothusing the variable name 'i' makes the code harder to read.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
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...
qcow2: Trigger blkdebug events
This adds blkdebug events to qcow2 to allow injecting I/O errors in specificplaces.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qcow2: Factor next_refcount_table_size out
When the refcount table grows, it doesn't only grow by one entry but reservessome space for future refcount blocks. The algorithm to calculate the number ofentries stays the same with the fixes, so factor it out before replacing the...
qcow2: Rewrite alloc_refcount_block/grow_refcount_table
The current implementation of alloc_refcount_block and grow_refcount_table hasfundamental problems regarding error handling. There are some places where anI/O error means that the image is going to be corrupted. I have found that the...
qcow2: More checks for qemu-img check
Implement some more refcount block related checks
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qcow2: Fix error handling in grow_refcount_table
Return the appropriate error code instead of -EIO.
qcow2: Improve error handling in update_refcount
If update_refcount fails, try to undo any changes made so far to avoidinconsistencies in the image file.
qcow2: Allow updating no refcounts
There's absolutely no problem with updating the refcounts of 0 clusters.At least snapshot code is doing this and would fail once the result ofupdate_refcount isn't ignored any more.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>...
qcow2: Don't ignore update_refcount return value
update_refcount can return errors that need to be handled by the callers.
qcow2: Don't ignore qcow2_alloc_clusters return value
Now that qcow2_alloc_clusters can return error codes, we must handle them inthe callers of qcow2_alloc_clusters.
qcow2-refcount: remove dead assignment
clang-analyzer points out a redundant assignment.
Signed-off-by: Amit Shah <amit.shah@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qcow2: Fix some more qemu_malloc fallout
Oh joy...
qcow2: Fix grow_refcount_table error handling
In case of failure, we haven't increased the refcount for the newly allocatedcluster yet. Therefore we must not free the cluster or its refcount will becomenegative (and endless recursion is possible).
qcow2: Increase maximum cluster size to 2 MB
This patch increases the maximum qcow2 cluster size to 2 MB. Starting with 128kclusters, L2 tables span 2 GB or more of virtual disk space, causing 32 bittruncation and wraparound of signed integers. Therefore some variables need to...
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>
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...
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...
update_refcount: Write complete sectors
When updating the refcount blocks in update_refcount(), write complete sectorsinstead of updating single entries.
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: 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...