[Qemu-devel] [PATCH v6 04/24] qcow2: Only return status from qcow2_get_refcount

2015-02-10 Thread Max Reitz
Refcounts can theoretically be of type uint64_t; in order to be able to represent the full range, qcow2_get_refcount() cannot use a single variable to represent both all refcount values and also keep some values reserved for errors. One solution would be to add an Error pointer parameter to qcow2_

[Qemu-devel] [PATCH v6 10/24] qcow2: Open images with refcount order != 4

2015-02-10 Thread Max Reitz
No longer refuse to open images with a different refcount entry width than 16 bits; only reject images with a refcount width larger than 64 bits (which is prohibited by the specification). Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- block/qcow2.c | 8 -

[Qemu-devel] [PATCH v6 02/24] qcow2: Add refcount_bits to format-specific info

2015-02-10 Thread Max Reitz
Add the bit width of every refcount entry to the format-specific information. In contrast to lazy_refcounts and the corrupt flag, this should be always emitted, even for compat=0.10 although it does not support any refcount width other than 16 bits. This is because if a boolean is optional, one no

[Qemu-devel] [PATCH v6 05/24] qcow2: Use unsigned addend for update_refcount()

2015-02-10 Thread Max Reitz
update_refcount() and qcow2_update_cluster_refcount() currently take a signed addend. At least one caller passes a value directly derived from an absolute refcount that should be reached ("l2_refcount - 1" in expand_zero_clusters_in_l1()). Therefore, the addend should be unsigned as well; this will

[Qemu-devel] [PATCH v6 11/24] qcow2: refcount_order parameter for qcow2_create2

2015-02-10 Thread Max Reitz
Add a refcount_order parameter to qcow2_create2(), use that value for the image header and for calculating the size required for preallocation. For now, always pass 4. This addition requires changes to the calculation of the file size for the "full" and "falloc" preallocation modes. That in turn

[Qemu-devel] [PATCH v6 09/24] qcow2: More helpers for refcount modification

2015-02-10 Thread Max Reitz
Add helper functions for getting and setting refcounts in a refcount array for any possible refcount order, and choose the correct one during refcount initialization. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- block/qcow2-refcount.c | 121

[Qemu-devel] [PATCH v6 13/24] iotests: Prepare for refcount_bits option

2015-02-10 Thread Max Reitz
Some tests do not work well with certain refcount widths (i.e. you cannot create internal snapshots with refcount_bits=1), so make those widths unsupported. Furthermore, add another filter to _filter_img_create in common.filter which filters out the refcount_bits value. This is necessary for test

[Qemu-devel] [PATCH v6 07/24] qcow2: Helper for refcount array reallocation

2015-02-10 Thread Max Reitz
Add a helper function for reallocating a refcount array, independent of the refcount order. The newly allocated space is zeroed and the function handles failed reallocations gracefully. The helper function will always align the buffer size to a cluster boundary; if storing the refcounts in such an

[Qemu-devel] [PATCH v6 12/24] qcow2: Use symbolic macros in qcow2_amend_options

2015-02-10 Thread Max Reitz
qcow2_amend_options() should not compare options against some inline strings but rather use the symbolic macros available for each of the creation options. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- block/qcow2.c | 31 --- 1 fi

[Qemu-devel] [PATCH v6 23/24] qcow2: Point to amend function in check

2015-02-10 Thread Max Reitz
If a reference count is not representable with the current refcount order, the image check should point to qemu-img amend for increasing the refcount order. However, qemu-img amend needs write access to the image which cannot be provided if the image is marked corrupt; and the image check will not

[Qemu-devel] [PATCH v6 16/24] block: Add opaque value to the amend CB

2015-02-10 Thread Max Reitz
Add an opaque value which is to be passed to the bdrv_amend_options() status callback. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- block.c | 4 ++-- block/qcow2-cluster.c | 14 -- block/qcow2.c | 9 +

[Qemu-devel] [PATCH v6 15/24] progress: Allow regressing progress

2015-02-10 Thread Max Reitz
Progress may regress; this should be displayed correctly by qemu_progress_print(). While touching that area of code, drop the redundant parentheses in the same condition. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- util/qemu-progress.c | 3 ++- 1 file cha

[Qemu-devel] [PATCH v6 19/24] qcow2: Split upgrade/downgrade paths for amend

2015-02-10 Thread Max Reitz
If the image version should be upgraded, that is the first we should do; if it should be downgraded, that is the last we should do. So split the version change block into an upgrade part at the start and a downgrade part at the end. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: S

[Qemu-devel] [PATCH v6 14/24] qcow2: Allow creation with refcount order != 4

2015-02-10 Thread Max Reitz
Add a creation option to qcow2 for setting the refcount order of images to be created, and respect that option's value. This breaks some test outputs, fix them. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- block/qcow2.c | 20 + includ

Re: [Qemu-devel] [PATCH v2 37/37] iotests: Add test for change-related QMP commands

2015-02-10 Thread Max Reitz
On 2015-02-09 at 19:06, Eric Blake wrote: On 02/09/2015 10:11 AM, Max Reitz wrote: Signed-off-by: Max Reitz --- tests/qemu-iotests/118 | 653 + tests/qemu-iotests/118.out | 5 + tests/qemu-iotests/group | 1 + 3 files changed, 659 inser

[Qemu-devel] [PATCH v6 21/24] qcow2: Add function for refcount order amendment

2015-02-10 Thread Max Reitz
Add a function qcow2_change_refcount_order() which allows changing the refcount order of a qcow2 image. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- block/qcow2-refcount.c | 452 + block/qcow2.h | 4

[Qemu-devel] [PATCH v6 17/24] qcow2: Use error_report() in qcow2_amend_options()

2015-02-10 Thread Max Reitz
Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- block/qcow2.c | 14 ++ tests/qemu-iotests/061.out | 14 +++--- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 8c3b707..f1b1c2c

[Qemu-devel] [PATCH v6 18/24] qcow2: Use abort() instead of assert(false)

2015-02-10 Thread Max Reitz
Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- block/qcow2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index f1b1c2c..c610c6c 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2730,9 +2730,9 @@ stati

[Qemu-devel] [PATCH v6 22/24] qcow2: Invoke refcount order amendment function

2015-02-10 Thread Max Reitz
Make use of qcow2_change_refcount_order() to support changing the refcount order with qemu-img amend. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- block/qcow2.c | 44 +++- 1 file changed, 35 insertions(+), 9 deletions

[Qemu-devel] [PATCH v6 24/24] iotests: Add test for different refcount widths

2015-02-10 Thread Max Reitz
Add a test for conversion between different refcount widths and errors specific to certain widths (i.e. snapshots with refcount_bits=1). Signed-off-by: Max Reitz Reviewed-by: Eric Blake --- tests/qemu-iotests/112 | 296 + tests/qemu-iotests/112.ou

<    1   2   3   4