diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2020-09-23 15:11:38 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2020-09-23 15:11:38 +0100 |
commit | c122bca9cd7b986be4d473240a4fec6315b7a2c2 (patch) | |
tree | ffe93494e45ab1ae727044b578f7019edbe0481c | |
parent | 0fc0142828b5bc965790a1c5c6e241897d3387cb (diff) | |
parent | 14f16bf9474c860ecc127a66a86961942319f7af (diff) | |
download | qemu-c122bca9cd7b986be4d473240a4fec6315b7a2c2.zip qemu-c122bca9cd7b986be4d473240a4fec6315b7a2c2.tar.gz qemu-c122bca9cd7b986be4d473240a4fec6315b7a2c2.tar.bz2 |
Merge remote-tracking branch 'remotes/ericb/tags/pull-bitmaps-2020-09-21' into staging
bitmaps patches for 2020-09-21
- Eric Blake: Improve 'qemu-img bitmap --merge' by not opening backing images
# gpg: Signature made Tue 22 Sep 2020 01:58:31 BST
# gpg: using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full]
# gpg: aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full]
# gpg: aka "[jpeg image of size 6874]" [full]
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2 F3AA A7A1 6B4A 2527 436A
* remotes/ericb/tags/pull-bitmaps-2020-09-21:
qemu-img: Support bitmap --merge into backing image
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | qemu-img.c | 11 | ||||
-rwxr-xr-x | tests/qemu-iotests/291 | 12 | ||||
-rw-r--r-- | tests/qemu-iotests/291.out | 56 |
3 files changed, 76 insertions, 3 deletions
@@ -4779,14 +4779,19 @@ static int img_bitmap(int argc, char **argv) filename = argv[optind]; bitmap = argv[optind + 1]; - blk = img_open(image_opts, filename, fmt, BDRV_O_RDWR, false, false, - false); + /* + * No need to open backing chains; we will be manipulating bitmaps + * directly in this image without reference to image contents. + */ + blk = img_open(image_opts, filename, fmt, BDRV_O_RDWR | BDRV_O_NO_BACKING, + false, false, false); if (!blk) { goto out; } bs = blk_bs(blk); if (src_filename) { - src = img_open(false, src_filename, src_fmt, 0, false, false, false); + src = img_open(false, src_filename, src_fmt, BDRV_O_NO_BACKING, + false, false, false); if (!src) { goto out; } diff --git a/tests/qemu-iotests/291 b/tests/qemu-iotests/291 index 1e0bb76..4f837b2 100755 --- a/tests/qemu-iotests/291 +++ b/tests/qemu-iotests/291 @@ -92,6 +92,15 @@ $QEMU_IMG bitmap --remove --image-opts \ _img_info --format-specific echo +echo "=== Merge from top layer into backing image ===" +echo + +$QEMU_IMG rebase -u -F qcow2 -b "$TEST_IMG.base" "$TEST_IMG" +$QEMU_IMG bitmap --add --merge b2 -b "$TEST_IMG" -F $IMGFMT \ + -f $IMGFMT "$TEST_IMG.base" b3 +_img_info --format-specific --backing-chain + +echo echo "=== Check bitmap contents ===" echo @@ -107,6 +116,9 @@ $QEMU_IMG map --output=json --image-opts \ nbd_server_start_unix_socket -r -f qcow2 -B b2 "$TEST_IMG" $QEMU_IMG map --output=json --image-opts \ "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b2" | _filter_qemu_img_map +nbd_server_start_unix_socket -r -f qcow2 -B b3 "$TEST_IMG" +$QEMU_IMG map --output=json --image-opts \ + "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b3" | _filter_qemu_img_map # success, all done echo '*** done' diff --git a/tests/qemu-iotests/291.out b/tests/qemu-iotests/291.out index ee89a72..3990f7a 100644 --- a/tests/qemu-iotests/291.out +++ b/tests/qemu-iotests/291.out @@ -68,6 +68,59 @@ Format specific information: corrupt: false extended l2: false +=== Merge from top layer into backing image === + +image: TEST_DIR/t.IMGFMT +file format: IMGFMT +virtual size: 10 MiB (10485760 bytes) +cluster_size: 65536 +backing file: TEST_DIR/t.IMGFMT.base +backing file format: IMGFMT +Format specific information: + compat: 1.1 + compression type: zlib + lazy refcounts: false + bitmaps: + [0]: + flags: + name: b1 + granularity: 524288 + [1]: + flags: + [0]: auto + name: b2 + granularity: 65536 + [2]: + flags: + name: b0 + granularity: 65536 + refcount bits: 16 + corrupt: false + extended l2: false + +image: TEST_DIR/t.IMGFMT.base +file format: IMGFMT +virtual size: 10 MiB (10485760 bytes) +cluster_size: 65536 +Format specific information: + compat: 1.1 + compression type: zlib + lazy refcounts: false + bitmaps: + [0]: + flags: + [0]: auto + name: b0 + granularity: 65536 + [1]: + flags: + [0]: auto + name: b3 + granularity: 65536 + refcount bits: 16 + corrupt: false + extended l2: false + === Check bitmap contents === [{ "start": 0, "length": 3145728, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, @@ -79,4 +132,7 @@ Format specific information: [{ "start": 0, "length": 2097152, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, { "start": 2097152, "length": 1048576, "depth": 0, "zero": false, "data": false}, { "start": 3145728, "length": 7340032, "depth": 0, "zero": false, "data": true, "offset": OFFSET}] +[{ "start": 0, "length": 2097152, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, +{ "start": 2097152, "length": 1048576, "depth": 0, "zero": false, "data": false}, +{ "start": 3145728, "length": 7340032, "depth": 0, "zero": false, "data": true, "offset": OFFSET}] *** done |