qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 22/22] iotests: Add test for different refcou


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v3 22/22] iotests: Add test for different refcount widths
Date: Thu, 20 Nov 2014 16:04:48 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 11/20/2014 10:06 AM, Max Reitz wrote:
> Add a test for conversion between different refcount widths and errors
> specific to certain widths (i.e. snapshots with refcount_width=1).
> 
> Signed-off-by: Max Reitz <address@hidden>
> ---
>  tests/qemu-iotests/112     | 278 
> +++++++++++++++++++++++++++++++++++++++++++++
>  tests/qemu-iotests/112.out | 143 +++++++++++++++++++++++
>  tests/qemu-iotests/group   |   1 +
>  3 files changed, 422 insertions(+)
>  create mode 100755 tests/qemu-iotests/112
>  create mode 100644 tests/qemu-iotests/112.out
> 

> +echo
> +echo '=== Multiple walks necessary during amend ==='
> +echo
> +
> +IMGOPTS="$IMGOPTS,refcount_width=1,cluster_size=512" _make_test_img 64k
> +
> +# Cluster 0 is the image header, clusters 1 to 4 are used by the L1 table, a
> +# single L2 table, the reftable and a single refblock. This creates 58 data
> +# clusters (actually, the L2 table is created here, too), so in total there 
> are
> +# then 63 used clusters in the image. With a refcount width of 64, one 
> refblock
> +# describes 64 clusters (512 bytes / 64 bits/entry = 64 entries), so this 
> will
> +# make the first refblock in the amended image have exactly one free entry.
> +$QEMU_IO -c "write 0 $((58 * 512))" "$TEST_IMG" | _filter_qemu_io
> +
> +# Now change the refcount width; since the first new refblock will have 
> exactly
> +# one free entry, that entry will be used to store its own reference. No 
> other
> +# refblocks are needed, so then the new reftable will be allocated; since the
> +# first new refblock is completely filled up, this will require a new 
> refblock
> +# which is why the refcount width changing function will need to run through
> +# everything one more time until the allocations are stable.
> +# Having more walks than usual should be visible as regressing progress (from
> +# 66.67 % (2/3 walks) to 50.00 % (2/4 walks)).
> +$QEMU_IMG amend -o refcount_width=64 -p "$TEST_IMG" | tr '\r' '\n' \
> +                                                    | grep -A 1 '66.67'

You probably know the drill by now: 'grep -A' is a GNU extension, and
not necessarily portable to other grep.  Portable would be "grep 66.67 |
head -n2", but I'm not going to insist on a rewrite since we already
depend on other GNU-isms in the testsuite.  (Or put another way, if
someone runs the test on BSD and it fails, _then_ we can patch things).

> +
> +=== Multiple walks necessary during amend ===
> +
> +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=65536
> +wrote 29696/29696 bytes at offset 0
> +29 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> +    (66.67/100%)
> +    (50.00/100%)
> +refcount width: 64
> +No errors were found on the image.

Nicely done, here, and in the overall series.

Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]