1 | The following changes since commit b34181056c04e05db6c632063012beaee7006a37: | 1 | The following changes since commit 22d96eac64877c4d96f9928babb6f2fcc68faacf: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/rth/tags/pull-sh4-20180709' into staging (2018-07-09 22:44:22 +0100) | 3 | Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging (2019-04-29 19:11:15 +0100) |
4 | 4 | ||
5 | are available in the git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | git://repo.or.cz/qemu/kevin.git tags/for-upstream | 7 | git://repo.or.cz/qemu/kevin.git tags/for-upstream |
8 | 8 | ||
9 | for you to fetch changes up to cd47d792d7a27a57f4b621e2ff1ed8f4e83de1e9: | 9 | for you to fetch changes up to 54277a2aab876aba7b55c7e88e2b372691849741: |
10 | 10 | ||
11 | block: Use common write req handling in truncate (2018-07-10 16:46:22 +0200) | 11 | block/qed: add missed coroutine_fn markers (2019-04-30 15:29:00 +0200) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Block layer patches: | 14 | Block layer patches: |
15 | 15 | ||
16 | - Copy offloading fixes for when the copy increases the image size | 16 | - iotests: Fix output of qemu-io related tests |
17 | - Temporary revert of the removal of deprecated -drive options | 17 | - Don't ignore bdrv_set_aio_context() for nodes with bs->drv = NUL |
18 | - Fix request serialisation in the image fleecing scenario | 18 | - vmdk: Set vmdk parent backing_format to vmdk |
19 | - Fix copy-on-read crash with unaligned image size | 19 | - qcow2: Preallocation fixes (especially for external data files) |
20 | - Fix another drain crash | 20 | - Add linear-buffer-based APIs (as wrappers around qiov-based ones) |
21 | - Various code cleanups and small corner case fixes | ||
21 | 22 | ||
22 | ---------------------------------------------------------------- | 23 | ---------------------------------------------------------------- |
23 | Ari Sundholm (2): | 24 | Alberto Garcia (3): |
24 | qapi/block-core.json: Add missing documentation for blklogwrites log-append option | 25 | qcow2: Fix error handling in the compression code |
25 | block/blklogwrites: Make sure the log sector size is not too small | 26 | commit: Make base read-only if there is an early failure |
27 | iotests: Check that images are in read-only mode after block-commit | ||
26 | 28 | ||
27 | Cornelia Huck (4): | 29 | Eric Blake (2): |
28 | Revert "block: Remove dead deprecation warning code" | 30 | cutils: Fix size_to_str() on 32-bit platforms |
29 | Revert "block: Remove deprecated -drive option serial" | 31 | qemu-img: Saner printing of large file sizes |
30 | Revert "block: Remove deprecated -drive option addr" | ||
31 | Revert "block: Remove deprecated -drive geometry options" | ||
32 | 32 | ||
33 | Fam Zheng (11): | 33 | Kevin Wolf (5): |
34 | iotests: 222: Don't run with luks | 34 | block: Fix AioContext switch for bs->drv == NULL |
35 | block: Prefix file driver trace points with "file_" | 35 | qcow2: Avoid COW during metadata preallocation |
36 | block: Add copy offloading trace points | 36 | qcow2: Add errp to preallocate_co() |
37 | block: Use BdrvChild to discard | 37 | qcow2: Fix full preallocation with external data file |
38 | block: Use uint64_t for BdrvTrackedRequest byte fields | 38 | qcow2: Fix qcow2_make_empty() with external data file |
39 | block: Extract common write req handling | ||
40 | block: Fix handling of image enlarging write | ||
41 | block: Use common req handling for discard | ||
42 | block: Use common req handling in copy offloading | ||
43 | block: Fix bdrv_co_truncate overlap check | ||
44 | block: Use common write req handling in truncate | ||
45 | 39 | ||
46 | Kevin Wolf (3): | 40 | Max Reitz (2): |
47 | block: Poll after drain on attaching a node | 41 | iotests: Perform the correct test in 082 |
48 | test-bdrv-drain: Test bdrv_append() to drained node | 42 | qemu-img: Make create hint at protocol options |
49 | block: Fix copy-on-read crash with partial final cluster | ||
50 | 43 | ||
51 | Vladimir Sementsov-Ogievskiy (4): | 44 | Sam Eiderman (1): |
52 | block/io: fix copy_range | 45 | vmdk: Set vmdk parent backing_format to vmdk |
53 | block: split flags in copy_range | ||
54 | block: add BDRV_REQ_SERIALISING flag | ||
55 | block/backup: fix fleecing scheme: use serialized writes | ||
56 | 46 | ||
57 | qapi/block-core.json | 2 + | 47 | Stefano Garzarella (2): |
58 | include/block/block.h | 41 +++++- | 48 | block/vhdx: Remove redundant IEC binary prefixes definition |
59 | include/block/block_int.h | 21 ++- | 49 | block/vhdx: Use IEC binary prefixes for size constants |
60 | include/hw/block/block.h | 1 + | ||
61 | include/sysemu/block-backend.h | 3 +- | ||
62 | include/sysemu/blockdev.h | 3 + | ||
63 | block.c | 2 +- | ||
64 | block/backup.c | 20 ++- | ||
65 | block/blkdebug.c | 2 +- | ||
66 | block/blklogwrites.c | 7 +- | ||
67 | block/blkreplay.c | 2 +- | ||
68 | block/block-backend.c | 8 +- | ||
69 | block/copy-on-read.c | 2 +- | ||
70 | block/file-posix.c | 25 ++-- | ||
71 | block/file-win32.c | 2 +- | ||
72 | block/io.c | 318 ++++++++++++++++++++++++++++------------- | ||
73 | block/iscsi.c | 12 +- | ||
74 | block/mirror.c | 2 +- | ||
75 | block/qcow2-refcount.c | 2 +- | ||
76 | block/qcow2.c | 20 +-- | ||
77 | block/raw-format.c | 26 ++-- | ||
78 | block/throttle.c | 2 +- | ||
79 | blockdev.c | 110 ++++++++++++++ | ||
80 | device-hotplug.c | 4 + | ||
81 | hw/block/block.c | 27 ++++ | ||
82 | hw/block/nvme.c | 1 + | ||
83 | hw/block/virtio-blk.c | 1 + | ||
84 | hw/ide/qdev.c | 1 + | ||
85 | hw/scsi/scsi-disk.c | 1 + | ||
86 | hw/usb/dev-storage.c | 1 + | ||
87 | qemu-img.c | 2 +- | ||
88 | tests/ahci-test.c | 6 +- | ||
89 | tests/hd-geo-test.c | 37 ++++- | ||
90 | tests/ide-test.c | 8 +- | ||
91 | tests/test-bdrv-drain.c | 43 ++++++ | ||
92 | block/trace-events | 10 +- | ||
93 | hmp-commands.hx | 1 + | ||
94 | qemu-doc.texi | 15 ++ | ||
95 | qemu-options.hx | 14 +- | ||
96 | tests/qemu-iotests/197 | 9 ++ | ||
97 | tests/qemu-iotests/197.out | 8 ++ | ||
98 | tests/qemu-iotests/222 | 2 + | ||
99 | 42 files changed, 647 insertions(+), 177 deletions(-) | ||
100 | 50 | ||
51 | Thomas Huth (1): | ||
52 | tests/qemu-iotests: Fix output of qemu-io related tests | ||
53 | |||
54 | Vladimir Sementsov-Ogievskiy (10): | ||
55 | block: introduce byte-based io helpers | ||
56 | block/qcow2: use buffer-based io | ||
57 | block/qcow: use buffer-based io | ||
58 | block/qed: use buffer-based io | ||
59 | block/parallels: use buffer-based io | ||
60 | block/backup: use buffer-based io | ||
61 | block/commit: use buffer-based io | ||
62 | block/stream: use buffer-based io | ||
63 | qemu-img: use buffer-based io | ||
64 | block/qed: add missed coroutine_fn markers | ||
65 | |||
66 | Zhengui li (1): | ||
67 | vpc: unlock Coroutine lock to make IO submit Concurrently | ||
68 | |||
69 | block/qed.h | 28 ++++--- | ||
70 | block/vhdx.h | 16 ++-- | ||
71 | include/block/block_int.h | 16 ++++ | ||
72 | include/sysemu/block-backend.h | 19 +++++ | ||
73 | block.c | 12 +-- | ||
74 | block/backup.c | 14 ++-- | ||
75 | block/commit.c | 8 +- | ||
76 | block/parallels.c | 14 ++-- | ||
77 | block/qapi.c | 49 +++--------- | ||
78 | block/qcow.c | 19 ++--- | ||
79 | block/qcow2.c | 80 ++++++++++---------- | ||
80 | block/qed-check.c | 4 +- | ||
81 | block/qed-table.c | 45 ++++++----- | ||
82 | block/qed.c | 11 ++- | ||
83 | block/stream.c | 4 +- | ||
84 | block/vhdx-log.c | 2 +- | ||
85 | block/vhdx.c | 7 +- | ||
86 | block/vmdk.c | 2 + | ||
87 | block/vpc.c | 4 + | ||
88 | qemu-img.c | 26 ++++--- | ||
89 | util/cutils.c | 2 +- | ||
90 | tests/qemu-iotests/026.out | 168 ++++++++++++++++++++--------------------- | ||
91 | tests/qemu-iotests/043.out | 6 +- | ||
92 | tests/qemu-iotests/053.out | 2 +- | ||
93 | tests/qemu-iotests/059.out | 10 +-- | ||
94 | tests/qemu-iotests/060.out | 16 ++-- | ||
95 | tests/qemu-iotests/061.out | 12 +-- | ||
96 | tests/qemu-iotests/069.out | 2 +- | ||
97 | tests/qemu-iotests/070.out | 4 +- | ||
98 | tests/qemu-iotests/075.out | 14 ++-- | ||
99 | tests/qemu-iotests/076.out | 6 +- | ||
100 | tests/qemu-iotests/078.out | 12 +-- | ||
101 | tests/qemu-iotests/080.out | 40 +++++----- | ||
102 | tests/qemu-iotests/081.out | 2 +- | ||
103 | tests/qemu-iotests/082 | 5 +- | ||
104 | tests/qemu-iotests/082.out | 51 ++++++++----- | ||
105 | tests/qemu-iotests/084.out | 8 +- | ||
106 | tests/qemu-iotests/088.out | 12 +-- | ||
107 | tests/qemu-iotests/089.out | 2 +- | ||
108 | tests/qemu-iotests/095.out | 4 +- | ||
109 | tests/qemu-iotests/103.out | 14 ++-- | ||
110 | tests/qemu-iotests/104.out | 6 +- | ||
111 | tests/qemu-iotests/110.out | 6 +- | ||
112 | tests/qemu-iotests/114.out | 4 +- | ||
113 | tests/qemu-iotests/116.out | 14 ++-- | ||
114 | tests/qemu-iotests/126.out | 4 +- | ||
115 | tests/qemu-iotests/130.out | 10 +-- | ||
116 | tests/qemu-iotests/131.out | 2 +- | ||
117 | tests/qemu-iotests/133.out | 30 ++++---- | ||
118 | tests/qemu-iotests/137.out | 28 +++---- | ||
119 | tests/qemu-iotests/140.out | 2 +- | ||
120 | tests/qemu-iotests/143.out | 2 +- | ||
121 | tests/qemu-iotests/153.out | 32 ++++---- | ||
122 | tests/qemu-iotests/187.out | 6 +- | ||
123 | tests/qemu-iotests/188.out | 2 +- | ||
124 | tests/qemu-iotests/191.out | 8 +- | ||
125 | tests/qemu-iotests/195.out | 4 +- | ||
126 | tests/qemu-iotests/197.out | 2 +- | ||
127 | tests/qemu-iotests/198.out | 4 +- | ||
128 | tests/qemu-iotests/205 | 2 +- | ||
129 | tests/qemu-iotests/206.out | 10 +-- | ||
130 | tests/qemu-iotests/207.out | 12 +-- | ||
131 | tests/qemu-iotests/210.out | 8 +- | ||
132 | tests/qemu-iotests/211.out | 10 +-- | ||
133 | tests/qemu-iotests/212.out | 10 +-- | ||
134 | tests/qemu-iotests/213.out | 10 +-- | ||
135 | tests/qemu-iotests/215.out | 2 +- | ||
136 | tests/qemu-iotests/226.out | 16 ++-- | ||
137 | tests/qemu-iotests/233.out | 4 +- | ||
138 | tests/qemu-iotests/237.out | 22 +++--- | ||
139 | tests/qemu-iotests/242.out | 10 +-- | ||
140 | tests/qemu-iotests/244.out | 10 +-- | ||
141 | tests/qemu-iotests/249 | 115 ++++++++++++++++++++++++++++ | ||
142 | tests/qemu-iotests/249.out | 35 +++++++++ | ||
143 | tests/qemu-iotests/group | 1 + | ||
144 | 75 files changed, 696 insertions(+), 519 deletions(-) | ||
145 | create mode 100755 tests/qemu-iotests/249 | ||
146 | create mode 100644 tests/qemu-iotests/249.out | ||
147 | diff view generated by jsdifflib |
1 | If the virtual disk size isn't aligned to full clusters, | 1 | From: Thomas Huth <thuth@redhat.com> |
---|---|---|---|
2 | bdrv_co_do_copy_on_readv() may get pnum == 0 before having the full | ||
3 | cluster completed, which will let it run into an assertion failure: | ||
4 | 2 | ||
5 | qemu-io: block/io.c:1203: bdrv_co_do_copy_on_readv: Assertion `skip_bytes < pnum' failed. | 3 | One of the recent commits changed the way qemu-io prints out its |
4 | errors and warnings - they are now prefixed with the program name. | ||
5 | We've got to adapt the iotests accordingly to prevent that they | ||
6 | are failing. | ||
6 | 7 | ||
7 | Check for EOF, assert that we read at least as much as the read request | 8 | Fixes: 99e98d7c9fc1a1639fad ("qemu-io: Use error_[gs]et_progname()") |
8 | originally wanted to have (which is true at EOF because otherwise | 9 | Signed-off-by: Thomas Huth <thuth@redhat.com> |
9 | bdrv_check_byte_request() would already have returned an error) and | ||
10 | return success early even though we couldn't copy the full cluster. | ||
11 | |||
12 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 10 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
13 | --- | 11 | --- |
14 | block/io.c | 6 ++++++ | 12 | tests/qemu-iotests/026.out | 168 ++++++++++++++++++------------------- |
15 | tests/qemu-iotests/197 | 9 +++++++++ | 13 | tests/qemu-iotests/060.out | 6 +- |
16 | tests/qemu-iotests/197.out | 8 ++++++++ | 14 | tests/qemu-iotests/069.out | 2 +- |
17 | 3 files changed, 23 insertions(+) | 15 | tests/qemu-iotests/070.out | 2 +- |
16 | tests/qemu-iotests/075.out | 14 ++-- | ||
17 | tests/qemu-iotests/076.out | 6 +- | ||
18 | tests/qemu-iotests/078.out | 12 +-- | ||
19 | tests/qemu-iotests/080.out | 40 ++++----- | ||
20 | tests/qemu-iotests/081.out | 2 +- | ||
21 | tests/qemu-iotests/088.out | 12 +-- | ||
22 | tests/qemu-iotests/103.out | 14 ++-- | ||
23 | tests/qemu-iotests/114.out | 2 +- | ||
24 | tests/qemu-iotests/116.out | 14 ++-- | ||
25 | tests/qemu-iotests/131.out | 2 +- | ||
26 | tests/qemu-iotests/133.out | 30 +++---- | ||
27 | tests/qemu-iotests/137.out | 28 +++---- | ||
28 | tests/qemu-iotests/140.out | 2 +- | ||
29 | tests/qemu-iotests/143.out | 2 +- | ||
30 | tests/qemu-iotests/153.out | 30 +++---- | ||
31 | tests/qemu-iotests/187.out | 6 +- | ||
32 | tests/qemu-iotests/188.out | 2 +- | ||
33 | tests/qemu-iotests/197.out | 2 +- | ||
34 | tests/qemu-iotests/205 | 2 +- | ||
35 | tests/qemu-iotests/215.out | 2 +- | ||
36 | tests/qemu-iotests/226.out | 16 ++-- | ||
37 | tests/qemu-iotests/244.out | 10 +-- | ||
38 | 26 files changed, 214 insertions(+), 214 deletions(-) | ||
18 | 39 | ||
19 | diff --git a/block/io.c b/block/io.c | 40 | diff --git a/tests/qemu-iotests/026.out b/tests/qemu-iotests/026.out |
20 | index XXXXXXX..XXXXXXX 100644 | 41 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/block/io.c | 42 | --- a/tests/qemu-iotests/026.out |
22 | +++ b/block/io.c | 43 | +++ b/tests/qemu-iotests/026.out |
23 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BdrvChild *child, | 44 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. |
24 | pnum = MIN(cluster_bytes, max_transfer); | 45 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 |
25 | } | 46 | |
26 | 47 | Event: l1_update; errno: 5; imm: off; once: off; write | |
27 | + /* Stop at EOF if the image ends in the middle of the cluster */ | 48 | -Failed to flush the L2 table cache: Input/output error |
28 | + if (ret == 0 && pnum == 0) { | 49 | -Failed to flush the refcount block cache: Input/output error |
29 | + assert(progress >= bytes); | 50 | +qemu-io: Failed to flush the L2 table cache: Input/output error |
30 | + break; | 51 | +qemu-io: Failed to flush the refcount block cache: Input/output error |
31 | + } | 52 | write failed: Input/output error |
32 | + | 53 | |
33 | assert(skip_bytes < pnum); | 54 | 1 leaked clusters were found on the image. |
34 | 55 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | |
35 | if (ret <= 0) { | 56 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 |
36 | diff --git a/tests/qemu-iotests/197 b/tests/qemu-iotests/197 | 57 | |
37 | index XXXXXXX..XXXXXXX 100755 | 58 | Event: l1_update; errno: 5; imm: off; once: off; write -b |
38 | --- a/tests/qemu-iotests/197 | 59 | -Failed to flush the L2 table cache: Input/output error |
39 | +++ b/tests/qemu-iotests/197 | 60 | -Failed to flush the refcount block cache: Input/output error |
40 | @@ -XXX,XX +XXX,XX @@ $QEMU_IO -f qcow2 -c map "$TEST_WRAP" | 61 | +qemu-io: Failed to flush the L2 table cache: Input/output error |
41 | _check_test_img | 62 | +qemu-io: Failed to flush the refcount block cache: Input/output error |
42 | $QEMU_IMG compare -f $IMGFMT -F qcow2 "$TEST_IMG" "$TEST_WRAP" | 63 | write failed: Input/output error |
43 | 64 | ||
44 | +echo | 65 | 1 leaked clusters were found on the image. |
45 | +echo '=== Partial final cluster ===' | 66 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. |
46 | +echo | 67 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 |
47 | + | 68 | |
48 | +_make_test_img 1024 | 69 | Event: l1_update; errno: 28; imm: off; once: off; write |
49 | +$QEMU_IO -f $IMGFMT -C -c 'read 0 1024' "$TEST_IMG" | _filter_qemu_io | 70 | -Failed to flush the L2 table cache: No space left on device |
50 | +$QEMU_IO -f $IMGFMT -c map "$TEST_IMG" | 71 | -Failed to flush the refcount block cache: No space left on device |
51 | +_check_test_img | 72 | +qemu-io: Failed to flush the L2 table cache: No space left on device |
52 | + | 73 | +qemu-io: Failed to flush the refcount block cache: No space left on device |
53 | # success, all done | 74 | write failed: No space left on device |
54 | echo '*** done' | 75 | |
55 | status=0 | 76 | 1 leaked clusters were found on the image. |
77 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
78 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
79 | |||
80 | Event: l1_update; errno: 28; imm: off; once: off; write -b | ||
81 | -Failed to flush the L2 table cache: No space left on device | ||
82 | -Failed to flush the refcount block cache: No space left on device | ||
83 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
84 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
85 | write failed: No space left on device | ||
86 | |||
87 | 1 leaked clusters were found on the image. | ||
88 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
89 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
90 | |||
91 | Event: l2_update; errno: 5; imm: off; once: off; write | ||
92 | -Failed to flush the L2 table cache: Input/output error | ||
93 | -Failed to flush the refcount block cache: Input/output error | ||
94 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
95 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
96 | write failed: Input/output error | ||
97 | |||
98 | 127 leaked clusters were found on the image. | ||
99 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
100 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
101 | |||
102 | Event: l2_update; errno: 5; imm: off; once: off; write -b | ||
103 | -Failed to flush the L2 table cache: Input/output error | ||
104 | -Failed to flush the refcount block cache: Input/output error | ||
105 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
106 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
107 | write failed: Input/output error | ||
108 | |||
109 | 127 leaked clusters were found on the image. | ||
110 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
111 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
112 | |||
113 | Event: l2_update; errno: 28; imm: off; once: off; write | ||
114 | -Failed to flush the L2 table cache: No space left on device | ||
115 | -Failed to flush the refcount block cache: No space left on device | ||
116 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
117 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
118 | write failed: No space left on device | ||
119 | |||
120 | 127 leaked clusters were found on the image. | ||
121 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
122 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
123 | |||
124 | Event: l2_update; errno: 28; imm: off; once: off; write -b | ||
125 | -Failed to flush the L2 table cache: No space left on device | ||
126 | -Failed to flush the refcount block cache: No space left on device | ||
127 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
128 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
129 | write failed: No space left on device | ||
130 | |||
131 | 127 leaked clusters were found on the image. | ||
132 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
133 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
134 | |||
135 | Event: l2_alloc_write; errno: 5; imm: off; once: off; write | ||
136 | -Failed to flush the L2 table cache: Input/output error | ||
137 | -Failed to flush the refcount block cache: Input/output error | ||
138 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
139 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
140 | write failed: Input/output error | ||
141 | No errors were found on the image. | ||
142 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
143 | |||
144 | Event: l2_alloc_write; errno: 5; imm: off; once: off; write -b | ||
145 | -Failed to flush the L2 table cache: Input/output error | ||
146 | -Failed to flush the refcount block cache: Input/output error | ||
147 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
148 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
149 | write failed: Input/output error | ||
150 | |||
151 | 1 leaked clusters were found on the image. | ||
152 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
153 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
154 | |||
155 | Event: l2_alloc_write; errno: 28; imm: off; once: off; write | ||
156 | -Failed to flush the L2 table cache: No space left on device | ||
157 | -Failed to flush the refcount block cache: No space left on device | ||
158 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
159 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
160 | write failed: No space left on device | ||
161 | No errors were found on the image. | ||
162 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
163 | |||
164 | Event: l2_alloc_write; errno: 28; imm: off; once: off; write -b | ||
165 | -Failed to flush the L2 table cache: No space left on device | ||
166 | -Failed to flush the refcount block cache: No space left on device | ||
167 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
168 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
169 | write failed: No space left on device | ||
170 | |||
171 | 1 leaked clusters were found on the image. | ||
172 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
173 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
174 | |||
175 | Event: write_aio; errno: 5; imm: off; once: off; write | ||
176 | -Failed to flush the L2 table cache: Input/output error | ||
177 | -Failed to flush the refcount block cache: Input/output error | ||
178 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
179 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
180 | write failed: Input/output error | ||
181 | No errors were found on the image. | ||
182 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
183 | |||
184 | Event: write_aio; errno: 5; imm: off; once: off; write -b | ||
185 | -Failed to flush the L2 table cache: Input/output error | ||
186 | -Failed to flush the refcount block cache: Input/output error | ||
187 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
188 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
189 | write failed: Input/output error | ||
190 | No errors were found on the image. | ||
191 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
192 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
193 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
194 | |||
195 | Event: write_aio; errno: 28; imm: off; once: off; write | ||
196 | -Failed to flush the L2 table cache: No space left on device | ||
197 | -Failed to flush the refcount block cache: No space left on device | ||
198 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
199 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
200 | write failed: No space left on device | ||
201 | No errors were found on the image. | ||
202 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
203 | |||
204 | Event: write_aio; errno: 28; imm: off; once: off; write -b | ||
205 | -Failed to flush the L2 table cache: No space left on device | ||
206 | -Failed to flush the refcount block cache: No space left on device | ||
207 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
208 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
209 | write failed: No space left on device | ||
210 | No errors were found on the image. | ||
211 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
212 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
213 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
214 | |||
215 | Event: refblock_load; errno: 5; imm: off; once: off; write | ||
216 | -Failed to flush the L2 table cache: Input/output error | ||
217 | -Failed to flush the refcount block cache: Input/output error | ||
218 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
219 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
220 | write failed: Input/output error | ||
221 | No errors were found on the image. | ||
222 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
223 | |||
224 | Event: refblock_load; errno: 5; imm: off; once: off; write -b | ||
225 | -Failed to flush the L2 table cache: Input/output error | ||
226 | -Failed to flush the refcount block cache: Input/output error | ||
227 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
228 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
229 | write failed: Input/output error | ||
230 | No errors were found on the image. | ||
231 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
232 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
233 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
234 | |||
235 | Event: refblock_load; errno: 28; imm: off; once: off; write | ||
236 | -Failed to flush the L2 table cache: No space left on device | ||
237 | -Failed to flush the refcount block cache: No space left on device | ||
238 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
239 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
240 | write failed: No space left on device | ||
241 | No errors were found on the image. | ||
242 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
243 | |||
244 | Event: refblock_load; errno: 28; imm: off; once: off; write -b | ||
245 | -Failed to flush the L2 table cache: No space left on device | ||
246 | -Failed to flush the refcount block cache: No space left on device | ||
247 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
248 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
249 | write failed: No space left on device | ||
250 | No errors were found on the image. | ||
251 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
252 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
253 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
254 | |||
255 | Event: refblock_update_part; errno: 5; imm: off; once: off; write | ||
256 | -Failed to flush the L2 table cache: Input/output error | ||
257 | -Failed to flush the refcount block cache: Input/output error | ||
258 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
259 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
260 | write failed: Input/output error | ||
261 | No errors were found on the image. | ||
262 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
263 | |||
264 | Event: refblock_update_part; errno: 5; imm: off; once: off; write -b | ||
265 | -Failed to flush the L2 table cache: Input/output error | ||
266 | -Failed to flush the refcount block cache: Input/output error | ||
267 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
268 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
269 | write failed: Input/output error | ||
270 | No errors were found on the image. | ||
271 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
272 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
273 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
274 | |||
275 | Event: refblock_update_part; errno: 28; imm: off; once: off; write | ||
276 | -Failed to flush the L2 table cache: No space left on device | ||
277 | -Failed to flush the refcount block cache: No space left on device | ||
278 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
279 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
280 | write failed: No space left on device | ||
281 | No errors were found on the image. | ||
282 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
283 | |||
284 | Event: refblock_update_part; errno: 28; imm: off; once: off; write -b | ||
285 | -Failed to flush the L2 table cache: No space left on device | ||
286 | -Failed to flush the refcount block cache: No space left on device | ||
287 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
288 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
289 | write failed: No space left on device | ||
290 | No errors were found on the image. | ||
291 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
292 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
293 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
294 | |||
295 | Event: refblock_alloc; errno: 5; imm: off; once: off; write | ||
296 | -Failed to flush the L2 table cache: Input/output error | ||
297 | -Failed to flush the refcount block cache: Input/output error | ||
298 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
299 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
300 | write failed: Input/output error | ||
301 | No errors were found on the image. | ||
302 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
303 | |||
304 | Event: refblock_alloc; errno: 5; imm: off; once: off; write -b | ||
305 | -Failed to flush the L2 table cache: Input/output error | ||
306 | -Failed to flush the refcount block cache: Input/output error | ||
307 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
308 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
309 | write failed: Input/output error | ||
310 | No errors were found on the image. | ||
311 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
312 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
313 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
314 | |||
315 | Event: refblock_alloc; errno: 28; imm: off; once: off; write | ||
316 | -Failed to flush the L2 table cache: No space left on device | ||
317 | -Failed to flush the refcount block cache: No space left on device | ||
318 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
319 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
320 | write failed: No space left on device | ||
321 | No errors were found on the image. | ||
322 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
323 | |||
324 | Event: refblock_alloc; errno: 28; imm: off; once: off; write -b | ||
325 | -Failed to flush the L2 table cache: No space left on device | ||
326 | -Failed to flush the refcount block cache: No space left on device | ||
327 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
328 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
329 | write failed: No space left on device | ||
330 | No errors were found on the image. | ||
331 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
332 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
333 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
334 | |||
335 | Event: refblock_alloc_hookup; errno: 28; imm: off; once: off; write | ||
336 | -Failed to flush the L2 table cache: No space left on device | ||
337 | -Failed to flush the refcount block cache: No space left on device | ||
338 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
339 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
340 | write failed: No space left on device | ||
341 | |||
342 | 55 leaked clusters were found on the image. | ||
343 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
344 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
345 | |||
346 | Event: refblock_alloc_hookup; errno: 28; imm: off; once: off; write -b | ||
347 | -Failed to flush the L2 table cache: No space left on device | ||
348 | -Failed to flush the refcount block cache: No space left on device | ||
349 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
350 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
351 | write failed: No space left on device | ||
352 | |||
353 | 251 leaked clusters were found on the image. | ||
354 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
355 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
356 | |||
357 | Event: refblock_alloc_write; errno: 28; imm: off; once: off; write | ||
358 | -Failed to flush the L2 table cache: No space left on device | ||
359 | -Failed to flush the refcount block cache: No space left on device | ||
360 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
361 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
362 | write failed: No space left on device | ||
363 | No errors were found on the image. | ||
364 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
365 | |||
366 | Event: refblock_alloc_write; errno: 28; imm: off; once: off; write -b | ||
367 | -Failed to flush the L2 table cache: No space left on device | ||
368 | -Failed to flush the refcount block cache: No space left on device | ||
369 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
370 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
371 | write failed: No space left on device | ||
372 | No errors were found on the image. | ||
373 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
374 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
375 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
376 | |||
377 | Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: off; write | ||
378 | -Failed to flush the L2 table cache: No space left on device | ||
379 | -Failed to flush the refcount block cache: No space left on device | ||
380 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
381 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
382 | write failed: No space left on device | ||
383 | |||
384 | 10 leaked clusters were found on the image. | ||
385 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
386 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
387 | |||
388 | Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: off; write -b | ||
389 | -Failed to flush the L2 table cache: No space left on device | ||
390 | -Failed to flush the refcount block cache: No space left on device | ||
391 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
392 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
393 | write failed: No space left on device | ||
394 | |||
395 | 23 leaked clusters were found on the image. | ||
396 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
397 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
398 | |||
399 | Event: refblock_alloc_write_table; errno: 28; imm: off; once: off; write | ||
400 | -Failed to flush the L2 table cache: No space left on device | ||
401 | -Failed to flush the refcount block cache: No space left on device | ||
402 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
403 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
404 | write failed: No space left on device | ||
405 | |||
406 | 10 leaked clusters were found on the image. | ||
407 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
408 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
409 | |||
410 | Event: refblock_alloc_write_table; errno: 28; imm: off; once: off; write -b | ||
411 | -Failed to flush the L2 table cache: No space left on device | ||
412 | -Failed to flush the refcount block cache: No space left on device | ||
413 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
414 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
415 | write failed: No space left on device | ||
416 | |||
417 | 23 leaked clusters were found on the image. | ||
418 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
419 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
420 | |||
421 | Event: refblock_alloc_switch_table; errno: 28; imm: off; once: off; write | ||
422 | -Failed to flush the L2 table cache: No space left on device | ||
423 | -Failed to flush the refcount block cache: No space left on device | ||
424 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
425 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
426 | write failed: No space left on device | ||
427 | |||
428 | 10 leaked clusters were found on the image. | ||
429 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
430 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
431 | |||
432 | Event: refblock_alloc_switch_table; errno: 28; imm: off; once: off; write -b | ||
433 | -Failed to flush the L2 table cache: No space left on device | ||
434 | -Failed to flush the refcount block cache: No space left on device | ||
435 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
436 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
437 | write failed: No space left on device | ||
438 | |||
439 | 23 leaked clusters were found on the image. | ||
440 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
441 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
442 | |||
443 | Event: l1_grow_write_table; errno: 5; imm: off; once: off | ||
444 | -Failed to flush the L2 table cache: Input/output error | ||
445 | -Failed to flush the refcount block cache: Input/output error | ||
446 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
447 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
448 | write failed: Input/output error | ||
449 | No errors were found on the image. | ||
450 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
451 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
452 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
453 | |||
454 | Event: l1_grow_write_table; errno: 28; imm: off; once: off | ||
455 | -Failed to flush the L2 table cache: No space left on device | ||
456 | -Failed to flush the refcount block cache: No space left on device | ||
457 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
458 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
459 | write failed: No space left on device | ||
460 | No errors were found on the image. | ||
461 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
462 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
463 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
464 | |||
465 | Event: l1_grow_activate_table; errno: 5; imm: off; once: off | ||
466 | -Failed to flush the L2 table cache: Input/output error | ||
467 | -Failed to flush the refcount block cache: Input/output error | ||
468 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
469 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
470 | write failed: Input/output error | ||
471 | |||
472 | 96 leaked clusters were found on the image. | ||
473 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
474 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
475 | |||
476 | Event: l1_grow_activate_table; errno: 28; imm: off; once: off | ||
477 | -Failed to flush the L2 table cache: No space left on device | ||
478 | -Failed to flush the refcount block cache: No space left on device | ||
479 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
480 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
481 | write failed: No space left on device | ||
482 | |||
483 | 96 leaked clusters were found on the image. | ||
484 | diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out | ||
485 | index XXXXXXX..XXXXXXX 100644 | ||
486 | --- a/tests/qemu-iotests/060.out | ||
487 | +++ b/tests/qemu-iotests/060.out | ||
488 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
489 | lazy refcounts: false | ||
490 | refcount bits: 16 | ||
491 | corrupt: true | ||
492 | -can't open device TEST_DIR/t.IMGFMT: IMGFMT: Image is corrupt; cannot be opened read/write | ||
493 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: IMGFMT: Image is corrupt; cannot be opened read/write | ||
494 | no file open, try 'help open' | ||
495 | read 512/512 bytes at offset 0 | ||
496 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
497 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
498 | === Testing zero refcount table size === | ||
499 | |||
500 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
501 | -can't open device TEST_DIR/t.IMGFMT: Image does not contain a reference count table | ||
502 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: Image does not contain a reference count table | ||
503 | ERROR cluster 0 refcount=0 reference=1 | ||
504 | ERROR cluster 3 refcount=0 reference=1 | ||
505 | Rebuilding refcount structure | ||
506 | @@ -XXX,XX +XXX,XX @@ Can't get refcount for cluster 2: Input/output error | ||
507 | Can't get refcount for cluster 3: Input/output error | ||
508 | Rebuilding refcount structure | ||
509 | Repairing cluster 1 refcount=1 reference=0 | ||
510 | -can't open device TEST_DIR/t.IMGFMT: Could not repair dirty image: Input/output error | ||
511 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: Could not repair dirty image: Input/output error | ||
512 | --- Repairing --- | ||
513 | Leaked cluster 1 refcount=1 reference=0 | ||
514 | Repairing cluster 1 refcount=1 reference=0 | ||
515 | diff --git a/tests/qemu-iotests/069.out b/tests/qemu-iotests/069.out | ||
516 | index XXXXXXX..XXXXXXX 100644 | ||
517 | --- a/tests/qemu-iotests/069.out | ||
518 | +++ b/tests/qemu-iotests/069.out | ||
519 | @@ -XXX,XX +XXX,XX @@ QA output created by 069 | ||
520 | |||
521 | Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=131072 | ||
522 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=131072 backing_file=TEST_DIR/t.IMGFMT.base | ||
523 | -can't open device TEST_DIR/t.IMGFMT: Could not open backing file: Could not open 'TEST_DIR/t.IMGFMT.base': No such file or directory | ||
524 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: Could not open backing file: Could not open 'TEST_DIR/t.IMGFMT.base': No such file or directory | ||
525 | *** done | ||
526 | diff --git a/tests/qemu-iotests/070.out b/tests/qemu-iotests/070.out | ||
527 | index XXXXXXX..XXXXXXX 100644 | ||
528 | --- a/tests/qemu-iotests/070.out | ||
529 | +++ b/tests/qemu-iotests/070.out | ||
530 | @@ -XXX,XX +XXX,XX @@ | ||
531 | QA output created by 070 | ||
532 | |||
533 | === Verify open image read-only fails, due to dirty log === | ||
534 | -can't open device TEST_DIR/iotest-dirtylog-10G-4M.vhdx: VHDX image file 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx' opened read-only, but contains a log that needs to be replayed | ||
535 | +qemu-io: can't open device TEST_DIR/iotest-dirtylog-10G-4M.vhdx: VHDX image file 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx' opened read-only, but contains a log that needs to be replayed | ||
536 | To replay the log, run: | ||
537 | qemu-img check -r all 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx' | ||
538 | === Verify open image replays log === | ||
539 | diff --git a/tests/qemu-iotests/075.out b/tests/qemu-iotests/075.out | ||
540 | index XXXXXXX..XXXXXXX 100644 | ||
541 | --- a/tests/qemu-iotests/075.out | ||
542 | +++ b/tests/qemu-iotests/075.out | ||
543 | @@ -XXX,XX +XXX,XX @@ read 512/512 bytes at offset 1048064 | ||
544 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
545 | |||
546 | == block_size must be a multiple of 512 == | ||
547 | -can't open device TEST_DIR/simple-pattern.cloop: block_size 513 must be a multiple of 512 | ||
548 | +qemu-io: can't open device TEST_DIR/simple-pattern.cloop: block_size 513 must be a multiple of 512 | ||
549 | |||
550 | == block_size cannot be zero == | ||
551 | -can't open device TEST_DIR/simple-pattern.cloop: block_size cannot be zero | ||
552 | +qemu-io: can't open device TEST_DIR/simple-pattern.cloop: block_size cannot be zero | ||
553 | |||
554 | == huge block_size === | ||
555 | -can't open device TEST_DIR/simple-pattern.cloop: block_size 4294966784 must be 64 MB or less | ||
556 | +qemu-io: can't open device TEST_DIR/simple-pattern.cloop: block_size 4294966784 must be 64 MB or less | ||
557 | |||
558 | == offsets_size overflow === | ||
559 | -can't open device TEST_DIR/simple-pattern.cloop: n_blocks 4294967295 must be 536870911 or less | ||
560 | +qemu-io: can't open device TEST_DIR/simple-pattern.cloop: n_blocks 4294967295 must be 536870911 or less | ||
561 | |||
562 | == refuse images that require too many offsets === | ||
563 | -can't open device TEST_DIR/simple-pattern.cloop: image requires too many offsets, try increasing block size | ||
564 | +qemu-io: can't open device TEST_DIR/simple-pattern.cloop: image requires too many offsets, try increasing block size | ||
565 | |||
566 | == refuse images with non-monotonically increasing offsets == | ||
567 | -can't open device TEST_DIR/simple-pattern.cloop: offsets not monotonically increasing at index 1, image file is corrupt | ||
568 | +qemu-io: can't open device TEST_DIR/simple-pattern.cloop: offsets not monotonically increasing at index 1, image file is corrupt | ||
569 | |||
570 | == refuse images with invalid compressed block size == | ||
571 | -can't open device TEST_DIR/simple-pattern.cloop: invalid compressed block size at index 1, image file is corrupt | ||
572 | +qemu-io: can't open device TEST_DIR/simple-pattern.cloop: invalid compressed block size at index 1, image file is corrupt | ||
573 | *** done | ||
574 | diff --git a/tests/qemu-iotests/076.out b/tests/qemu-iotests/076.out | ||
575 | index XXXXXXX..XXXXXXX 100644 | ||
576 | --- a/tests/qemu-iotests/076.out | ||
577 | +++ b/tests/qemu-iotests/076.out | ||
578 | @@ -XXX,XX +XXX,XX @@ read 65536/65536 bytes at offset 0 | ||
579 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
580 | |||
581 | == Negative catalog size == | ||
582 | -can't open device TEST_DIR/parallels-v1: Catalog too large | ||
583 | +qemu-io: can't open device TEST_DIR/parallels-v1: Catalog too large | ||
584 | |||
585 | == Overflow in catalog allocation == | ||
586 | -can't open device TEST_DIR/parallels-v1: Catalog too large | ||
587 | +qemu-io: can't open device TEST_DIR/parallels-v1: Catalog too large | ||
588 | |||
589 | == Zero sectors per track == | ||
590 | -can't open device TEST_DIR/parallels-v1: Invalid image: Zero sectors per track | ||
591 | +qemu-io: can't open device TEST_DIR/parallels-v1: Invalid image: Zero sectors per track | ||
592 | |||
593 | == Read from a valid v2 image == | ||
594 | read 65536/65536 bytes at offset 0 | ||
595 | diff --git a/tests/qemu-iotests/078.out b/tests/qemu-iotests/078.out | ||
596 | index XXXXXXX..XXXXXXX 100644 | ||
597 | --- a/tests/qemu-iotests/078.out | ||
598 | +++ b/tests/qemu-iotests/078.out | ||
599 | @@ -XXX,XX +XXX,XX @@ read 512/512 bytes at offset 0 | ||
600 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
601 | |||
602 | == Negative catalog size == | ||
603 | -can't open device TEST_DIR/empty.bochs: Catalog size is too large | ||
604 | +qemu-io: can't open device TEST_DIR/empty.bochs: Catalog size is too large | ||
605 | |||
606 | == Overflow for catalog size * sizeof(uint32_t) == | ||
607 | -can't open device TEST_DIR/empty.bochs: Catalog size is too large | ||
608 | +qemu-io: can't open device TEST_DIR/empty.bochs: Catalog size is too large | ||
609 | |||
610 | == Too small catalog bitmap for image size == | ||
611 | -can't open device TEST_DIR/empty.bochs: Catalog size is too small for this disk size | ||
612 | -can't open device TEST_DIR/empty.bochs: Catalog size is too small for this disk size | ||
613 | +qemu-io: can't open device TEST_DIR/empty.bochs: Catalog size is too small for this disk size | ||
614 | +qemu-io: can't open device TEST_DIR/empty.bochs: Catalog size is too small for this disk size | ||
615 | |||
616 | == Negative extent size == | ||
617 | -can't open device TEST_DIR/empty.bochs: Extent size 2147483648 is too large | ||
618 | +qemu-io: can't open device TEST_DIR/empty.bochs: Extent size 2147483648 is too large | ||
619 | |||
620 | == Zero extent size == | ||
621 | -can't open device TEST_DIR/empty.bochs: Extent size must be at least 512 | ||
622 | +qemu-io: can't open device TEST_DIR/empty.bochs: Extent size must be at least 512 | ||
623 | *** done | ||
624 | diff --git a/tests/qemu-iotests/080.out b/tests/qemu-iotests/080.out | ||
625 | index XXXXXXX..XXXXXXX 100644 | ||
626 | --- a/tests/qemu-iotests/080.out | ||
627 | +++ b/tests/qemu-iotests/080.out | ||
628 | @@ -XXX,XX +XXX,XX @@ QA output created by 080 | ||
629 | |||
630 | == Huge header size == | ||
631 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
632 | -can't open device TEST_DIR/t.qcow2: qcow2 header exceeds cluster size | ||
633 | -can't open device TEST_DIR/t.qcow2: qcow2 header exceeds cluster size | ||
634 | +qemu-io: can't open device TEST_DIR/t.qcow2: qcow2 header exceeds cluster size | ||
635 | +qemu-io: can't open device TEST_DIR/t.qcow2: qcow2 header exceeds cluster size | ||
636 | |||
637 | == Huge unknown header extension == | ||
638 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
639 | -can't open device TEST_DIR/t.qcow2: Invalid backing file offset | ||
640 | -can't open device TEST_DIR/t.qcow2: Header extension too large | ||
641 | -can't open device TEST_DIR/t.qcow2: Header extension too large | ||
642 | +qemu-io: can't open device TEST_DIR/t.qcow2: Invalid backing file offset | ||
643 | +qemu-io: can't open device TEST_DIR/t.qcow2: Header extension too large | ||
644 | +qemu-io: can't open device TEST_DIR/t.qcow2: Header extension too large | ||
645 | |||
646 | == Huge refcount table size == | ||
647 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
648 | -can't open device TEST_DIR/t.qcow2: Reference count table too large | ||
649 | -can't open device TEST_DIR/t.qcow2: Reference count table too large | ||
650 | +qemu-io: can't open device TEST_DIR/t.qcow2: Reference count table too large | ||
651 | +qemu-io: can't open device TEST_DIR/t.qcow2: Reference count table too large | ||
652 | |||
653 | == Misaligned refcount table == | ||
654 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
655 | -can't open device TEST_DIR/t.qcow2: Reference count table offset invalid | ||
656 | +qemu-io: can't open device TEST_DIR/t.qcow2: Reference count table offset invalid | ||
657 | |||
658 | == Huge refcount offset == | ||
659 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
660 | -can't open device TEST_DIR/t.qcow2: Reference count table offset invalid | ||
661 | +qemu-io: can't open device TEST_DIR/t.qcow2: Reference count table offset invalid | ||
662 | |||
663 | == Invalid snapshot table == | ||
664 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
665 | -can't open device TEST_DIR/t.qcow2: Snapshot table too large | ||
666 | -can't open device TEST_DIR/t.qcow2: Snapshot table too large | ||
667 | -can't open device TEST_DIR/t.qcow2: Snapshot table offset invalid | ||
668 | -can't open device TEST_DIR/t.qcow2: Snapshot table offset invalid | ||
669 | +qemu-io: can't open device TEST_DIR/t.qcow2: Snapshot table too large | ||
670 | +qemu-io: can't open device TEST_DIR/t.qcow2: Snapshot table too large | ||
671 | +qemu-io: can't open device TEST_DIR/t.qcow2: Snapshot table offset invalid | ||
672 | +qemu-io: can't open device TEST_DIR/t.qcow2: Snapshot table offset invalid | ||
673 | |||
674 | == Hitting snapshot table size limit == | ||
675 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
676 | @@ -XXX,XX +XXX,XX @@ read 512/512 bytes at offset 0 | ||
677 | |||
678 | == Invalid L1 table == | ||
679 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
680 | -can't open device TEST_DIR/t.qcow2: Active L1 table too large | ||
681 | -can't open device TEST_DIR/t.qcow2: Active L1 table too large | ||
682 | -can't open device TEST_DIR/t.qcow2: Active L1 table offset invalid | ||
683 | -can't open device TEST_DIR/t.qcow2: Active L1 table offset invalid | ||
684 | +qemu-io: can't open device TEST_DIR/t.qcow2: Active L1 table too large | ||
685 | +qemu-io: can't open device TEST_DIR/t.qcow2: Active L1 table too large | ||
686 | +qemu-io: can't open device TEST_DIR/t.qcow2: Active L1 table offset invalid | ||
687 | +qemu-io: can't open device TEST_DIR/t.qcow2: Active L1 table offset invalid | ||
688 | |||
689 | == Invalid L1 table (with internal snapshot in the image) == | ||
690 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
691 | @@ -XXX,XX +XXX,XX @@ qemu-img: Could not open 'TEST_DIR/t.IMGFMT': L1 table is too small | ||
692 | |||
693 | == Invalid backing file size == | ||
694 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
695 | -can't open device TEST_DIR/t.qcow2: Backing file name too long | ||
696 | +qemu-io: can't open device TEST_DIR/t.qcow2: Backing file name too long | ||
697 | |||
698 | == Invalid L2 entry (huge physical offset) == | ||
699 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
700 | @@ -XXX,XX +XXX,XX @@ wrote 512/512 bytes at offset 0 | ||
701 | qemu-img: Failed to load snapshot: Snapshot L1 table offset invalid | ||
702 | qemu-img: Snapshot L1 table offset invalid | ||
703 | qemu-img: Failed to turn zero into data clusters: Invalid argument | ||
704 | -Failed to flush the refcount block cache: Invalid argument | ||
705 | +qemu-io: Failed to flush the refcount block cache: Invalid argument | ||
706 | write failed: Invalid argument | ||
707 | qemu-img: Snapshot L1 table offset invalid | ||
708 | qemu-img: Could not apply snapshot 'test': Failed to load snapshot: Invalid argument | ||
709 | @@ -XXX,XX +XXX,XX @@ wrote 512/512 bytes at offset 0 | ||
710 | qemu-img: Failed to load snapshot: Snapshot L1 table too large | ||
711 | qemu-img: Snapshot L1 table too large | ||
712 | qemu-img: Failed to turn zero into data clusters: File too large | ||
713 | -Failed to flush the refcount block cache: File too large | ||
714 | +qemu-io: Failed to flush the refcount block cache: File too large | ||
715 | write failed: File too large | ||
716 | qemu-img: Snapshot L1 table too large | ||
717 | qemu-img: Could not apply snapshot 'test': Failed to load snapshot: File too large | ||
718 | diff --git a/tests/qemu-iotests/081.out b/tests/qemu-iotests/081.out | ||
719 | index XXXXXXX..XXXXXXX 100644 | ||
720 | --- a/tests/qemu-iotests/081.out | ||
721 | +++ b/tests/qemu-iotests/081.out | ||
722 | @@ -XXX,XX +XXX,XX @@ read 10485760/10485760 bytes at offset 0 | ||
723 | 10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
724 | |||
725 | == checking the blkverify mode with invalid settings == | ||
726 | -can't open: blkverify=on can only be set if there are exactly two files and vote-threshold is 2 | ||
727 | +qemu-io: can't open: blkverify=on can only be set if there are exactly two files and vote-threshold is 2 | ||
728 | |||
729 | == dynamically adding a child to a quorum == | ||
730 | Testing: | ||
731 | diff --git a/tests/qemu-iotests/088.out b/tests/qemu-iotests/088.out | ||
732 | index XXXXXXX..XXXXXXX 100644 | ||
733 | --- a/tests/qemu-iotests/088.out | ||
734 | +++ b/tests/qemu-iotests/088.out | ||
735 | @@ -XXX,XX +XXX,XX @@ QA output created by 088 | ||
736 | |||
737 | == Invalid block size == | ||
738 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
739 | -can't open device TEST_DIR/t.vpc: Invalid block size 0 | ||
740 | -can't open device TEST_DIR/t.vpc: Invalid block size 0 | ||
741 | -can't open device TEST_DIR/t.vpc: Invalid block size 128 | ||
742 | -can't open device TEST_DIR/t.vpc: Invalid block size 128 | ||
743 | -can't open device TEST_DIR/t.vpc: Invalid block size 305419896 | ||
744 | -can't open device TEST_DIR/t.vpc: Invalid block size 305419896 | ||
745 | +qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 0 | ||
746 | +qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 0 | ||
747 | +qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 128 | ||
748 | +qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 128 | ||
749 | +qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 305419896 | ||
750 | +qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 305419896 | ||
751 | *** done | ||
752 | diff --git a/tests/qemu-iotests/103.out b/tests/qemu-iotests/103.out | ||
753 | index XXXXXXX..XXXXXXX 100644 | ||
754 | --- a/tests/qemu-iotests/103.out | ||
755 | +++ b/tests/qemu-iotests/103.out | ||
756 | @@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 0 | ||
757 | |||
758 | === Testing invalid option combinations === | ||
759 | |||
760 | -can't open device TEST_DIR/t.IMGFMT: cache-size, l2-cache-size and refcount-cache-size may not be set at the same time | ||
761 | -can't open device TEST_DIR/t.IMGFMT: l2-cache-size may not exceed cache-size | ||
762 | -can't open device TEST_DIR/t.IMGFMT: refcount-cache-size may not exceed cache-size | ||
763 | -can't open device TEST_DIR/t.IMGFMT: cache-size, l2-cache-size and refcount-cache-size may not be set at the same time | ||
764 | -can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
765 | -can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
766 | -can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
767 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: cache-size, l2-cache-size and refcount-cache-size may not be set at the same time | ||
768 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: l2-cache-size may not exceed cache-size | ||
769 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: refcount-cache-size may not exceed cache-size | ||
770 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: cache-size, l2-cache-size and refcount-cache-size may not be set at the same time | ||
771 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
772 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
773 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
774 | |||
775 | === Testing valid option combinations === | ||
776 | |||
777 | diff --git a/tests/qemu-iotests/114.out b/tests/qemu-iotests/114.out | ||
778 | index XXXXXXX..XXXXXXX 100644 | ||
779 | --- a/tests/qemu-iotests/114.out | ||
780 | +++ b/tests/qemu-iotests/114.out | ||
781 | @@ -XXX,XX +XXX,XX @@ virtual size: 64M (67108864 bytes) | ||
782 | cluster_size: 65536 | ||
783 | backing file: TEST_DIR/t.IMGFMT.base | ||
784 | backing file format: foo | ||
785 | -can't open device TEST_DIR/t.qcow2: Could not open backing file: Unknown driver 'foo' | ||
786 | +qemu-io: can't open device TEST_DIR/t.qcow2: Could not open backing file: Unknown driver 'foo' | ||
787 | no file open, try 'help open' | ||
788 | read 4096/4096 bytes at offset 0 | ||
789 | 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
790 | diff --git a/tests/qemu-iotests/116.out b/tests/qemu-iotests/116.out | ||
791 | index XXXXXXX..XXXXXXX 100644 | ||
792 | --- a/tests/qemu-iotests/116.out | ||
793 | +++ b/tests/qemu-iotests/116.out | ||
794 | @@ -XXX,XX +XXX,XX @@ QA output created by 116 | ||
795 | |||
796 | == truncated header cluster == | ||
797 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
798 | -can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
799 | +qemu-io: can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
800 | |||
801 | == invalid header magic == | ||
802 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
803 | -can't open device TEST_DIR/t.qed: Image not in QED format | ||
804 | +qemu-io: can't open device TEST_DIR/t.qed: Image not in QED format | ||
805 | |||
806 | == invalid cluster size == | ||
807 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
808 | -can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
809 | +qemu-io: can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
810 | |||
811 | == invalid table size == | ||
812 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
813 | -can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
814 | +qemu-io: can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
815 | |||
816 | == invalid header size == | ||
817 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
818 | -can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
819 | +qemu-io: can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
820 | |||
821 | == invalid L1 table offset == | ||
822 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
823 | -can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
824 | +qemu-io: can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
825 | |||
826 | == invalid image size == | ||
827 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
828 | -can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
829 | +qemu-io: can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
830 | *** done | ||
831 | diff --git a/tests/qemu-iotests/131.out b/tests/qemu-iotests/131.out | ||
832 | index XXXXXXX..XXXXXXX 100644 | ||
833 | --- a/tests/qemu-iotests/131.out | ||
834 | +++ b/tests/qemu-iotests/131.out | ||
835 | @@ -XXX,XX +XXX,XX @@ read 32768/32768 bytes at offset 163840 | ||
836 | read 32768/32768 bytes at offset 0 | ||
837 | 32 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
838 | == Corrupt image == | ||
839 | -can't open device TEST_DIR/t.parallels: parallels: Image was not closed correctly; cannot be opened read/write | ||
840 | +qemu-io: can't open device TEST_DIR/t.parallels: parallels: Image was not closed correctly; cannot be opened read/write | ||
841 | ERROR image was not closed correctly | ||
842 | |||
843 | 1 errors were found on the image. | ||
844 | diff --git a/tests/qemu-iotests/133.out b/tests/qemu-iotests/133.out | ||
845 | index XXXXXXX..XXXXXXX 100644 | ||
846 | --- a/tests/qemu-iotests/133.out | ||
847 | +++ b/tests/qemu-iotests/133.out | ||
848 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t | ||
849 | |||
850 | === Check that node-name can't be changed === | ||
851 | |||
852 | -Cannot change the option 'node-name' | ||
853 | -Cannot change the option 'node-name' | ||
854 | -Cannot change the option 'node-name' | ||
855 | +qemu-io: Cannot change the option 'node-name' | ||
856 | +qemu-io: Cannot change the option 'node-name' | ||
857 | +qemu-io: Cannot change the option 'node-name' | ||
858 | |||
859 | === Check that unchanged node-name is okay === | ||
860 | |||
861 | |||
862 | === Check that driver can't be changed === | ||
863 | |||
864 | -Cannot change the option 'driver' | ||
865 | -Cannot change the option 'driver' | ||
866 | -Cannot change the option 'driver' | ||
867 | +qemu-io: Cannot change the option 'driver' | ||
868 | +qemu-io: Cannot change the option 'driver' | ||
869 | +qemu-io: Cannot change the option 'driver' | ||
870 | |||
871 | === Check that unchanged driver is okay === | ||
872 | |||
873 | @@ -XXX,XX +XXX,XX @@ format name: null-co | ||
874 | |||
875 | === Check that mixing -c/-r/-w and their corresponding options is forbidden === | ||
876 | |||
877 | -Cannot set both -r/-w and 'read-only' | ||
878 | -Cannot set both -r/-w and 'read-only' | ||
879 | -Cannot set both -c and the cache options | ||
880 | -Cannot set both -c and the cache options | ||
881 | -Cannot set both -c and the cache options | ||
882 | +qemu-io: Cannot set both -r/-w and 'read-only' | ||
883 | +qemu-io: Cannot set both -r/-w and 'read-only' | ||
884 | +qemu-io: Cannot set both -c and the cache options | ||
885 | +qemu-io: Cannot set both -c and the cache options | ||
886 | +qemu-io: Cannot set both -c and the cache options | ||
887 | |||
888 | === Check that invalid options are handled correctly === | ||
889 | |||
890 | -Parameter 'read-only' expects 'on' or 'off' | ||
891 | -Parameter 'cache.no-flush' expects 'on' or 'off' | ||
892 | -Parameter 'cache.direct' expects 'on' or 'off' | ||
893 | -Parameter 'auto-read-only' expects 'on' or 'off' | ||
894 | +qemu-io: Parameter 'read-only' expects 'on' or 'off' | ||
895 | +qemu-io: Parameter 'cache.no-flush' expects 'on' or 'off' | ||
896 | +qemu-io: Parameter 'cache.direct' expects 'on' or 'off' | ||
897 | +qemu-io: Parameter 'auto-read-only' expects 'on' or 'off' | ||
898 | *** done | ||
899 | diff --git a/tests/qemu-iotests/137.out b/tests/qemu-iotests/137.out | ||
900 | index XXXXXXX..XXXXXXX 100644 | ||
901 | --- a/tests/qemu-iotests/137.out | ||
902 | +++ b/tests/qemu-iotests/137.out | ||
903 | @@ -XXX,XX +XXX,XX @@ read 33554432/33554432 bytes at offset 0 | ||
904 | |||
905 | === Try setting some invalid values === | ||
906 | |||
907 | -Parameter 'lazy-refcounts' expects 'on' or 'off' | ||
908 | -cache-size, l2-cache-size and refcount-cache-size may not be set at the same time | ||
909 | -l2-cache-size may not exceed cache-size | ||
910 | -refcount-cache-size may not exceed cache-size | ||
911 | -L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
912 | -L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
913 | -Refcount cache size too big | ||
914 | -Conflicting values for qcow2 options 'overlap-check' ('constant') and 'overlap-check.template' ('all') | ||
915 | -Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all | ||
916 | -Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all | ||
917 | -Cache clean interval too big | ||
918 | +qemu-io: Parameter 'lazy-refcounts' expects 'on' or 'off' | ||
919 | +qemu-io: cache-size, l2-cache-size and refcount-cache-size may not be set at the same time | ||
920 | +qemu-io: l2-cache-size may not exceed cache-size | ||
921 | +qemu-io: refcount-cache-size may not exceed cache-size | ||
922 | +qemu-io: L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
923 | +qemu-io: L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
924 | +qemu-io: Refcount cache size too big | ||
925 | +qemu-io: Conflicting values for qcow2 options 'overlap-check' ('constant') and 'overlap-check.template' ('all') | ||
926 | +qemu-io: Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all | ||
927 | +qemu-io: Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all | ||
928 | +qemu-io: Cache clean interval too big | ||
929 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=36028797018963968 | ||
930 | -L2 cache size too big | ||
931 | +qemu-io: L2 cache size too big | ||
932 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
933 | |||
934 | === Test transaction semantics === | ||
935 | |||
936 | -Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all | ||
937 | +qemu-io: Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all | ||
938 | wrote 512/512 bytes at offset 0 | ||
939 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
940 | ./common.rc: Killed ( if [ "${VALGRIND_QEMU}" == "y" ]; then | ||
941 | @@ -XXX,XX +XXX,XX @@ incompatible_features 0x0 | ||
942 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
943 | wrote 65536/65536 bytes at offset 0 | ||
944 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
945 | -Parameter 'lazy-refcounts' expects 'on' or 'off' | ||
946 | +qemu-io: Parameter 'lazy-refcounts' expects 'on' or 'off' | ||
947 | qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with qcow2_header); further corruption events will be suppressed | ||
948 | write failed: Input/output error | ||
949 | *** done | ||
950 | diff --git a/tests/qemu-iotests/140.out b/tests/qemu-iotests/140.out | ||
951 | index XXXXXXX..XXXXXXX 100644 | ||
952 | --- a/tests/qemu-iotests/140.out | ||
953 | +++ b/tests/qemu-iotests/140.out | ||
954 | @@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 0 | ||
955 | read 65536/65536 bytes at offset 0 | ||
956 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
957 | {"return": {}} | ||
958 | -can't open device nbd+unix:///drv?socket=TEST_DIR/nbd: Requested export not available | ||
959 | +qemu-io: can't open device nbd+unix:///drv?socket=TEST_DIR/nbd: Requested export not available | ||
960 | server reported: export 'drv' not present | ||
961 | {"return": {}} | ||
962 | {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} | ||
963 | diff --git a/tests/qemu-iotests/143.out b/tests/qemu-iotests/143.out | ||
964 | index XXXXXXX..XXXXXXX 100644 | ||
965 | --- a/tests/qemu-iotests/143.out | ||
966 | +++ b/tests/qemu-iotests/143.out | ||
967 | @@ -XXX,XX +XXX,XX @@ | ||
968 | QA output created by 143 | ||
969 | {"return": {}} | ||
970 | {"return": {}} | ||
971 | -can't open device nbd+unix:///no_such_export?socket=TEST_DIR/nbd: Requested export not available | ||
972 | +qemu-io: can't open device nbd+unix:///no_such_export?socket=TEST_DIR/nbd: Requested export not available | ||
973 | server reported: export 'no_such_export' not present | ||
974 | {"return": {}} | ||
975 | {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} | ||
976 | diff --git a/tests/qemu-iotests/153.out b/tests/qemu-iotests/153.out | ||
977 | index XXXXXXX..XXXXXXX 100644 | ||
978 | --- a/tests/qemu-iotests/153.out | ||
979 | +++ b/tests/qemu-iotests/153.out | ||
980 | @@ -XXX,XX +XXX,XX @@ Is another process using the image [TEST_DIR/t.qcow2]? | ||
981 | == Running utility commands == | ||
982 | |||
983 | _qemu_io_wrapper -c read 0 512 TEST_DIR/t.qcow2 | ||
984 | -can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
985 | +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
986 | Is another process using the image [TEST_DIR/t.qcow2]? | ||
987 | |||
988 | _qemu_io_wrapper -r -c read 0 512 TEST_DIR/t.qcow2 | ||
989 | -can't open device TEST_DIR/t.qcow2: Failed to get shared "write" lock | ||
990 | +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get shared "write" lock | ||
991 | Is another process using the image [TEST_DIR/t.qcow2]? | ||
992 | |||
993 | _qemu_io_wrapper -c open TEST_DIR/t.qcow2 -c read 0 512 | ||
994 | -can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
995 | +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
996 | Is another process using the image [TEST_DIR/t.qcow2]? | ||
997 | no file open, try 'help open' | ||
998 | |||
999 | _qemu_io_wrapper -c open -r TEST_DIR/t.qcow2 -c read 0 512 | ||
1000 | -can't open device TEST_DIR/t.qcow2: Failed to get shared "write" lock | ||
1001 | +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get shared "write" lock | ||
1002 | Is another process using the image [TEST_DIR/t.qcow2]? | ||
1003 | no file open, try 'help open' | ||
1004 | |||
1005 | @@ -XXX,XX +XXX,XX @@ file format: IMGFMT | ||
1006 | == Running utility commands -U == | ||
1007 | |||
1008 | _qemu_io_wrapper -U -c read 0 512 TEST_DIR/t.qcow2 | ||
1009 | -can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1010 | +qemu-io: can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1011 | |||
1012 | _qemu_io_wrapper -U -r -c read 0 512 TEST_DIR/t.qcow2 | ||
1013 | |||
1014 | _qemu_io_wrapper -c open -U TEST_DIR/t.qcow2 -c read 0 512 | ||
1015 | -can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1016 | +qemu-io: can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1017 | no file open, try 'help open' | ||
1018 | |||
1019 | _qemu_io_wrapper -c open -r -U TEST_DIR/t.qcow2 -c read 0 512 | ||
1020 | @@ -XXX,XX +XXX,XX @@ Is another process using the image [TEST_DIR/t.qcow2]? | ||
1021 | == Running utility commands == | ||
1022 | |||
1023 | _qemu_io_wrapper -c read 0 512 TEST_DIR/t.qcow2 | ||
1024 | -can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
1025 | +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
1026 | Is another process using the image [TEST_DIR/t.qcow2]? | ||
1027 | |||
1028 | _qemu_io_wrapper -r -c read 0 512 TEST_DIR/t.qcow2 | ||
1029 | |||
1030 | _qemu_io_wrapper -c open TEST_DIR/t.qcow2 -c read 0 512 | ||
1031 | -can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
1032 | +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
1033 | Is another process using the image [TEST_DIR/t.qcow2]? | ||
1034 | no file open, try 'help open' | ||
1035 | |||
1036 | @@ -XXX,XX +XXX,XX @@ file format: IMGFMT | ||
1037 | == Running utility commands -U == | ||
1038 | |||
1039 | _qemu_io_wrapper -U -c read 0 512 TEST_DIR/t.qcow2 | ||
1040 | -can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1041 | +qemu-io: can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1042 | |||
1043 | _qemu_io_wrapper -U -r -c read 0 512 TEST_DIR/t.qcow2 | ||
1044 | |||
1045 | _qemu_io_wrapper -c open -U TEST_DIR/t.qcow2 -c read 0 512 | ||
1046 | -can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1047 | +qemu-io: can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1048 | no file open, try 'help open' | ||
1049 | |||
1050 | _qemu_io_wrapper -c open -r -U TEST_DIR/t.qcow2 -c read 0 512 | ||
1051 | @@ -XXX,XX +XXX,XX @@ file format: IMGFMT | ||
1052 | == Running utility commands -U == | ||
1053 | |||
1054 | _qemu_io_wrapper -U -c read 0 512 TEST_DIR/t.qcow2 | ||
1055 | -can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1056 | +qemu-io: can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1057 | |||
1058 | _qemu_io_wrapper -U -r -c read 0 512 TEST_DIR/t.qcow2 | ||
1059 | |||
1060 | _qemu_io_wrapper -c open -U TEST_DIR/t.qcow2 -c read 0 512 | ||
1061 | -can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1062 | +qemu-io: can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1063 | no file open, try 'help open' | ||
1064 | |||
1065 | _qemu_io_wrapper -c open -r -U TEST_DIR/t.qcow2 -c read 0 512 | ||
1066 | @@ -XXX,XX +XXX,XX @@ Adding drive | ||
1067 | {"return": "OKrn"} | ||
1068 | |||
1069 | _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512 | ||
1070 | -can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
1071 | +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
1072 | Is another process using the image [TEST_DIR/t.qcow2]? | ||
1073 | Creating overlay with qemu-img when the guest is running should be allowed | ||
1074 | |||
1075 | @@ -XXX,XX +XXX,XX @@ _qemu_img_wrapper info TEST_DIR/t.qcow2 | ||
1076 | {"return": ""} | ||
1077 | |||
1078 | _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512 | ||
1079 | -can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
1080 | +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
1081 | Is another process using the image [TEST_DIR/t.qcow2]? | ||
1082 | Closing the other | ||
1083 | {"return": ""} | ||
1084 | @@ -XXX,XX +XXX,XX @@ qemu-img: --force-share/-U conflicts with image options | ||
1085 | No conflict: | ||
1086 | |||
1087 | Conflict: | ||
1088 | --U conflicts with image options | ||
1089 | +qemu-io: -U conflicts with image options | ||
1090 | *** done | ||
1091 | diff --git a/tests/qemu-iotests/187.out b/tests/qemu-iotests/187.out | ||
1092 | index XXXXXXX..XXXXXXX 100644 | ||
1093 | --- a/tests/qemu-iotests/187.out | ||
1094 | +++ b/tests/qemu-iotests/187.out | ||
1095 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
1096 | |||
1097 | Start from read-only | ||
1098 | |||
1099 | -Block node is read-only | ||
1100 | +qemu-io: Block node is read-only | ||
1101 | wrote 65536/65536 bytes at offset 0 | ||
1102 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1103 | -Block node is read-only | ||
1104 | +qemu-io: Block node is read-only | ||
1105 | |||
1106 | Start from read-write | ||
1107 | |||
1108 | wrote 65536/65536 bytes at offset 0 | ||
1109 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1110 | -Block node is read-only | ||
1111 | +qemu-io: Block node is read-only | ||
1112 | wrote 65536/65536 bytes at offset 0 | ||
1113 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1114 | *** done | ||
1115 | diff --git a/tests/qemu-iotests/188.out b/tests/qemu-iotests/188.out | ||
1116 | index XXXXXXX..XXXXXXX 100644 | ||
1117 | --- a/tests/qemu-iotests/188.out | ||
1118 | +++ b/tests/qemu-iotests/188.out | ||
1119 | @@ -XXX,XX +XXX,XX @@ read 16777216/16777216 bytes at offset 0 | ||
1120 | 16 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1121 | |||
1122 | == verify open failure with wrong password == | ||
1123 | -can't open: Invalid password, cannot unlock any keyslot | ||
1124 | +qemu-io: can't open: Invalid password, cannot unlock any keyslot | ||
1125 | *** done | ||
56 | diff --git a/tests/qemu-iotests/197.out b/tests/qemu-iotests/197.out | 1126 | diff --git a/tests/qemu-iotests/197.out b/tests/qemu-iotests/197.out |
57 | index XXXXXXX..XXXXXXX 100644 | 1127 | index XXXXXXX..XXXXXXX 100644 |
58 | --- a/tests/qemu-iotests/197.out | 1128 | --- a/tests/qemu-iotests/197.out |
59 | +++ b/tests/qemu-iotests/197.out | 1129 | +++ b/tests/qemu-iotests/197.out |
60 | @@ -XXX,XX +XXX,XX @@ can't open device TEST_DIR/t.wrap.qcow2: Can't use copy-on-read on read-only dev | 1130 | @@ -XXX,XX +XXX,XX @@ read 2147483136/2147483136 bytes at offset 1024 |
61 | 1023.938 MiB (0x3fff0000) bytes not allocated at offset 3 GiB (0xc0010000) | 1131 | 2 GiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
62 | No errors were found on the image. | 1132 | read 1024/1024 bytes at offset 3221226496 |
63 | Images are identical. | 1133 | 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
64 | + | 1134 | -can't open device TEST_DIR/t.wrap.qcow2: Can't use copy-on-read on read-only device |
65 | +=== Partial final cluster === | 1135 | +qemu-io: can't open device TEST_DIR/t.wrap.qcow2: Can't use copy-on-read on read-only device |
66 | + | 1136 | 2 GiB (0x80010000) bytes allocated at offset 0 bytes (0x0) |
67 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024 | 1137 | 1023.938 MiB (0x3fff0000) bytes not allocated at offset 2 GiB (0x80010000) |
68 | +read 1024/1024 bytes at offset 0 | 1138 | 64 KiB (0x10000) bytes allocated at offset 3 GiB (0xc0000000) |
69 | +1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | 1139 | diff --git a/tests/qemu-iotests/205 b/tests/qemu-iotests/205 |
70 | +1 KiB (0x400) bytes allocated at offset 0 bytes (0x0) | 1140 | index XXXXXXX..XXXXXXX 100755 |
71 | +No errors were found on the image. | 1141 | --- a/tests/qemu-iotests/205 |
1142 | +++ b/tests/qemu-iotests/205 | ||
1143 | @@ -XXX,XX +XXX,XX @@ class TestNbdServerRemove(iotests.QMPTestCase): | ||
1144 | |||
1145 | def assertConnectFailed(self, qemu_io_output): | ||
1146 | self.assertEqual(filter_qemu_io(qemu_io_output).strip(), | ||
1147 | - "can't open device " + nbd_uri + | ||
1148 | + "qemu-io: can't open device " + nbd_uri + | ||
1149 | ": Requested export not available\n" | ||
1150 | "server reported: export 'exp' not present") | ||
1151 | |||
1152 | diff --git a/tests/qemu-iotests/215.out b/tests/qemu-iotests/215.out | ||
1153 | index XXXXXXX..XXXXXXX 100644 | ||
1154 | --- a/tests/qemu-iotests/215.out | ||
1155 | +++ b/tests/qemu-iotests/215.out | ||
1156 | @@ -XXX,XX +XXX,XX @@ read 2147483136/2147483136 bytes at offset 1024 | ||
1157 | 2 GiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1158 | read 1024/1024 bytes at offset 3221226496 | ||
1159 | 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1160 | -can't open device TEST_DIR/t.wrap.qcow2: Block node is read-only | ||
1161 | +qemu-io: can't open device TEST_DIR/t.wrap.qcow2: Block node is read-only | ||
1162 | 2 GiB (0x80010000) bytes allocated at offset 0 bytes (0x0) | ||
1163 | 1023.938 MiB (0x3fff0000) bytes not allocated at offset 2 GiB (0x80010000) | ||
1164 | 64 KiB (0x10000) bytes allocated at offset 3 GiB (0xc0000000) | ||
1165 | diff --git a/tests/qemu-iotests/226.out b/tests/qemu-iotests/226.out | ||
1166 | index XXXXXXX..XXXXXXX 100644 | ||
1167 | --- a/tests/qemu-iotests/226.out | ||
1168 | +++ b/tests/qemu-iotests/226.out | ||
1169 | @@ -XXX,XX +XXX,XX @@ QA output created by 226 | ||
1170 | === Testing with driver:file === | ||
1171 | |||
1172 | == Testing RO == | ||
1173 | -can't open: A regular file was expected by the 'file' driver, but something else was given | ||
1174 | -warning: Opening a character device as a file using the 'file' driver is deprecated | ||
1175 | +qemu-io: can't open: A regular file was expected by the 'file' driver, but something else was given | ||
1176 | +qemu-io: warning: Opening a character device as a file using the 'file' driver is deprecated | ||
1177 | == Testing RW == | ||
1178 | -can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory | ||
1179 | -warning: Opening a character device as a file using the 'file' driver is deprecated | ||
1180 | +qemu-io: can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory | ||
1181 | +qemu-io: warning: Opening a character device as a file using the 'file' driver is deprecated | ||
1182 | |||
1183 | === Testing with driver:host_device === | ||
1184 | |||
1185 | == Testing RO == | ||
1186 | -can't open: 'host_device' driver expects either a character or block device | ||
1187 | +qemu-io: can't open: 'host_device' driver expects either a character or block device | ||
1188 | == Testing RW == | ||
1189 | -can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory | ||
1190 | +qemu-io: can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory | ||
1191 | |||
1192 | === Testing with driver:host_cdrom === | ||
1193 | |||
1194 | == Testing RO == | ||
1195 | -can't open: 'host_cdrom' driver expects either a character or block device | ||
1196 | +qemu-io: can't open: 'host_cdrom' driver expects either a character or block device | ||
1197 | == Testing RW == | ||
1198 | -can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory | ||
1199 | +qemu-io: can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory | ||
1200 | |||
72 | *** done | 1201 | *** done |
1202 | diff --git a/tests/qemu-iotests/244.out b/tests/qemu-iotests/244.out | ||
1203 | index XXXXXXX..XXXXXXX 100644 | ||
1204 | --- a/tests/qemu-iotests/244.out | ||
1205 | +++ b/tests/qemu-iotests/244.out | ||
1206 | @@ -XXX,XX +XXX,XX @@ read 65536/65536 bytes at offset 0 | ||
1207 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1208 | read 65536/65536 bytes at offset 0 | ||
1209 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1210 | -can't open device TEST_DIR/t.qcow2: Could not open 'inexistent': No such file or directory | ||
1211 | +qemu-io: can't open device TEST_DIR/t.qcow2: Could not open 'inexistent': No such file or directory | ||
1212 | no file open, try 'help open' | ||
1213 | |||
1214 | Data file required, but without data file name in the image: | ||
1215 | -can't open device TEST_DIR/t.qcow2: 'data-file' is required for this image | ||
1216 | +qemu-io: can't open device TEST_DIR/t.qcow2: 'data-file' is required for this image | ||
1217 | no file open, try 'help open' | ||
1218 | read 65536/65536 bytes at offset 0 | ||
1219 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1220 | -can't open device TEST_DIR/t.qcow2: Could not open 'inexistent': No such file or directory | ||
1221 | +qemu-io: can't open device TEST_DIR/t.qcow2: Could not open 'inexistent': No such file or directory | ||
1222 | no file open, try 'help open' | ||
1223 | |||
1224 | Setting data-file for an image with internal data: | ||
1225 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
1226 | -can't open device TEST_DIR/t.qcow2: 'data-file' can only be set for images with an external data file | ||
1227 | +qemu-io: can't open device TEST_DIR/t.qcow2: 'data-file' can only be set for images with an external data file | ||
1228 | no file open, try 'help open' | ||
1229 | -can't open device TEST_DIR/t.qcow2: Could not open 'inexistent': No such file or directory | ||
1230 | +qemu-io: can't open device TEST_DIR/t.qcow2: Could not open 'inexistent': No such file or directory | ||
1231 | no file open, try 'help open' | ||
1232 | |||
1233 | === Conflicting features === | ||
73 | -- | 1234 | -- |
74 | 2.13.6 | 1235 | 2.20.1 |
75 | 1236 | ||
76 | 1237 | diff view generated by jsdifflib |
1 | Commit dcf94a23b1 ('block: Don't poll in parent drain callbacks') | 1 | Even for block nodes with bs->drv == NULL, we can't just ignore a |
---|---|---|---|
2 | removed polling in bdrv_child_cb_drained_begin() on the grounds that the | 2 | bdrv_set_aio_context() call. Leaving the node in its old context can |
3 | original bdrv_drain() already will poll and BdrvChildRole.drained_begin | 3 | mean that it's still in an iothread context in bdrv_close_all() during |
4 | calls must not cause graph changes (and therefore must not call | 4 | shutdown, resulting in an attempted unlock of the AioContext lock which |
5 | aio_poll() or the recursion through the graph will break. | 5 | we don't hold. |
6 | 6 | ||
7 | This reasoning is correct for calls through bdrv_do_drained_begin(). | 7 | This is an example stack trace of a related crash: |
8 | However, BdrvChildRole.drained_begin is also called when a node that is | ||
9 | already in a drained section (i.e. bdrv_do_drained_begin() has already | ||
10 | returned and therefore can't poll any more) is attached to a new parent. | ||
11 | In this case, we must explicitly poll to have all requests completed | ||
12 | before the drained new child can be attached to the parent. | ||
13 | 8 | ||
14 | In bdrv_replace_child_noperm(), we know that we're not inside the | 9 | #0 0x00007ffff59da57f in raise () at /lib64/libc.so.6 |
15 | recursion of bdrv_do_drained_begin() because graph changes are not | 10 | #1 0x00007ffff59c4895 in abort () at /lib64/libc.so.6 |
16 | allowed there, and bdrv_replace_child_noperm() is a graph change. The | 11 | #2 0x0000555555b97b1e in error_exit (err=<optimized out>, msg=msg@entry=0x555555d386d0 <__func__.19059> "qemu_mutex_unlock_impl") at util/qemu-thread-posix.c:36 |
17 | call of BdrvChildRole.drained_begin() must therefore be followed by a | 12 | #3 0x0000555555b97f7f in qemu_mutex_unlock_impl (mutex=mutex@entry=0x5555568002f0, file=file@entry=0x555555d378df "util/async.c", line=line@entry=507) at util/qemu-thread-posix.c:97 |
18 | BDRV_POLL_WHILE() that waits for the completion of requests. | 13 | #4 0x0000555555b92f55 in aio_context_release (ctx=ctx@entry=0x555556800290) at util/async.c:507 |
14 | #5 0x0000555555b05cf8 in bdrv_prwv_co (child=child@entry=0x7fffc80012f0, offset=offset@entry=131072, qiov=qiov@entry=0x7fffffffd4f0, is_write=is_write@entry=true, flags=flags@entry=0) | ||
15 | at block/io.c:833 | ||
16 | #6 0x0000555555b060a9 in bdrv_pwritev (qiov=0x7fffffffd4f0, offset=131072, child=0x7fffc80012f0) at block/io.c:990 | ||
17 | #7 0x0000555555b060a9 in bdrv_pwrite (child=0x7fffc80012f0, offset=131072, buf=<optimized out>, bytes=<optimized out>) at block/io.c:990 | ||
18 | #8 0x0000555555ae172b in qcow2_cache_entry_flush (bs=bs@entry=0x555556810680, c=c@entry=0x5555568cc740, i=i@entry=0) at block/qcow2-cache.c:51 | ||
19 | #9 0x0000555555ae18dd in qcow2_cache_write (bs=bs@entry=0x555556810680, c=0x5555568cc740) at block/qcow2-cache.c:248 | ||
20 | #10 0x0000555555ae15de in qcow2_cache_flush (bs=0x555556810680, c=<optimized out>) at block/qcow2-cache.c:259 | ||
21 | #11 0x0000555555ae16b1 in qcow2_cache_flush_dependency (c=0x5555568a1700, c=0x5555568a1700, bs=0x555556810680) at block/qcow2-cache.c:194 | ||
22 | #12 0x0000555555ae16b1 in qcow2_cache_entry_flush (bs=bs@entry=0x555556810680, c=c@entry=0x5555568a1700, i=i@entry=0) at block/qcow2-cache.c:194 | ||
23 | #13 0x0000555555ae18dd in qcow2_cache_write (bs=bs@entry=0x555556810680, c=0x5555568a1700) at block/qcow2-cache.c:248 | ||
24 | #14 0x0000555555ae15de in qcow2_cache_flush (bs=bs@entry=0x555556810680, c=<optimized out>) at block/qcow2-cache.c:259 | ||
25 | #15 0x0000555555ad242c in qcow2_inactivate (bs=bs@entry=0x555556810680) at block/qcow2.c:2124 | ||
26 | #16 0x0000555555ad2590 in qcow2_close (bs=0x555556810680) at block/qcow2.c:2153 | ||
27 | #17 0x0000555555ab0c62 in bdrv_close (bs=0x555556810680) at block.c:3358 | ||
28 | #18 0x0000555555ab0c62 in bdrv_delete (bs=0x555556810680) at block.c:3542 | ||
29 | #19 0x0000555555ab0c62 in bdrv_unref (bs=0x555556810680) at block.c:4598 | ||
30 | #20 0x0000555555af4d72 in blk_remove_bs (blk=blk@entry=0x5555568103d0) at block/block-backend.c:785 | ||
31 | #21 0x0000555555af4dbb in blk_remove_all_bs () at block/block-backend.c:483 | ||
32 | #22 0x0000555555aae02f in bdrv_close_all () at block.c:3412 | ||
33 | #23 0x00005555557f9796 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4776 | ||
19 | 34 | ||
20 | Reported-by: Max Reitz <mreitz@redhat.com> | 35 | The reproducer I used is a qcow2 image on gluster volume, where the |
36 | virtual disk size (4 GB) is larger than the gluster volume size (64M), | ||
37 | so we can easily trigger an ENOSPC. This backend is assigned to a | ||
38 | virtio-blk device using an iothread, and then from the guest a | ||
39 | 'dd if=/dev/zero of=/dev/vda bs=1G count=1' causes the VM to stop | ||
40 | because of an I/O error. qemu_gluster_co_flush_to_disk() sets | ||
41 | bs->drv = NULL on error, so when virtio-blk stops the dataplane, the | ||
42 | block nodes stay in the iothread AioContext. A 'quit' monitor command | ||
43 | issued from this paused state crashes the process. | ||
44 | |||
45 | Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1631227 | ||
46 | Cc: qemu-stable@nongnu.org | ||
21 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 47 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
48 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
49 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
50 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> | ||
22 | --- | 51 | --- |
23 | include/block/block.h | 8 ++++++++ | 52 | block.c | 12 ++---------- |
24 | include/block/block_int.h | 3 +++ | 53 | 1 file changed, 2 insertions(+), 10 deletions(-) |
25 | block.c | 2 +- | ||
26 | block/io.c | 26 ++++++++++++++++++++------ | ||
27 | 4 files changed, 32 insertions(+), 7 deletions(-) | ||
28 | 54 | ||
29 | diff --git a/include/block/block.h b/include/block/block.h | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/include/block/block.h | ||
32 | +++ b/include/block/block.h | ||
33 | @@ -XXX,XX +XXX,XX @@ void bdrv_parent_drained_begin(BlockDriverState *bs, BdrvChild *ignore, | ||
34 | bool ignore_bds_parents); | ||
35 | |||
36 | /** | ||
37 | + * bdrv_parent_drained_begin_single: | ||
38 | + * | ||
39 | + * Begin a quiesced section for the parent of @c. If @poll is true, wait for | ||
40 | + * any pending activity to cease. | ||
41 | + */ | ||
42 | +void bdrv_parent_drained_begin_single(BdrvChild *c, bool poll); | ||
43 | + | ||
44 | +/** | ||
45 | * bdrv_parent_drained_end: | ||
46 | * | ||
47 | * End a quiesced section of all users of @bs. This is part of | ||
48 | diff --git a/include/block/block_int.h b/include/block/block_int.h | ||
49 | index XXXXXXX..XXXXXXX 100644 | ||
50 | --- a/include/block/block_int.h | ||
51 | +++ b/include/block/block_int.h | ||
52 | @@ -XXX,XX +XXX,XX @@ struct BdrvChildRole { | ||
53 | * requests after returning from .drained_begin() until .drained_end() is | ||
54 | * called. | ||
55 | * | ||
56 | + * These functions must not change the graph (and therefore also must not | ||
57 | + * call aio_poll(), which could change the graph indirectly). | ||
58 | + * | ||
59 | * Note that this can be nested. If drained_begin() was called twice, new | ||
60 | * I/O is allowed only after drained_end() was called twice, too. | ||
61 | */ | ||
62 | diff --git a/block.c b/block.c | 55 | diff --git a/block.c b/block.c |
63 | index XXXXXXX..XXXXXXX 100644 | 56 | index XXXXXXX..XXXXXXX 100644 |
64 | --- a/block.c | 57 | --- a/block.c |
65 | +++ b/block.c | 58 | +++ b/block.c |
66 | @@ -XXX,XX +XXX,XX @@ static void bdrv_replace_child_noperm(BdrvChild *child, | 59 | @@ -XXX,XX +XXX,XX @@ void bdrv_detach_aio_context(BlockDriverState *bs) |
67 | } | 60 | BdrvAioNotifier *baf, *baf_tmp; |
68 | assert(num >= 0); | 61 | BdrvChild *child; |
69 | for (i = 0; i < num; i++) { | 62 | |
70 | - child->role->drained_begin(child); | 63 | - if (!bs->drv) { |
71 | + bdrv_parent_drained_begin_single(child, true); | 64 | - return; |
72 | } | 65 | - } |
73 | } | 66 | - |
74 | 67 | assert(!bs->walking_aio_notifiers); | |
75 | diff --git a/block/io.c b/block/io.c | 68 | bs->walking_aio_notifiers = true; |
76 | index XXXXXXX..XXXXXXX 100644 | 69 | QLIST_FOREACH_SAFE(baf, &bs->aio_notifiers, list, baf_tmp) { |
77 | --- a/block/io.c | 70 | @@ -XXX,XX +XXX,XX @@ void bdrv_detach_aio_context(BlockDriverState *bs) |
78 | +++ b/block/io.c | 71 | */ |
79 | @@ -XXX,XX +XXX,XX @@ void bdrv_parent_drained_begin(BlockDriverState *bs, BdrvChild *ignore, | 72 | bs->walking_aio_notifiers = false; |
80 | if (c == ignore || (ignore_bds_parents && c->role->parent_is_bds)) { | 73 | |
81 | continue; | 74 | - if (bs->drv->bdrv_detach_aio_context) { |
82 | } | 75 | + if (bs->drv && bs->drv->bdrv_detach_aio_context) { |
83 | - if (c->role->drained_begin) { | 76 | bs->drv->bdrv_detach_aio_context(bs); |
84 | - c->role->drained_begin(c); | ||
85 | - } | ||
86 | + bdrv_parent_drained_begin_single(c, false); | ||
87 | } | 77 | } |
88 | } | 78 | QLIST_FOREACH(child, &bs->children, next) { |
89 | 79 | @@ -XXX,XX +XXX,XX @@ void bdrv_attach_aio_context(BlockDriverState *bs, | |
90 | @@ -XXX,XX +XXX,XX @@ void bdrv_parent_drained_end(BlockDriverState *bs, BdrvChild *ignore, | 80 | BdrvAioNotifier *ban, *ban_tmp; |
81 | BdrvChild *child; | ||
82 | |||
83 | - if (!bs->drv) { | ||
84 | - return; | ||
85 | - } | ||
86 | - | ||
87 | if (bs->quiesce_counter) { | ||
88 | aio_disable_external(new_context); | ||
91 | } | 89 | } |
92 | } | 90 | @@ -XXX,XX +XXX,XX @@ void bdrv_attach_aio_context(BlockDriverState *bs, |
93 | 91 | QLIST_FOREACH(child, &bs->children, next) { | |
94 | +static bool bdrv_parent_drained_poll_single(BdrvChild *c) | 92 | bdrv_attach_aio_context(child->bs, new_context); |
95 | +{ | ||
96 | + if (c->role->drained_poll) { | ||
97 | + return c->role->drained_poll(c); | ||
98 | + } | ||
99 | + return false; | ||
100 | +} | ||
101 | + | ||
102 | static bool bdrv_parent_drained_poll(BlockDriverState *bs, BdrvChild *ignore, | ||
103 | bool ignore_bds_parents) | ||
104 | { | ||
105 | @@ -XXX,XX +XXX,XX @@ static bool bdrv_parent_drained_poll(BlockDriverState *bs, BdrvChild *ignore, | ||
106 | if (c == ignore || (ignore_bds_parents && c->role->parent_is_bds)) { | ||
107 | continue; | ||
108 | } | ||
109 | - if (c->role->drained_poll) { | ||
110 | - busy |= c->role->drained_poll(c); | ||
111 | - } | ||
112 | + busy |= bdrv_parent_drained_poll_single(c); | ||
113 | } | 93 | } |
114 | 94 | - if (bs->drv->bdrv_attach_aio_context) { | |
115 | return busy; | 95 | + if (bs->drv && bs->drv->bdrv_attach_aio_context) { |
116 | } | 96 | bs->drv->bdrv_attach_aio_context(bs, new_context); |
117 | 97 | } | |
118 | +void bdrv_parent_drained_begin_single(BdrvChild *c, bool poll) | 98 | |
119 | +{ | ||
120 | + if (c->role->drained_begin) { | ||
121 | + c->role->drained_begin(c); | ||
122 | + } | ||
123 | + if (poll) { | ||
124 | + BDRV_POLL_WHILE(c->bs, bdrv_parent_drained_poll_single(c)); | ||
125 | + } | ||
126 | +} | ||
127 | + | ||
128 | static void bdrv_merge_limits(BlockLimits *dst, const BlockLimits *src) | ||
129 | { | ||
130 | dst->opt_transfer = MAX(dst->opt_transfer, src->opt_transfer); | ||
131 | -- | 99 | -- |
132 | 2.13.6 | 100 | 2.20.1 |
133 | 101 | ||
134 | 102 | diff view generated by jsdifflib |
1 | From: Fam Zheng <famz@redhat.com> | 1 | From: Zhengui li <lizhengui@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | Truncation is the last to convert from open coded req handling to | 3 | Concurrent IO becomes serial IO because of the qemu Coroutine lock, |
4 | reusing helpers. This time the permission check in prepare has to adapt | 4 | which reduce IO performance severely. |
5 | to the new caller: it checks a different permission bit, and doesn't | ||
6 | trigger the before write notifier. | ||
7 | 5 | ||
8 | Also, truncation should always trigger a bs->total_sectors update and in | 6 | So unlock Coroutine lock before bdrv_co_pwritev and |
9 | turn call parent resize_cb. Update the condition in finish helper, too. | 7 | bdrv_co_preadv to fix it. |
10 | 8 | ||
11 | It's intended to do a duplicated bs->read_only check before calling | 9 | Signed-off-by: Zhengui li <lizhengui@huawei.com> |
12 | bdrv_co_write_req_prepare() so that we can be more informative with the | 10 | Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> |
13 | error message, as bdrv_co_write_req_prepare() doesn't have Error | ||
14 | parameter. | ||
15 | |||
16 | Signed-off-by: Fam Zheng <famz@redhat.com> | ||
17 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 11 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
18 | --- | 12 | --- |
19 | block/io.c | 55 +++++++++++++++++++++++++++++++++++-------------------- | 13 | block/vpc.c | 4 ++++ |
20 | 1 file changed, 35 insertions(+), 20 deletions(-) | 14 | 1 file changed, 4 insertions(+) |
21 | 15 | ||
22 | diff --git a/block/io.c b/block/io.c | 16 | diff --git a/block/vpc.c b/block/vpc.c |
23 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/block/io.c | 18 | --- a/block/vpc.c |
25 | +++ b/block/io.c | 19 | +++ b/block/vpc.c |
26 | @@ -XXX,XX +XXX,XX @@ bdrv_co_write_req_prepare(BdrvChild *child, int64_t offset, uint64_t bytes, | 20 | @@ -XXX,XX +XXX,XX @@ vpc_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, |
27 | is_request_serialising_and_aligned(req)); | 21 | qemu_iovec_reset(&local_qiov); |
28 | assert(req->overlap_offset <= offset); | 22 | qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes); |
29 | assert(offset + bytes <= req->overlap_offset + req->overlap_bytes); | 23 | |
30 | + assert(end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE); | 24 | + qemu_co_mutex_unlock(&s->lock); |
31 | 25 | ret = bdrv_co_preadv(bs->file, image_offset, n_bytes, | |
32 | - if (flags & BDRV_REQ_WRITE_UNCHANGED) { | 26 | &local_qiov, 0); |
33 | - assert(child->perm & (BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE)); | 27 | + qemu_co_mutex_lock(&s->lock); |
34 | - } else { | 28 | if (ret < 0) { |
35 | - assert(child->perm & BLK_PERM_WRITE); | 29 | goto fail; |
36 | + switch (req->type) { | 30 | } |
37 | + case BDRV_TRACKED_WRITE: | 31 | @@ -XXX,XX +XXX,XX @@ vpc_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, |
38 | + case BDRV_TRACKED_DISCARD: | 32 | qemu_iovec_reset(&local_qiov); |
39 | + if (flags & BDRV_REQ_WRITE_UNCHANGED) { | 33 | qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes); |
40 | + assert(child->perm & (BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE)); | 34 | |
41 | + } else { | 35 | + qemu_co_mutex_unlock(&s->lock); |
42 | + assert(child->perm & BLK_PERM_WRITE); | 36 | ret = bdrv_co_pwritev(bs->file, image_offset, n_bytes, |
43 | + } | 37 | &local_qiov, 0); |
44 | + return notifier_with_return_list_notify(&bs->before_write_notifiers, | 38 | + qemu_co_mutex_lock(&s->lock); |
45 | + req); | 39 | if (ret < 0) { |
46 | + case BDRV_TRACKED_TRUNCATE: | 40 | goto fail; |
47 | + assert(child->perm & BLK_PERM_RESIZE); | 41 | } |
48 | + return 0; | ||
49 | + default: | ||
50 | + abort(); | ||
51 | } | ||
52 | - assert(end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE); | ||
53 | - return notifier_with_return_list_notify(&bs->before_write_notifiers, req); | ||
54 | } | ||
55 | |||
56 | static inline void coroutine_fn | ||
57 | @@ -XXX,XX +XXX,XX @@ bdrv_co_write_req_finish(BdrvChild *child, int64_t offset, uint64_t bytes, | ||
58 | * beyond EOF cannot expand the image anyway. | ||
59 | */ | ||
60 | if (ret == 0 && | ||
61 | - end_sector > bs->total_sectors && | ||
62 | - req->type != BDRV_TRACKED_DISCARD) { | ||
63 | + (req->type == BDRV_TRACKED_TRUNCATE || | ||
64 | + end_sector > bs->total_sectors) && | ||
65 | + req->type != BDRV_TRACKED_DISCARD) { | ||
66 | bs->total_sectors = end_sector; | ||
67 | bdrv_parent_cb_resize(bs); | ||
68 | bdrv_dirty_bitmap_truncate(bs, end_sector << BDRV_SECTOR_BITS); | ||
69 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_truncate(BdrvChild *child, int64_t offset, | ||
70 | int64_t old_size, new_bytes; | ||
71 | int ret; | ||
72 | |||
73 | - assert(child->perm & BLK_PERM_RESIZE); | ||
74 | |||
75 | /* if bs->drv == NULL, bs is closed, so there's nothing to do here */ | ||
76 | if (!drv) { | ||
77 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_truncate(BdrvChild *child, int64_t offset, | ||
78 | * concurrently or they might be overwritten by preallocation. */ | ||
79 | if (new_bytes) { | ||
80 | mark_request_serialising(&req, 1); | ||
81 | - wait_serialising_requests(&req); | ||
82 | + } | ||
83 | + if (bs->read_only) { | ||
84 | + error_setg(errp, "Image is read-only"); | ||
85 | + ret = -EACCES; | ||
86 | + goto out; | ||
87 | + } | ||
88 | + ret = bdrv_co_write_req_prepare(child, offset - new_bytes, new_bytes, &req, | ||
89 | + 0); | ||
90 | + if (ret < 0) { | ||
91 | + error_setg_errno(errp, -ret, | ||
92 | + "Failed to prepare request for truncation"); | ||
93 | + goto out; | ||
94 | } | ||
95 | |||
96 | if (!drv->bdrv_co_truncate) { | ||
97 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_truncate(BdrvChild *child, int64_t offset, | ||
98 | ret = -ENOTSUP; | ||
99 | goto out; | ||
100 | } | ||
101 | - if (bs->read_only) { | ||
102 | - error_setg(errp, "Image is read-only"); | ||
103 | - ret = -EACCES; | ||
104 | - goto out; | ||
105 | - } | ||
106 | - | ||
107 | - assert(!(bs->open_flags & BDRV_O_INACTIVE)); | ||
108 | |||
109 | ret = drv->bdrv_co_truncate(bs, offset, prealloc, errp); | ||
110 | if (ret < 0) { | ||
111 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_truncate(BdrvChild *child, int64_t offset, | ||
112 | } else { | ||
113 | offset = bs->total_sectors * BDRV_SECTOR_SIZE; | ||
114 | } | ||
115 | - bdrv_dirty_bitmap_truncate(bs, offset); | ||
116 | - bdrv_parent_cb_resize(bs); | ||
117 | - atomic_inc(&bs->write_gen); | ||
118 | + /* It's possible that truncation succeeded but refresh_total_sectors | ||
119 | + * failed, but the latter doesn't affect how we should finish the request. | ||
120 | + * Pass 0 as the last parameter so that dirty bitmaps etc. are handled. */ | ||
121 | + bdrv_co_write_req_finish(child, offset - new_bytes, new_bytes, &req, 0); | ||
122 | |||
123 | out: | ||
124 | tracked_request_end(&req); | ||
125 | -- | 42 | -- |
126 | 2.13.6 | 43 | 2.20.1 |
127 | 44 | ||
128 | 45 | diff view generated by jsdifflib |
1 | From: Fam Zheng <famz@redhat.com> | 1 | From: Sam Eiderman <shmuel.eiderman@oracle.com> |
---|---|---|---|
2 | 2 | ||
3 | If we are growing the image and potentially using preallocation for the | 3 | Commit b69864e5a ("vmdk: Support version=3 in VMDK descriptor files") |
4 | new area, we need to make sure that no write requests are made to the | 4 | fixed the probe function to correctly guess vmdk descriptors with |
5 | "preallocated" area which is [@old_size, @offset), not | 5 | version=3. |
6 | [@offset, offset * 2 - @old_size). | ||
7 | 6 | ||
8 | Signed-off-by: Fam Zheng <famz@redhat.com> | 7 | This solves the issue where vmdk snapshot with parent vmdk descriptor |
8 | containing "version=3" would be treated as raw instead vmdk. | ||
9 | |||
10 | In the future case where a new vmdk version is introduced, we will again | ||
11 | experience this issue, even if the user will provide "-f vmdk" it will | ||
12 | only apply to the tip image and not to the underlying "misprobed" parent | ||
13 | image. | ||
14 | |||
15 | The code in vmdk.c already assumes that the backing file of vmdk must be | ||
16 | vmdk (see vmdk_is_cid_valid which returns 0 if backing file is not | ||
17 | vmdk). | ||
18 | |||
19 | So let's make it official by supplying the backing_format as vmdk. | ||
20 | |||
21 | Reviewed-by: Mark Kanda <mark.kanda@oracle.com> | ||
22 | Reviewed-By: Liran Alon <liran.alon@oracle.com> | ||
23 | Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com> | ||
24 | Signed-off-by: Shmuel Eiderman <shmuel.eiderman@oracle.com> | ||
9 | Reviewed-by: Eric Blake <eblake@redhat.com> | 25 | Reviewed-by: Eric Blake <eblake@redhat.com> |
26 | Reviewed-by: Fam Zheng <fam@euphon.net> | ||
10 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 27 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
11 | --- | 28 | --- |
12 | block/io.c | 3 ++- | 29 | block/vmdk.c | 2 ++ |
13 | 1 file changed, 2 insertions(+), 1 deletion(-) | 30 | 1 file changed, 2 insertions(+) |
14 | 31 | ||
15 | diff --git a/block/io.c b/block/io.c | 32 | diff --git a/block/vmdk.c b/block/vmdk.c |
16 | index XXXXXXX..XXXXXXX 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/block/io.c | 34 | --- a/block/vmdk.c |
18 | +++ b/block/io.c | 35 | +++ b/block/vmdk.c |
19 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_truncate(BdrvChild *child, int64_t offset, | 36 | @@ -XXX,XX +XXX,XX @@ static int vmdk_parent_open(BlockDriverState *bs) |
37 | pstrcpy(bs->auto_backing_file, end_name - p_name + 1, p_name); | ||
38 | pstrcpy(bs->backing_file, sizeof(bs->backing_file), | ||
39 | bs->auto_backing_file); | ||
40 | + pstrcpy(bs->backing_format, sizeof(bs->backing_format), | ||
41 | + "vmdk"); | ||
20 | } | 42 | } |
21 | 43 | ||
22 | bdrv_inc_in_flight(bs); | 44 | out: |
23 | - tracked_request_begin(&req, bs, offset, new_bytes, BDRV_TRACKED_TRUNCATE); | ||
24 | + tracked_request_begin(&req, bs, offset - new_bytes, new_bytes, | ||
25 | + BDRV_TRACKED_TRUNCATE); | ||
26 | |||
27 | /* If we are growing the image and potentially using preallocation for the | ||
28 | * new area, we need to make sure that no write requests are made to it | ||
29 | -- | 45 | -- |
30 | 2.13.6 | 46 | 2.20.1 |
31 | 47 | ||
32 | 48 | diff view generated by jsdifflib |
1 | From: Fam Zheng <famz@redhat.com> | 1 | From: Stefano Garzarella <sgarzare@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Two problems exist when a write request that enlarges the image (i.e. | 3 | IEC binary prefixes are already defined in "qemu/units.h", |
4 | write beyond EOF) finishes: | 4 | so we can remove redundant definitions in "block/vhdx.h". |
5 | 5 | ||
6 | 1) parent is not notified about size change; | 6 | Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> |
7 | 2) dirty bitmap is not resized although we try to set the dirty bits; | 7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
8 | 8 | Reviewed-by: John Snow <jsnow@redhat.com> | |
9 | Fix them just like how bdrv_co_truncate works. | ||
10 | |||
11 | Reported-by: Kevin Wolf <kwolf@redhat.com> | ||
12 | Signed-off-by: Fam Zheng <famz@redhat.com> | ||
13 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 9 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
14 | --- | 10 | --- |
15 | block/io.c | 10 +++++++--- | 11 | block/vhdx.h | 6 +----- |
16 | 1 file changed, 7 insertions(+), 3 deletions(-) | 12 | block/vhdx.c | 3 ++- |
13 | 2 files changed, 3 insertions(+), 6 deletions(-) | ||
17 | 14 | ||
18 | diff --git a/block/io.c b/block/io.c | 15 | diff --git a/block/vhdx.h b/block/vhdx.h |
19 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/block/io.c | 17 | --- a/block/vhdx.h |
21 | +++ b/block/io.c | 18 | +++ b/block/vhdx.h |
22 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ |
23 | 20 | ||
24 | static AioWait drain_all_aio_wait; | 21 | #ifndef BLOCK_VHDX_H |
25 | 22 | #define BLOCK_VHDX_H | |
26 | +static void bdrv_parent_cb_resize(BlockDriverState *bs); | 23 | - |
27 | static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, | 24 | -#define KiB (1 * 1024) |
28 | int64_t offset, int bytes, BdrvRequestFlags flags); | 25 | -#define MiB (KiB * 1024) |
29 | 26 | -#define GiB (MiB * 1024) | |
30 | @@ -XXX,XX +XXX,XX @@ bdrv_co_write_req_finish(BdrvChild *child, int64_t offset, uint64_t bytes, | 27 | -#define TiB ((uint64_t) GiB * 1024) |
31 | BlockDriverState *bs = child->bs; | 28 | +#include "qemu/units.h" |
32 | 29 | ||
33 | atomic_inc(&bs->write_gen); | 30 | #define DEFAULT_LOG_SIZE 1048576 /* 1MiB */ |
34 | - bdrv_set_dirty(bs, offset, bytes); | 31 | /* Structures and fields present in the VHDX file */ |
35 | 32 | diff --git a/block/vhdx.c b/block/vhdx.c | |
36 | stat64_max(&bs->wr_highest_offset, offset + bytes); | 33 | index XXXXXXX..XXXXXXX 100644 |
37 | 34 | --- a/block/vhdx.c | |
38 | - if (ret == 0) { | 35 | +++ b/block/vhdx.c |
39 | - bs->total_sectors = MAX(bs->total_sectors, end_sector); | 36 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn vhdx_co_create(BlockdevCreateOptions *opts, |
40 | + if (ret == 0 && | 37 | return -EINVAL; |
41 | + end_sector > bs->total_sectors) { | ||
42 | + bs->total_sectors = end_sector; | ||
43 | + bdrv_parent_cb_resize(bs); | ||
44 | + bdrv_dirty_bitmap_truncate(bs, end_sector << BDRV_SECTOR_BITS); | ||
45 | } | 38 | } |
46 | + bdrv_set_dirty(bs, offset, bytes); | 39 | if (block_size > VHDX_BLOCK_SIZE_MAX) { |
47 | } | 40 | - error_setg(errp, "Block size must not exceed %d", VHDX_BLOCK_SIZE_MAX); |
48 | 41 | + error_setg(errp, "Block size must not exceed %" PRId64, | |
49 | /* | 42 | + VHDX_BLOCK_SIZE_MAX); |
43 | return -EINVAL; | ||
44 | } | ||
45 | |||
50 | -- | 46 | -- |
51 | 2.13.6 | 47 | 2.20.1 |
52 | 48 | ||
53 | 49 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Stefano Garzarella <sgarzare@redhat.com> | ||
1 | 2 | ||
3 | Using IEC binary prefixes in order to make the code more readable, | ||
4 | with the exception of DEFAULT_LOG_SIZE because it's passed to | ||
5 | stringify(). | ||
6 | |||
7 | Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
10 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
11 | --- | ||
12 | block/vhdx.h | 10 ++++++---- | ||
13 | block/vhdx-log.c | 2 +- | ||
14 | block/vhdx.c | 4 ++-- | ||
15 | 3 files changed, 9 insertions(+), 7 deletions(-) | ||
16 | |||
17 | diff --git a/block/vhdx.h b/block/vhdx.h | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/block/vhdx.h | ||
20 | +++ b/block/vhdx.h | ||
21 | @@ -XXX,XX +XXX,XX @@ | ||
22 | #include "qemu/units.h" | ||
23 | |||
24 | #define DEFAULT_LOG_SIZE 1048576 /* 1MiB */ | ||
25 | +/* Note: can't use 1 * MiB, because it's passed to stringify() */ | ||
26 | + | ||
27 | /* Structures and fields present in the VHDX file */ | ||
28 | |||
29 | /* The header section has the following blocks, | ||
30 | @@ -XXX,XX +XXX,XX @@ | ||
31 | * 0.........64KB...........128KB........192KB..........256KB................1MB | ||
32 | */ | ||
33 | |||
34 | -#define VHDX_HEADER_BLOCK_SIZE (64 * 1024) | ||
35 | +#define VHDX_HEADER_BLOCK_SIZE (64 * KiB) | ||
36 | |||
37 | #define VHDX_FILE_ID_OFFSET 0 | ||
38 | #define VHDX_HEADER1_OFFSET (VHDX_HEADER_BLOCK_SIZE * 1) | ||
39 | @@ -XXX,XX +XXX,XX @@ typedef struct QEMU_PACKED MSGUID { | ||
40 | #define guid_eq(a, b) \ | ||
41 | (memcmp(&(a), &(b), sizeof(MSGUID)) == 0) | ||
42 | |||
43 | -#define VHDX_HEADER_SIZE (4 * 1024) /* although the vhdx_header struct in disk | ||
44 | +#define VHDX_HEADER_SIZE (4 * KiB) /* although the vhdx_header struct in disk | ||
45 | is only 582 bytes, for purposes of crc | ||
46 | the header is the first 4KB of the 64KB | ||
47 | block */ | ||
48 | @@ -XXX,XX +XXX,XX @@ typedef struct QEMU_PACKED VHDXRegionTableEntry { | ||
49 | |||
50 | |||
51 | /* ---- LOG ENTRY STRUCTURES ---- */ | ||
52 | -#define VHDX_LOG_MIN_SIZE (1024 * 1024) | ||
53 | -#define VHDX_LOG_SECTOR_SIZE 4096 | ||
54 | +#define VHDX_LOG_MIN_SIZE (1 * MiB) | ||
55 | +#define VHDX_LOG_SECTOR_SIZE (4 * KiB) | ||
56 | #define VHDX_LOG_HDR_SIZE 64 | ||
57 | #define VHDX_LOG_SIGNATURE 0x65676f6c | ||
58 | typedef struct QEMU_PACKED VHDXLogEntryHeader { | ||
59 | diff --git a/block/vhdx-log.c b/block/vhdx-log.c | ||
60 | index XXXXXXX..XXXXXXX 100644 | ||
61 | --- a/block/vhdx-log.c | ||
62 | +++ b/block/vhdx-log.c | ||
63 | @@ -XXX,XX +XXX,XX @@ static int vhdx_log_flush(BlockDriverState *bs, BDRVVHDXState *s, | ||
64 | } | ||
65 | if (file_length < desc_entries->hdr.last_file_offset) { | ||
66 | new_file_size = desc_entries->hdr.last_file_offset; | ||
67 | - if (new_file_size % (1024*1024)) { | ||
68 | + if (new_file_size % (1 * MiB)) { | ||
69 | /* round up to nearest 1MB boundary */ | ||
70 | new_file_size = QEMU_ALIGN_UP(new_file_size, MiB); | ||
71 | if (new_file_size > INT64_MAX) { | ||
72 | diff --git a/block/vhdx.c b/block/vhdx.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/block/vhdx.c | ||
75 | +++ b/block/vhdx.c | ||
76 | @@ -XXX,XX +XXX,XX @@ static int vhdx_allocate_block(BlockDriverState *bs, BDRVVHDXState *s, | ||
77 | *new_offset = current_len; | ||
78 | |||
79 | /* per the spec, the address for a block is in units of 1MB */ | ||
80 | - *new_offset = ROUND_UP(*new_offset, 1024 * 1024); | ||
81 | + *new_offset = ROUND_UP(*new_offset, 1 * MiB); | ||
82 | if (*new_offset > INT64_MAX) { | ||
83 | return -EINVAL; | ||
84 | } | ||
85 | @@ -XXX,XX +XXX,XX @@ static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num, | ||
86 | case PAYLOAD_BLOCK_FULLY_PRESENT: | ||
87 | /* if the file offset address is in the header zone, | ||
88 | * there is a problem */ | ||
89 | - if (sinfo.file_offset < (1024 * 1024)) { | ||
90 | + if (sinfo.file_offset < (1 * MiB)) { | ||
91 | ret = -EFAULT; | ||
92 | goto error_bat_restore; | ||
93 | } | ||
94 | -- | ||
95 | 2.20.1 | ||
96 | |||
97 | diff view generated by jsdifflib |
1 | From: Fam Zheng <famz@redhat.com> | 1 | From: Eric Blake <eblake@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Reuse the new bdrv_co_write_req_prepare/finish helpers. The variation | 3 | When extracting a human-readable size formatter, we changed 'uint64_t |
4 | here is that discard requests don't affect bs->wr_highest_offset, and it | 4 | div' pre-patch to 'unsigned long div' post-patch. Which breaks on |
5 | cannot extend the image. | 5 | 32-bit platforms, resulting in 'inf' instead of intended values larger |
6 | than 999GB. | ||
6 | 7 | ||
7 | Signed-off-by: Fam Zheng <famz@redhat.com> | 8 | Fixes: 22951aaa |
9 | CC: qemu-stable@nongnu.org | ||
10 | Reported-by: Max Reitz <mreitz@redhat.com> | ||
11 | Signed-off-by: Eric Blake <eblake@redhat.com> | ||
12 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
8 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 13 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
9 | --- | 14 | --- |
10 | block/io.c | 33 +++++++++++++++++++++++---------- | 15 | util/cutils.c | 2 +- |
11 | 1 file changed, 23 insertions(+), 10 deletions(-) | 16 | 1 file changed, 1 insertion(+), 1 deletion(-) |
12 | 17 | ||
13 | diff --git a/block/io.c b/block/io.c | 18 | diff --git a/util/cutils.c b/util/cutils.c |
14 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/block/io.c | 20 | --- a/util/cutils.c |
16 | +++ b/block/io.c | 21 | +++ b/util/cutils.c |
17 | @@ -XXX,XX +XXX,XX @@ bdrv_co_write_req_finish(BdrvChild *child, int64_t offset, uint64_t bytes, | 22 | @@ -XXX,XX +XXX,XX @@ const char *qemu_ether_ntoa(const MACAddr *mac) |
18 | 23 | char *size_to_str(uint64_t val) | |
19 | atomic_inc(&bs->write_gen); | 24 | { |
20 | 25 | static const char *suffixes[] = { "", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei" }; | |
21 | - stat64_max(&bs->wr_highest_offset, offset + bytes); | 26 | - unsigned long div; |
22 | - | 27 | + uint64_t div; |
23 | + /* | 28 | int i; |
24 | + * Discard cannot extend the image, but in error handling cases, such as | 29 | |
25 | + * when reverting a qcow2 cluster allocation, the discarded range can pass | 30 | /* |
26 | + * the end of image file, so we cannot assert about BDRV_TRACKED_DISCARD | ||
27 | + * here. Instead, just skip it, since semantically a discard request | ||
28 | + * beyond EOF cannot expand the image anyway. | ||
29 | + */ | ||
30 | if (ret == 0 && | ||
31 | - end_sector > bs->total_sectors) { | ||
32 | + end_sector > bs->total_sectors && | ||
33 | + req->type != BDRV_TRACKED_DISCARD) { | ||
34 | bs->total_sectors = end_sector; | ||
35 | bdrv_parent_cb_resize(bs); | ||
36 | bdrv_dirty_bitmap_truncate(bs, end_sector << BDRV_SECTOR_BITS); | ||
37 | } | ||
38 | - bdrv_set_dirty(bs, offset, bytes); | ||
39 | + if (req->bytes) { | ||
40 | + switch (req->type) { | ||
41 | + case BDRV_TRACKED_WRITE: | ||
42 | + stat64_max(&bs->wr_highest_offset, offset + bytes); | ||
43 | + /* fall through, to set dirty bits */ | ||
44 | + case BDRV_TRACKED_DISCARD: | ||
45 | + bdrv_set_dirty(bs, offset, bytes); | ||
46 | + break; | ||
47 | + default: | ||
48 | + break; | ||
49 | + } | ||
50 | + } | ||
51 | } | ||
52 | |||
53 | /* | ||
54 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_pdiscard(BdrvChild *child, int64_t offset, int bytes) | ||
55 | ret = bdrv_check_byte_request(bs, offset, bytes); | ||
56 | if (ret < 0) { | ||
57 | return ret; | ||
58 | - } else if (bs->read_only) { | ||
59 | - return -EPERM; | ||
60 | } | ||
61 | - assert(!(bs->open_flags & BDRV_O_INACTIVE)); | ||
62 | |||
63 | /* Do nothing if disabled. */ | ||
64 | if (!(bs->open_flags & BDRV_O_UNMAP)) { | ||
65 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_pdiscard(BdrvChild *child, int64_t offset, int bytes) | ||
66 | bdrv_inc_in_flight(bs); | ||
67 | tracked_request_begin(&req, bs, offset, bytes, BDRV_TRACKED_DISCARD); | ||
68 | |||
69 | - ret = notifier_with_return_list_notify(&bs->before_write_notifiers, &req); | ||
70 | + ret = bdrv_co_write_req_prepare(child, offset, bytes, &req, 0); | ||
71 | if (ret < 0) { | ||
72 | goto out; | ||
73 | } | ||
74 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_pdiscard(BdrvChild *child, int64_t offset, int bytes) | ||
75 | } | ||
76 | ret = 0; | ||
77 | out: | ||
78 | - atomic_inc(&bs->write_gen); | ||
79 | - bdrv_set_dirty(bs, req.offset, req.bytes); | ||
80 | + bdrv_co_write_req_finish(child, req.offset, req.bytes, &req, ret); | ||
81 | tracked_request_end(&req); | ||
82 | bdrv_dec_in_flight(bs); | ||
83 | return ret; | ||
84 | -- | 31 | -- |
85 | 2.13.6 | 32 | 2.20.1 |
86 | 33 | ||
87 | 34 | diff view generated by jsdifflib |
1 | From: Ari Sundholm <ari@tuxera.com> | 1 | From: Eric Blake <eblake@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | The sector size needs to be large enough to accommodate the data | 3 | Disk sizes close to INT64_MAX cause overflow, for some pretty |
4 | structures for the log super block and log write entries. This was | 4 | ridiculous output: |
5 | previously not properly checked, which made it possible to cause | ||
6 | QEMU to badly misbehave. | ||
7 | 5 | ||
8 | Signed-off-by: Ari Sundholm <ari@tuxera.com> | 6 | $ ./nbdkit -U - memory size=$((2**63 - 512)) --run 'qemu-img info $nbd' |
7 | image: nbd+unix://?socket=/tmp/nbdkitHSAzNz/socket | ||
8 | file format: raw | ||
9 | virtual size: -8388607T (9223372036854775296 bytes) | ||
10 | disk size: unavailable | ||
11 | |||
12 | But there's no reason to have two separate implementations of integer | ||
13 | to human-readable abbreviation, where one has overflow and stops at | ||
14 | 'T', while the other avoids overflow and goes all the way to 'E'. With | ||
15 | this patch, the output now claims 8EiB instead of -8388607T, which | ||
16 | really is the correct rounding of largest file size supported by qemu | ||
17 | (we could go 511 bytes larger if we used byte-accurate sizing instead | ||
18 | of rounding up to the next sector boundary, but that wouldn't change | ||
19 | the human-readable result). | ||
20 | |||
21 | Quite a few iotests need updates to expected output to match. | ||
22 | |||
23 | Reported-by: Richard W.M. Jones <rjones@redhat.com> | ||
24 | Signed-off-by: Eric Blake <eblake@redhat.com> | ||
25 | Tested-by: Richard W.M. Jones <rjones@redhat.com> | ||
26 | Reviewed-by: Alberto Garcia <berto@igalia.com> | ||
27 | Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
9 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 28 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
29 | Tested-by: Max Reitz <mreitz@redhat.com> | ||
10 | --- | 30 | --- |
11 | block/blklogwrites.c | 5 ++++- | 31 | block/qapi.c | 49 +++++++++----------------------------- |
12 | 1 file changed, 4 insertions(+), 1 deletion(-) | 32 | tests/qemu-iotests/043.out | 6 ++--- |
33 | tests/qemu-iotests/053.out | 2 +- | ||
34 | tests/qemu-iotests/059.out | 10 ++++---- | ||
35 | tests/qemu-iotests/060.out | 10 ++++---- | ||
36 | tests/qemu-iotests/061.out | 12 +++++----- | ||
37 | tests/qemu-iotests/070.out | 2 +- | ||
38 | tests/qemu-iotests/082.out | 26 ++++++++++---------- | ||
39 | tests/qemu-iotests/084.out | 8 +++---- | ||
40 | tests/qemu-iotests/089.out | 2 +- | ||
41 | tests/qemu-iotests/095.out | 4 ++-- | ||
42 | tests/qemu-iotests/104.out | 6 ++--- | ||
43 | tests/qemu-iotests/110.out | 6 ++--- | ||
44 | tests/qemu-iotests/114.out | 2 +- | ||
45 | tests/qemu-iotests/126.out | 4 ++-- | ||
46 | tests/qemu-iotests/130.out | 10 ++++---- | ||
47 | tests/qemu-iotests/153.out | 2 +- | ||
48 | tests/qemu-iotests/191.out | 8 +++---- | ||
49 | tests/qemu-iotests/195.out | 4 ++-- | ||
50 | tests/qemu-iotests/198.out | 4 ++-- | ||
51 | tests/qemu-iotests/206.out | 10 ++++---- | ||
52 | tests/qemu-iotests/207.out | 12 +++++----- | ||
53 | tests/qemu-iotests/210.out | 8 +++---- | ||
54 | tests/qemu-iotests/211.out | 10 ++++---- | ||
55 | tests/qemu-iotests/212.out | 10 ++++---- | ||
56 | tests/qemu-iotests/213.out | 10 ++++---- | ||
57 | tests/qemu-iotests/233.out | 4 ++-- | ||
58 | tests/qemu-iotests/237.out | 22 ++++++++--------- | ||
59 | tests/qemu-iotests/242.out | 10 ++++---- | ||
60 | 29 files changed, 123 insertions(+), 150 deletions(-) | ||
13 | 61 | ||
14 | diff --git a/block/blklogwrites.c b/block/blklogwrites.c | 62 | diff --git a/block/qapi.c b/block/qapi.c |
15 | index XXXXXXX..XXXXXXX 100644 | 63 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/block/blklogwrites.c | 64 | --- a/block/qapi.c |
17 | +++ b/block/blklogwrites.c | 65 | +++ b/block/qapi.c |
18 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t blk_log_writes_log2(uint32_t value) | 66 | @@ -XXX,XX +XXX,XX @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes, |
19 | 67 | return head; | |
20 | static inline bool blk_log_writes_sector_size_valid(uint32_t sector_size) | 68 | } |
69 | |||
70 | -#define NB_SUFFIXES 4 | ||
71 | - | ||
72 | -static char *get_human_readable_size(char *buf, int buf_size, int64_t size) | ||
73 | -{ | ||
74 | - static const char suffixes[NB_SUFFIXES] = {'K', 'M', 'G', 'T'}; | ||
75 | - int64_t base; | ||
76 | - int i; | ||
77 | - | ||
78 | - if (size <= 999) { | ||
79 | - snprintf(buf, buf_size, "%" PRId64, size); | ||
80 | - } else { | ||
81 | - base = 1024; | ||
82 | - for (i = 0; i < NB_SUFFIXES; i++) { | ||
83 | - if (size < (10 * base)) { | ||
84 | - snprintf(buf, buf_size, "%0.1f%c", | ||
85 | - (double)size / base, | ||
86 | - suffixes[i]); | ||
87 | - break; | ||
88 | - } else if (size < (1000 * base) || i == (NB_SUFFIXES - 1)) { | ||
89 | - snprintf(buf, buf_size, "%" PRId64 "%c", | ||
90 | - ((size + (base >> 1)) / base), | ||
91 | - suffixes[i]); | ||
92 | - break; | ||
93 | - } | ||
94 | - base = base * 1024; | ||
95 | - } | ||
96 | - } | ||
97 | - return buf; | ||
98 | -} | ||
99 | - | ||
100 | void bdrv_snapshot_dump(QEMUSnapshotInfo *sn) | ||
21 | { | 101 | { |
22 | - return sector_size < (1ull << 24) && is_power_of_2(sector_size); | 102 | - char buf1[128], date_buf[128], clock_buf[128]; |
23 | + return is_power_of_2(sector_size) && | 103 | + char date_buf[128], clock_buf[128]; |
24 | + sector_size >= sizeof(struct log_write_super) && | 104 | struct tm tm; |
25 | + sector_size >= sizeof(struct log_write_entry) && | 105 | time_t ti; |
26 | + sector_size < (1ull << 24); | 106 | int64_t secs; |
107 | + char *sizing = NULL; | ||
108 | |||
109 | if (!sn) { | ||
110 | qemu_printf("%-10s%-20s%7s%20s%15s", | ||
111 | @@ -XXX,XX +XXX,XX @@ void bdrv_snapshot_dump(QEMUSnapshotInfo *sn) | ||
112 | (int)((secs / 60) % 60), | ||
113 | (int)(secs % 60), | ||
114 | (int)((sn->vm_clock_nsec / 1000000) % 1000)); | ||
115 | + sizing = size_to_str(sn->vm_state_size); | ||
116 | qemu_printf("%-10s%-20s%7s%20s%15s", | ||
117 | sn->id_str, sn->name, | ||
118 | - get_human_readable_size(buf1, sizeof(buf1), | ||
119 | - sn->vm_state_size), | ||
120 | + sizing, | ||
121 | date_buf, | ||
122 | clock_buf); | ||
123 | } | ||
124 | + g_free(sizing); | ||
27 | } | 125 | } |
28 | 126 | ||
29 | static uint64_t blk_log_writes_find_cur_log_sector(BdrvChild *log, | 127 | static void dump_qdict(int indentation, QDict *dict); |
128 | @@ -XXX,XX +XXX,XX @@ void bdrv_image_info_specific_dump(ImageInfoSpecific *info_spec) | ||
129 | |||
130 | void bdrv_image_info_dump(ImageInfo *info) | ||
131 | { | ||
132 | - char size_buf[128], dsize_buf[128]; | ||
133 | + char *size_buf, *dsize_buf; | ||
134 | if (!info->has_actual_size) { | ||
135 | - snprintf(dsize_buf, sizeof(dsize_buf), "unavailable"); | ||
136 | + dsize_buf = g_strdup("unavailable"); | ||
137 | } else { | ||
138 | - get_human_readable_size(dsize_buf, sizeof(dsize_buf), | ||
139 | - info->actual_size); | ||
140 | + dsize_buf = size_to_str(info->actual_size); | ||
141 | } | ||
142 | - get_human_readable_size(size_buf, sizeof(size_buf), info->virtual_size); | ||
143 | + size_buf = size_to_str(info->virtual_size); | ||
144 | qemu_printf("image: %s\n" | ||
145 | "file format: %s\n" | ||
146 | "virtual size: %s (%" PRId64 " bytes)\n" | ||
147 | @@ -XXX,XX +XXX,XX @@ void bdrv_image_info_dump(ImageInfo *info) | ||
148 | info->filename, info->format, size_buf, | ||
149 | info->virtual_size, | ||
150 | dsize_buf); | ||
151 | + g_free(size_buf); | ||
152 | + g_free(dsize_buf); | ||
153 | |||
154 | if (info->has_encrypted && info->encrypted) { | ||
155 | qemu_printf("encrypted: yes\n"); | ||
156 | diff --git a/tests/qemu-iotests/043.out b/tests/qemu-iotests/043.out | ||
157 | index XXXXXXX..XXXXXXX 100644 | ||
158 | --- a/tests/qemu-iotests/043.out | ||
159 | +++ b/tests/qemu-iotests/043.out | ||
160 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/ | ||
161 | == finite chain of length 3 (human) == | ||
162 | image: TEST_DIR/t.IMGFMT | ||
163 | file format: IMGFMT | ||
164 | -virtual size: 128M (134217728 bytes) | ||
165 | +virtual size: 128 MiB (134217728 bytes) | ||
166 | cluster_size: 65536 | ||
167 | backing file: TEST_DIR/t.IMGFMT.2.base | ||
168 | |||
169 | image: TEST_DIR/t.IMGFMT.2.base | ||
170 | file format: IMGFMT | ||
171 | -virtual size: 128M (134217728 bytes) | ||
172 | +virtual size: 128 MiB (134217728 bytes) | ||
173 | cluster_size: 65536 | ||
174 | backing file: TEST_DIR/t.IMGFMT.1.base | ||
175 | |||
176 | image: TEST_DIR/t.IMGFMT.1.base | ||
177 | file format: IMGFMT | ||
178 | -virtual size: 128M (134217728 bytes) | ||
179 | +virtual size: 128 MiB (134217728 bytes) | ||
180 | cluster_size: 65536 | ||
181 | |||
182 | == finite chain of length 3 (json) == | ||
183 | diff --git a/tests/qemu-iotests/053.out b/tests/qemu-iotests/053.out | ||
184 | index XXXXXXX..XXXXXXX 100644 | ||
185 | --- a/tests/qemu-iotests/053.out | ||
186 | +++ b/tests/qemu-iotests/053.out | ||
187 | @@ -XXX,XX +XXX,XX @@ wrote 512/512 bytes at offset 0 | ||
188 | No errors were found on the image. | ||
189 | |||
190 | == Checking compressed image virtual disk size == | ||
191 | -virtual size: 512 (512 bytes) | ||
192 | +virtual size: 512 B (512 bytes) | ||
193 | |||
194 | == Verifying the compressed image == | ||
195 | read 512/512 bytes at offset 0 | ||
196 | diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out | ||
197 | index XXXXXXX..XXXXXXX 100644 | ||
198 | --- a/tests/qemu-iotests/059.out | ||
199 | +++ b/tests/qemu-iotests/059.out | ||
200 | @@ -XXX,XX +XXX,XX @@ can't open device TEST_DIR/t.vmdk: L1 size too big | ||
201 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 subformat=monolithicFlat | ||
202 | image: TEST_DIR/t.IMGFMT | ||
203 | file format: IMGFMT | ||
204 | -virtual size: 2.0G (2147483648 bytes) | ||
205 | +virtual size: 2 GiB (2147483648 bytes) | ||
206 | |||
207 | === Testing monolithicFlat with zeroed_grain === | ||
208 | qemu-img: TEST_DIR/t.IMGFMT: Flat image can't enable zeroed grain | ||
209 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 subformat=monolithicF | ||
210 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824000 subformat=twoGbMaxExtentFlat | ||
211 | image: TEST_DIR/t.vmdk | ||
212 | file format: vmdk | ||
213 | -virtual size: 1.0T (1073741824000 bytes) | ||
214 | -disk size: 16K | ||
215 | +virtual size: 0.977 TiB (1073741824000 bytes) | ||
216 | +disk size: 16 KiB | ||
217 | Format specific information: | ||
218 | cid: XXXXXXXX | ||
219 | parent cid: XXXXXXXX | ||
220 | @@ -XXX,XX +XXX,XX @@ can't open: Cannot use relative extent paths with VMDK descriptor file 'json:{"i | ||
221 | === Testing version 3 === | ||
222 | image: TEST_DIR/iotest-version3.IMGFMT | ||
223 | file format: IMGFMT | ||
224 | -virtual size: 16G (17179869184 bytes) | ||
225 | +virtual size: 16 GiB (17179869184 bytes) | ||
226 | cluster_size: 65536 | ||
227 | read 512/512 bytes at offset 0 | ||
228 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
229 | @@ -XXX,XX +XXX,XX @@ read 512/512 bytes at offset 64931328 | ||
230 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4398046511104 subformat=monolithicFlat | ||
231 | image: TEST_DIR/t.IMGFMT | ||
232 | file format: IMGFMT | ||
233 | -virtual size: 4.0T (4398046511104 bytes) | ||
234 | +virtual size: 4 TiB (4398046511104 bytes) | ||
235 | wrote 512/512 bytes at offset 966367641600 | ||
236 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
237 | e100000000: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ | ||
238 | diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out | ||
239 | index XXXXXXX..XXXXXXX 100644 | ||
240 | --- a/tests/qemu-iotests/060.out | ||
241 | +++ b/tests/qemu-iotests/060.out | ||
242 | @@ -XXX,XX +XXX,XX @@ write failed: Input/output error | ||
243 | incompatible_features 0x2 | ||
244 | image: TEST_DIR/t.IMGFMT | ||
245 | file format: IMGFMT | ||
246 | -virtual size: 64M (67108864 bytes) | ||
247 | +virtual size: 64 MiB (67108864 bytes) | ||
248 | cluster_size: 65536 | ||
249 | Format specific information: | ||
250 | compat: 1.1 | ||
251 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
252 | qcow2: Marking image as corrupt: Refblock at 0xffffff00000000 is not covered by the refcount structures; further corruption events will be suppressed | ||
253 | qemu-img: Failed to discard unused refblocks: Input/output error | ||
254 | --- Checking and retrying --- | ||
255 | -virtual size: 64M (67108864 bytes) | ||
256 | +virtual size: 64 MiB (67108864 bytes) | ||
257 | No errors were found on the image. | ||
258 | Image resized. | ||
259 | -virtual size: 32M (33554432 bytes) | ||
260 | +virtual size: 32 MiB (33554432 bytes) | ||
261 | |||
262 | === Discarding a non-covered in-bounds refblock === | ||
263 | |||
264 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
265 | qcow2: Marking image as corrupt: Refblock at 0x1000000000 is not covered by the refcount structures; further corruption events will be suppressed | ||
266 | qemu-img: Failed to discard unused refblocks: Input/output error | ||
267 | --- Checking and retrying --- | ||
268 | -virtual size: 64M (67108864 bytes) | ||
269 | +virtual size: 64 MiB (67108864 bytes) | ||
270 | No errors were found on the image. | ||
271 | Image resized. | ||
272 | -virtual size: 32M (33554432 bytes) | ||
273 | +virtual size: 32 MiB (33554432 bytes) | ||
274 | |||
275 | === Discarding a refblock covered by an unaligned refblock === | ||
276 | |||
277 | diff --git a/tests/qemu-iotests/061.out b/tests/qemu-iotests/061.out | ||
278 | index XXXXXXX..XXXXXXX 100644 | ||
279 | --- a/tests/qemu-iotests/061.out | ||
280 | +++ b/tests/qemu-iotests/061.out | ||
281 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 data_file=TEST_DIR/t.IM | ||
282 | qemu-img: Cannot downgrade an image with a data file | ||
283 | image: TEST_DIR/t.IMGFMT | ||
284 | file format: IMGFMT | ||
285 | -virtual size: 64M (67108864 bytes) | ||
286 | +virtual size: 64 MiB (67108864 bytes) | ||
287 | cluster_size: 65536 | ||
288 | Format specific information: | ||
289 | compat: 1.1 | ||
290 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 data_file=TEST_DIR/t.IM | ||
291 | qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Could not open 'foo': No such file or directory | ||
292 | image: TEST_DIR/t.IMGFMT | ||
293 | file format: IMGFMT | ||
294 | -virtual size: 64M (67108864 bytes) | ||
295 | +virtual size: 64 MiB (67108864 bytes) | ||
296 | cluster_size: 65536 | ||
297 | Format specific information: | ||
298 | compat: 1.1 | ||
299 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
300 | qemu-img: Could not open 'TEST_DIR/t.IMGFMT': 'data-file' is required for this image | ||
301 | image: TEST_DIR/t.IMGFMT | ||
302 | file format: IMGFMT | ||
303 | -virtual size: 64M (67108864 bytes) | ||
304 | +virtual size: 64 MiB (67108864 bytes) | ||
305 | cluster_size: 65536 | ||
306 | Format specific information: | ||
307 | compat: 1.1 | ||
308 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
309 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 data_file=TEST_DIR/t.IMGFMT.data data_file_raw=on | ||
310 | image: TEST_DIR/t.IMGFMT | ||
311 | file format: IMGFMT | ||
312 | -virtual size: 64M (67108864 bytes) | ||
313 | +virtual size: 64 MiB (67108864 bytes) | ||
314 | cluster_size: 65536 | ||
315 | Format specific information: | ||
316 | compat: 1.1 | ||
317 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
318 | No errors were found on the image. | ||
319 | image: TEST_DIR/t.IMGFMT | ||
320 | file format: IMGFMT | ||
321 | -virtual size: 64M (67108864 bytes) | ||
322 | +virtual size: 64 MiB (67108864 bytes) | ||
323 | cluster_size: 65536 | ||
324 | Format specific information: | ||
325 | compat: 1.1 | ||
326 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
327 | qemu-img: data-file-raw cannot be set on existing images | ||
328 | image: TEST_DIR/t.IMGFMT | ||
329 | file format: IMGFMT | ||
330 | -virtual size: 64M (67108864 bytes) | ||
331 | +virtual size: 64 MiB (67108864 bytes) | ||
332 | cluster_size: 65536 | ||
333 | Format specific information: | ||
334 | compat: 1.1 | ||
335 | diff --git a/tests/qemu-iotests/070.out b/tests/qemu-iotests/070.out | ||
336 | index XXXXXXX..XXXXXXX 100644 | ||
337 | --- a/tests/qemu-iotests/070.out | ||
338 | +++ b/tests/qemu-iotests/070.out | ||
339 | @@ -XXX,XX +XXX,XX @@ read 18874368/18874368 bytes at offset 0 | ||
340 | === Verify image created by Disk2VHD can be opened === | ||
341 | image: TEST_DIR/test-disk2vhd.IMGFMT | ||
342 | file format: IMGFMT | ||
343 | -virtual size: 256M (268435456 bytes) | ||
344 | +virtual size: 256 MiB (268435456 bytes) | ||
345 | cluster_size: 2097152 | ||
346 | *** done | ||
347 | diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out | ||
348 | index XXXXXXX..XXXXXXX 100644 | ||
349 | --- a/tests/qemu-iotests/082.out | ||
350 | +++ b/tests/qemu-iotests/082.out | ||
351 | @@ -XXX,XX +XXX,XX @@ Testing: create -f foo -f qcow2 TEST_DIR/t.qcow2 128M | ||
352 | Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
353 | image: TEST_DIR/t.IMGFMT | ||
354 | file format: IMGFMT | ||
355 | -virtual size: 128M (134217728 bytes) | ||
356 | +virtual size: 128 MiB (134217728 bytes) | ||
357 | cluster_size: 65536 | ||
358 | |||
359 | Testing: create -f qcow2 -o cluster_size=4k -o lazy_refcounts=on TEST_DIR/t.qcow2 128M | ||
360 | Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=4096 lazy_refcounts=on refcount_bits=16 | ||
361 | image: TEST_DIR/t.IMGFMT | ||
362 | file format: IMGFMT | ||
363 | -virtual size: 128M (134217728 bytes) | ||
364 | +virtual size: 128 MiB (134217728 bytes) | ||
365 | cluster_size: 4096 | ||
366 | Format specific information: | ||
367 | compat: 1.1 | ||
368 | @@ -XXX,XX +XXX,XX @@ Testing: create -f qcow2 -o cluster_size=4k -o lazy_refcounts=on -o cluster_size | ||
369 | Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=8192 lazy_refcounts=on refcount_bits=16 | ||
370 | image: TEST_DIR/t.IMGFMT | ||
371 | file format: IMGFMT | ||
372 | -virtual size: 128M (134217728 bytes) | ||
373 | +virtual size: 128 MiB (134217728 bytes) | ||
374 | cluster_size: 8192 | ||
375 | Format specific information: | ||
376 | compat: 1.1 | ||
377 | @@ -XXX,XX +XXX,XX @@ Testing: create -f qcow2 -o cluster_size=4k,cluster_size=8k TEST_DIR/t.qcow2 128 | ||
378 | Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=8192 lazy_refcounts=off refcount_bits=16 | ||
379 | image: TEST_DIR/t.IMGFMT | ||
380 | file format: IMGFMT | ||
381 | -virtual size: 128M (134217728 bytes) | ||
382 | +virtual size: 128 MiB (134217728 bytes) | ||
383 | cluster_size: 8192 | ||
384 | |||
385 | === create: help for -o === | ||
386 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=65536 lazy_ | ||
387 | Testing: convert -f foo -f qcow2 TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
388 | image: TEST_DIR/t.IMGFMT.base | ||
389 | file format: raw | ||
390 | -virtual size: 128M (134217728 bytes) | ||
391 | +virtual size: 128 MiB (134217728 bytes) | ||
392 | |||
393 | Testing: convert -O foo -O qcow2 TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
394 | image: TEST_DIR/t.IMGFMT.base | ||
395 | file format: IMGFMT | ||
396 | -virtual size: 128M (134217728 bytes) | ||
397 | +virtual size: 128 MiB (134217728 bytes) | ||
398 | cluster_size: 65536 | ||
399 | |||
400 | Testing: convert -O qcow2 -o cluster_size=4k -o lazy_refcounts=on TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
401 | image: TEST_DIR/t.IMGFMT.base | ||
402 | file format: IMGFMT | ||
403 | -virtual size: 128M (134217728 bytes) | ||
404 | +virtual size: 128 MiB (134217728 bytes) | ||
405 | cluster_size: 4096 | ||
406 | Format specific information: | ||
407 | compat: 1.1 | ||
408 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
409 | Testing: convert -O qcow2 -o cluster_size=4k -o lazy_refcounts=on -o cluster_size=8k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
410 | image: TEST_DIR/t.IMGFMT.base | ||
411 | file format: IMGFMT | ||
412 | -virtual size: 128M (134217728 bytes) | ||
413 | +virtual size: 128 MiB (134217728 bytes) | ||
414 | cluster_size: 8192 | ||
415 | Format specific information: | ||
416 | compat: 1.1 | ||
417 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
418 | Testing: convert -O qcow2 -o cluster_size=4k,cluster_size=8k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
419 | image: TEST_DIR/t.IMGFMT.base | ||
420 | file format: IMGFMT | ||
421 | -virtual size: 128M (134217728 bytes) | ||
422 | +virtual size: 128 MiB (134217728 bytes) | ||
423 | cluster_size: 8192 | ||
424 | |||
425 | === convert: help for -o === | ||
426 | @@ -XXX,XX +XXX,XX @@ qemu-img: Cannot enable copy offloading when -c is used | ||
427 | Testing: amend -f foo -f qcow2 -o lazy_refcounts=on TEST_DIR/t.qcow2 | ||
428 | image: TEST_DIR/t.IMGFMT | ||
429 | file format: IMGFMT | ||
430 | -virtual size: 128M (134217728 bytes) | ||
431 | +virtual size: 128 MiB (134217728 bytes) | ||
432 | cluster_size: 65536 | ||
433 | Format specific information: | ||
434 | compat: 1.1 | ||
435 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
436 | Testing: amend -f qcow2 -o size=130M -o lazy_refcounts=off TEST_DIR/t.qcow2 | ||
437 | image: TEST_DIR/t.IMGFMT | ||
438 | file format: IMGFMT | ||
439 | -virtual size: 130M (136314880 bytes) | ||
440 | +virtual size: 130 MiB (136314880 bytes) | ||
441 | cluster_size: 65536 | ||
442 | Format specific information: | ||
443 | compat: 1.1 | ||
444 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
445 | Testing: amend -f qcow2 -o size=8M -o lazy_refcounts=on -o size=132M TEST_DIR/t.qcow2 | ||
446 | image: TEST_DIR/t.IMGFMT | ||
447 | file format: IMGFMT | ||
448 | -virtual size: 132M (138412032 bytes) | ||
449 | +virtual size: 132 MiB (138412032 bytes) | ||
450 | cluster_size: 65536 | ||
451 | Format specific information: | ||
452 | compat: 1.1 | ||
453 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
454 | Testing: amend -f qcow2 -o size=4M,size=148M TEST_DIR/t.qcow2 | ||
455 | image: TEST_DIR/t.IMGFMT | ||
456 | file format: IMGFMT | ||
457 | -virtual size: 148M (155189248 bytes) | ||
458 | +virtual size: 148 MiB (155189248 bytes) | ||
459 | cluster_size: 65536 | ||
460 | |||
461 | === amend: help for -o === | ||
462 | diff --git a/tests/qemu-iotests/084.out b/tests/qemu-iotests/084.out | ||
463 | index XXXXXXX..XXXXXXX 100644 | ||
464 | --- a/tests/qemu-iotests/084.out | ||
465 | +++ b/tests/qemu-iotests/084.out | ||
466 | @@ -XXX,XX +XXX,XX @@ QA output created by 084 | ||
467 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
468 | image: TEST_DIR/t.IMGFMT | ||
469 | file format: IMGFMT | ||
470 | -virtual size: 64M (67108864 bytes) | ||
471 | +virtual size: 64 MiB (67108864 bytes) | ||
472 | cluster_size: 1048576 | ||
473 | disk image file size in bytes: 67109888 | ||
474 | |||
475 | @@ -XXX,XX +XXX,XX @@ disk image file size in bytes: 67109888 | ||
476 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
477 | image: TEST_DIR/t.IMGFMT | ||
478 | file format: IMGFMT | ||
479 | -virtual size: 64M (67108864 bytes) | ||
480 | +virtual size: 64 MiB (67108864 bytes) | ||
481 | cluster_size: 1048576 | ||
482 | disk image file size in bytes: 1024 | ||
483 | Test 1: Maximum size (512 TB - 128 MB): | ||
484 | image: TEST_DIR/t.IMGFMT | ||
485 | file format: IMGFMT | ||
486 | -virtual size: 512T (562949819203584 bytes) | ||
487 | +virtual size: 512 TiB (562949819203584 bytes) | ||
488 | cluster_size: 1048576 | ||
489 | |||
490 | Test 2: Size too large (512 TB - 128 MB + 64 kB) | ||
491 | @@ -XXX,XX +XXX,XX @@ qemu-img: Could not open 'TEST_DIR/t.IMGFMT': unsupported VDI image (too many bl | ||
492 | Test 5: Valid Image: 64MB, Blocks In Image 64, Block Size 1MB | ||
493 | image: TEST_DIR/t.IMGFMT | ||
494 | file format: IMGFMT | ||
495 | -virtual size: 64M (67108864 bytes) | ||
496 | +virtual size: 64 MiB (67108864 bytes) | ||
497 | cluster_size: 1048576 | ||
498 | |||
499 | Test 6: Block Size != 1MB; too small test (1MB - 1) | ||
500 | diff --git a/tests/qemu-iotests/089.out b/tests/qemu-iotests/089.out | ||
501 | index XXXXXXX..XXXXXXX 100644 | ||
502 | --- a/tests/qemu-iotests/089.out | ||
503 | +++ b/tests/qemu-iotests/089.out | ||
504 | @@ -XXX,XX +XXX,XX @@ read failed: Input/output error | ||
505 | |||
506 | image: TEST_DIR/t.IMGFMT | ||
507 | file format: IMGFMT | ||
508 | -virtual size: 64M (67108864 bytes) | ||
509 | +virtual size: 64 MiB (67108864 bytes) | ||
510 | cluster_size: 65536 | ||
511 | |||
512 | === Testing option merging === | ||
513 | diff --git a/tests/qemu-iotests/095.out b/tests/qemu-iotests/095.out | ||
514 | index XXXXXXX..XXXXXXX 100644 | ||
515 | --- a/tests/qemu-iotests/095.out | ||
516 | +++ b/tests/qemu-iotests/095.out | ||
517 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=104857600 backing_file=TEST_DIR/ | ||
518 | === Base image info before commit and resize === | ||
519 | image: TEST_DIR/t.IMGFMT.base | ||
520 | file format: IMGFMT | ||
521 | -virtual size: 5.0M (5242880 bytes) | ||
522 | +virtual size: 5 MiB (5242880 bytes) | ||
523 | |||
524 | === Running QEMU Live Commit Test === | ||
525 | |||
526 | @@ -XXX,XX +XXX,XX @@ virtual size: 5.0M (5242880 bytes) | ||
527 | === Base image info after commit and resize === | ||
528 | image: TEST_DIR/t.IMGFMT.base | ||
529 | file format: IMGFMT | ||
530 | -virtual size: 100M (104857600 bytes) | ||
531 | +virtual size: 100 MiB (104857600 bytes) | ||
532 | *** done | ||
533 | diff --git a/tests/qemu-iotests/104.out b/tests/qemu-iotests/104.out | ||
534 | index XXXXXXX..XXXXXXX 100644 | ||
535 | --- a/tests/qemu-iotests/104.out | ||
536 | +++ b/tests/qemu-iotests/104.out | ||
537 | @@ -XXX,XX +XXX,XX @@ QA output created by 104 | ||
538 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024 | ||
539 | image: TEST_DIR/t.IMGFMT | ||
540 | file format: IMGFMT | ||
541 | -virtual size: 1.0K (1024 bytes) | ||
542 | +virtual size: 1 KiB (1024 bytes) | ||
543 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1234 | ||
544 | image: TEST_DIR/t.IMGFMT | ||
545 | file format: IMGFMT | ||
546 | -virtual size: 1.5K (1536 bytes) | ||
547 | -***done | ||
548 | +virtual size: 1.5 KiB (1536 bytes) | ||
549 | +*** done | ||
550 | diff --git a/tests/qemu-iotests/110.out b/tests/qemu-iotests/110.out | ||
551 | index XXXXXXX..XXXXXXX 100644 | ||
552 | --- a/tests/qemu-iotests/110.out | ||
553 | +++ b/tests/qemu-iotests/110.out | ||
554 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864 | ||
555 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=t.IMGFMT.base | ||
556 | image: TEST_DIR/t.IMGFMT | ||
557 | file format: IMGFMT | ||
558 | -virtual size: 64M (67108864 bytes) | ||
559 | +virtual size: 64 MiB (67108864 bytes) | ||
560 | backing file: t.IMGFMT.base (actual path: TEST_DIR/t.IMGFMT.base) | ||
561 | |||
562 | === Non-reconstructable filename === | ||
563 | |||
564 | image: json:{"driver": "IMGFMT", "file": {"set-state.0.event": "read_aio", "image": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, "driver": "blkdebug", "set-state.0.new_state": 42}} | ||
565 | file format: IMGFMT | ||
566 | -virtual size: 64M (67108864 bytes) | ||
567 | +virtual size: 64 MiB (67108864 bytes) | ||
568 | backing file: t.IMGFMT.base (actual path: TEST_DIR/t.IMGFMT.base) | ||
569 | |||
570 | === Backing name is always relative to the backed image === | ||
571 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=t.IMGFMT.b | ||
572 | |||
573 | image: json:{"driver": "IMGFMT", "file": {"children": [{"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, {"driver": "file", "filename": "TEST_DIR/t.IMGFMT.copy"}], "driver": "quorum", "vote-threshold": 1}} | ||
574 | file format: IMGFMT | ||
575 | -virtual size: 64M (67108864 bytes) | ||
576 | +virtual size: 64 MiB (67108864 bytes) | ||
577 | backing file: t.IMGFMT.base (cannot determine actual path) | ||
578 | *** done | ||
579 | diff --git a/tests/qemu-iotests/114.out b/tests/qemu-iotests/114.out | ||
580 | index XXXXXXX..XXXXXXX 100644 | ||
581 | --- a/tests/qemu-iotests/114.out | ||
582 | +++ b/tests/qemu-iotests/114.out | ||
583 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864 | ||
584 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.base | ||
585 | image: TEST_DIR/t.IMGFMT | ||
586 | file format: IMGFMT | ||
587 | -virtual size: 64M (67108864 bytes) | ||
588 | +virtual size: 64 MiB (67108864 bytes) | ||
589 | cluster_size: 65536 | ||
590 | backing file: TEST_DIR/t.IMGFMT.base | ||
591 | backing file format: foo | ||
592 | diff --git a/tests/qemu-iotests/126.out b/tests/qemu-iotests/126.out | ||
593 | index XXXXXXX..XXXXXXX 100644 | ||
594 | --- a/tests/qemu-iotests/126.out | ||
595 | +++ b/tests/qemu-iotests/126.out | ||
596 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/image:base.IMGFMT', fmt=IMGFMT size=67108864 | ||
597 | Formatting 'TEST_DIR/image:top.IMGFMT', fmt=IMGFMT size=67108864 backing_file=./image:base.IMGFMT | ||
598 | image: TEST_DIR/image:top.IMGFMT | ||
599 | file format: IMGFMT | ||
600 | -virtual size: 64M (67108864 bytes) | ||
601 | +virtual size: 64 MiB (67108864 bytes) | ||
602 | backing file: ./image:base.IMGFMT (actual path: TEST_DIR/./image:base.IMGFMT) | ||
603 | |||
604 | Formatting 'base.IMGFMT', fmt=IMGFMT size=67108864 | ||
605 | Formatting 'file:image:top.IMGFMT', fmt=IMGFMT size=67108864 backing_file=base.IMGFMT | ||
606 | image: ./image:top.IMGFMT | ||
607 | file format: IMGFMT | ||
608 | -virtual size: 64M (67108864 bytes) | ||
609 | +virtual size: 64 MiB (67108864 bytes) | ||
610 | backing file: base.IMGFMT (actual path: ./base.IMGFMT) | ||
611 | *** done | ||
612 | diff --git a/tests/qemu-iotests/130.out b/tests/qemu-iotests/130.out | ||
613 | index XXXXXXX..XXXXXXX 100644 | ||
614 | --- a/tests/qemu-iotests/130.out | ||
615 | +++ b/tests/qemu-iotests/130.out | ||
616 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864 | ||
617 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
618 | image: TEST_DIR/t.IMGFMT | ||
619 | file format: IMGFMT | ||
620 | -virtual size: 64M (67108864 bytes) | ||
621 | +virtual size: 64 MiB (67108864 bytes) | ||
622 | |||
623 | === HMP commit === | ||
624 | |||
625 | @@ -XXX,XX +XXX,XX @@ QEMU X.Y.Z monitor - type 'help' for more information | ||
626 | (qemu) | ||
627 | image: TEST_DIR/t.IMGFMT | ||
628 | file format: IMGFMT | ||
629 | -virtual size: 64M (67108864 bytes) | ||
630 | +virtual size: 64 MiB (67108864 bytes) | ||
631 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.orig backing_fmt=raw | ||
632 | QEMU X.Y.Z monitor - type 'help' for more information | ||
633 | (qemu) commit testdisk | ||
634 | (qemu) | ||
635 | image: TEST_DIR/t.IMGFMT | ||
636 | file format: IMGFMT | ||
637 | -virtual size: 64M (67108864 bytes) | ||
638 | +virtual size: 64 MiB (67108864 bytes) | ||
639 | backing file: TEST_DIR/t.IMGFMT.orig | ||
640 | backing file format: raw | ||
641 | |||
642 | @@ -XXX,XX +XXX,XX @@ wrote 4096/4096 bytes at offset 0 | ||
643 | 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
644 | image: TEST_DIR/t.IMGFMT | ||
645 | file format: IMGFMT | ||
646 | -virtual size: 64M (67108864 bytes) | ||
647 | +virtual size: 64 MiB (67108864 bytes) | ||
648 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.orig backing_fmt=raw | ||
649 | wrote 4096/4096 bytes at offset 0 | ||
650 | 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
651 | image: TEST_DIR/t.IMGFMT | ||
652 | file format: IMGFMT | ||
653 | -virtual size: 64M (67108864 bytes) | ||
654 | +virtual size: 64 MiB (67108864 bytes) | ||
655 | backing file: TEST_DIR/t.IMGFMT.orig | ||
656 | backing file format: raw | ||
657 | *** done | ||
658 | diff --git a/tests/qemu-iotests/153.out b/tests/qemu-iotests/153.out | ||
659 | index XXXXXXX..XXXXXXX 100644 | ||
660 | --- a/tests/qemu-iotests/153.out | ||
661 | +++ b/tests/qemu-iotests/153.out | ||
662 | @@ -XXX,XX +XXX,XX @@ _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512 | ||
663 | No conflict: | ||
664 | image: null-co:// | ||
665 | file format: null-co | ||
666 | -virtual size: 1.0G (1073741824 bytes) | ||
667 | +virtual size: 1 GiB (1073741824 bytes) | ||
668 | disk size: unavailable | ||
669 | |||
670 | Conflict: | ||
671 | diff --git a/tests/qemu-iotests/191.out b/tests/qemu-iotests/191.out | ||
672 | index XXXXXXX..XXXXXXX 100644 | ||
673 | --- a/tests/qemu-iotests/191.out | ||
674 | +++ b/tests/qemu-iotests/191.out | ||
675 | @@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576 | ||
676 | } | ||
677 | image: TEST_DIR/t.IMGFMT | ||
678 | file format: IMGFMT | ||
679 | -virtual size: 64M (67108864 bytes) | ||
680 | +virtual size: 64 MiB (67108864 bytes) | ||
681 | cluster_size: 65536 | ||
682 | backing file: TEST_DIR/t.IMGFMT.base | ||
683 | backing file format: IMGFMT | ||
684 | image: TEST_DIR/t.IMGFMT.ovl2 | ||
685 | file format: IMGFMT | ||
686 | -virtual size: 64M (67108864 bytes) | ||
687 | +virtual size: 64 MiB (67108864 bytes) | ||
688 | cluster_size: 65536 | ||
689 | backing file: TEST_DIR/t.IMGFMT.base | ||
690 | backing file format: IMGFMT | ||
691 | @@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576 | ||
692 | } | ||
693 | image: TEST_DIR/t.IMGFMT | ||
694 | file format: IMGFMT | ||
695 | -virtual size: 64M (67108864 bytes) | ||
696 | +virtual size: 64 MiB (67108864 bytes) | ||
697 | cluster_size: 65536 | ||
698 | backing file: TEST_DIR/t.IMGFMT.base | ||
699 | backing file format: IMGFMT | ||
700 | image: TEST_DIR/t.IMGFMT.ovl2 | ||
701 | file format: IMGFMT | ||
702 | -virtual size: 64M (67108864 bytes) | ||
703 | +virtual size: 64 MiB (67108864 bytes) | ||
704 | cluster_size: 65536 | ||
705 | backing file: TEST_DIR/t.IMGFMT.base | ||
706 | backing file format: IMGFMT | ||
707 | diff --git a/tests/qemu-iotests/195.out b/tests/qemu-iotests/195.out | ||
708 | index XXXXXXX..XXXXXXX 100644 | ||
709 | --- a/tests/qemu-iotests/195.out | ||
710 | +++ b/tests/qemu-iotests/195.out | ||
711 | @@ -XXX,XX +XXX,XX @@ Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,backing.node-name=mid | ||
712 | |||
713 | image: TEST_DIR/t.IMGFMT.mid | ||
714 | file format: IMGFMT | ||
715 | -virtual size: 64M (67108864 bytes) | ||
716 | +virtual size: 64 MiB (67108864 bytes) | ||
717 | cluster_size: 65536 | ||
718 | backing file: /dev/null | ||
719 | backing file format: IMGFMT | ||
720 | @@ -XXX,XX +XXX,XX @@ Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,node-name=top | ||
721 | |||
722 | image: TEST_DIR/t.IMGFMT | ||
723 | file format: IMGFMT | ||
724 | -virtual size: 64M (67108864 bytes) | ||
725 | +virtual size: 64 MiB (67108864 bytes) | ||
726 | cluster_size: 65536 | ||
727 | backing file: /dev/null | ||
728 | backing file format: IMGFMT | ||
729 | diff --git a/tests/qemu-iotests/198.out b/tests/qemu-iotests/198.out | ||
730 | index XXXXXXX..XXXXXXX 100644 | ||
731 | --- a/tests/qemu-iotests/198.out | ||
732 | +++ b/tests/qemu-iotests/198.out | ||
733 | @@ -XXX,XX +XXX,XX @@ read 16777216/16777216 bytes at offset 0 | ||
734 | == checking image base == | ||
735 | image: json:{"encrypt.key-secret": "sec0", "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT.base"}} | ||
736 | file format: IMGFMT | ||
737 | -virtual size: 16M (16777216 bytes) | ||
738 | +virtual size: 16 MiB (16777216 bytes) | ||
739 | Format specific information: | ||
740 | encrypt: | ||
741 | ivgen alg: plain64 | ||
742 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
743 | == checking image layer == | ||
744 | image: json:{"encrypt.key-secret": "sec1", "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}} | ||
745 | file format: IMGFMT | ||
746 | -virtual size: 16M (16777216 bytes) | ||
747 | +virtual size: 16 MiB (16777216 bytes) | ||
748 | backing file: TEST_DIR/t.IMGFMT.base | ||
749 | Format specific information: | ||
750 | encrypt: | ||
751 | diff --git a/tests/qemu-iotests/206.out b/tests/qemu-iotests/206.out | ||
752 | index XXXXXXX..XXXXXXX 100644 | ||
753 | --- a/tests/qemu-iotests/206.out | ||
754 | +++ b/tests/qemu-iotests/206.out | ||
755 | @@ -XXX,XX +XXX,XX @@ | ||
756 | |||
757 | image: TEST_IMG | ||
758 | file format: IMGFMT | ||
759 | -virtual size: 128M (134217728 bytes) | ||
760 | +virtual size: 128 MiB (134217728 bytes) | ||
761 | cluster_size: 65536 | ||
762 | Format specific information: | ||
763 | compat: 1.1 | ||
764 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
765 | |||
766 | image: TEST_IMG | ||
767 | file format: IMGFMT | ||
768 | -virtual size: 64M (67108864 bytes) | ||
769 | +virtual size: 64 MiB (67108864 bytes) | ||
770 | cluster_size: 65536 | ||
771 | Format specific information: | ||
772 | compat: 1.1 | ||
773 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
774 | |||
775 | image: TEST_IMG | ||
776 | file format: IMGFMT | ||
777 | -virtual size: 32M (33554432 bytes) | ||
778 | +virtual size: 32 MiB (33554432 bytes) | ||
779 | cluster_size: 2097152 | ||
780 | Format specific information: | ||
781 | compat: 1.1 | ||
782 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
783 | |||
784 | image: TEST_IMG | ||
785 | file format: IMGFMT | ||
786 | -virtual size: 32M (33554432 bytes) | ||
787 | +virtual size: 32 MiB (33554432 bytes) | ||
788 | cluster_size: 512 | ||
789 | backing file: TEST_IMG.base | ||
790 | backing file format: IMGFMT | ||
791 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
792 | |||
793 | image: TEST_IMG | ||
794 | file format: IMGFMT | ||
795 | -virtual size: 32M (33554432 bytes) | ||
796 | +virtual size: 32 MiB (33554432 bytes) | ||
797 | encrypted: yes | ||
798 | cluster_size: 65536 | ||
799 | Format specific information: | ||
800 | diff --git a/tests/qemu-iotests/207.out b/tests/qemu-iotests/207.out | ||
801 | index XXXXXXX..XXXXXXX 100644 | ||
802 | --- a/tests/qemu-iotests/207.out | ||
803 | +++ b/tests/qemu-iotests/207.out | ||
804 | @@ -XXX,XX +XXX,XX @@ | ||
805 | |||
806 | image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}} | ||
807 | file format: IMGFMT | ||
808 | -virtual size: 4.0M (4194304 bytes) | ||
809 | +virtual size: 4 MiB (4194304 bytes) | ||
810 | |||
811 | |||
812 | image: TEST_IMG | ||
813 | file format: IMGFMT | ||
814 | -virtual size: 4.0M (4194304 bytes) | ||
815 | +virtual size: 4 MiB (4194304 bytes) | ||
816 | |||
817 | === Test host-key-check options === | ||
818 | |||
819 | @@ -XXX,XX +XXX,XX @@ virtual size: 4.0M (4194304 bytes) | ||
820 | |||
821 | image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}} | ||
822 | file format: IMGFMT | ||
823 | -virtual size: 8.0M (8388608 bytes) | ||
824 | +virtual size: 8 MiB (8388608 bytes) | ||
825 | |||
826 | {"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "ssh", "location": {"host-key-check": {"mode": "known_hosts"}, "path": "TEST_DIR/PID-t.img", "server": {"host": "127.0.0.1", "port": "22"}}, "size": 4194304}}} | ||
827 | {"return": {}} | ||
828 | @@ -XXX,XX +XXX,XX @@ virtual size: 8.0M (8388608 bytes) | ||
829 | |||
830 | image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}} | ||
831 | file format: IMGFMT | ||
832 | -virtual size: 4.0M (4194304 bytes) | ||
833 | +virtual size: 4 MiB (4194304 bytes) | ||
834 | |||
835 | {"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "ssh", "location": {"host-key-check": {"hash": "wrong", "mode": "hash", "type": "md5"}, "path": "TEST_DIR/PID-t.img", "server": {"host": "127.0.0.1", "port": "22"}}, "size": 2097152}}} | ||
836 | {"return": {}} | ||
837 | @@ -XXX,XX +XXX,XX @@ Job failed: remote host key does not match host_key_check 'wrong' | ||
838 | |||
839 | image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}} | ||
840 | file format: IMGFMT | ||
841 | -virtual size: 8.0M (8388608 bytes) | ||
842 | +virtual size: 8 MiB (8388608 bytes) | ||
843 | |||
844 | {"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "ssh", "location": {"host-key-check": {"hash": "wrong", "mode": "hash", "type": "sha1"}, "path": "TEST_DIR/PID-t.img", "server": {"host": "127.0.0.1", "port": "22"}}, "size": 2097152}}} | ||
845 | {"return": {}} | ||
846 | @@ -XXX,XX +XXX,XX @@ Job failed: remote host key does not match host_key_check 'wrong' | ||
847 | |||
848 | image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}} | ||
849 | file format: IMGFMT | ||
850 | -virtual size: 4.0M (4194304 bytes) | ||
851 | +virtual size: 4 MiB (4194304 bytes) | ||
852 | |||
853 | === Invalid path and user === | ||
854 | |||
855 | diff --git a/tests/qemu-iotests/210.out b/tests/qemu-iotests/210.out | ||
856 | index XXXXXXX..XXXXXXX 100644 | ||
857 | --- a/tests/qemu-iotests/210.out | ||
858 | +++ b/tests/qemu-iotests/210.out | ||
859 | @@ -XXX,XX +XXX,XX @@ | ||
860 | |||
861 | image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_IMG"}, "key-secret": "keysec0"} | ||
862 | file format: IMGFMT | ||
863 | -virtual size: 128M (134217728 bytes) | ||
864 | +virtual size: 128 MiB (134217728 bytes) | ||
865 | encrypted: yes | ||
866 | Format specific information: | ||
867 | ivgen alg: plain64 | ||
868 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
869 | |||
870 | image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_IMG"}, "key-secret": "keysec0"} | ||
871 | file format: IMGFMT | ||
872 | -virtual size: 64M (67108864 bytes) | ||
873 | +virtual size: 64 MiB (67108864 bytes) | ||
874 | encrypted: yes | ||
875 | Format specific information: | ||
876 | ivgen alg: plain64 | ||
877 | @@ -XXX,XX +XXX,XX @@ Job failed: Cannot find device=this doesn't exist nor node_name=this doesn't exi | ||
878 | |||
879 | image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_IMG"}, "key-secret": "keysec0"} | ||
880 | file format: IMGFMT | ||
881 | -virtual size: 0 (0 bytes) | ||
882 | +virtual size: 0 B (0 bytes) | ||
883 | encrypted: yes | ||
884 | Format specific information: | ||
885 | ivgen alg: plain64 | ||
886 | @@ -XXX,XX +XXX,XX @@ Job failed: The requested file size is too large | ||
887 | {"error": {"class": "GenericError", "desc": "Parameter 'size' expects a >0 size"}} | ||
888 | image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_IMG"}, "key-secret": "keysec0"} | ||
889 | file format: IMGFMT | ||
890 | -virtual size: 0 (0 bytes) | ||
891 | +virtual size: 0 B (0 bytes) | ||
892 | encrypted: yes | ||
893 | Format specific information: | ||
894 | ivgen alg: plain64 | ||
895 | diff --git a/tests/qemu-iotests/211.out b/tests/qemu-iotests/211.out | ||
896 | index XXXXXXX..XXXXXXX 100644 | ||
897 | --- a/tests/qemu-iotests/211.out | ||
898 | +++ b/tests/qemu-iotests/211.out | ||
899 | @@ -XXX,XX +XXX,XX @@ | ||
900 | |||
901 | image: TEST_IMG | ||
902 | file format: IMGFMT | ||
903 | -virtual size: 128M (134217728 bytes) | ||
904 | +virtual size: 128 MiB (134217728 bytes) | ||
905 | cluster_size: 1048576 | ||
906 | |||
907 | [{ "start": 0, "length": 134217728, "depth": 0, "zero": true, "data": false}] | ||
908 | @@ -XXX,XX +XXX,XX @@ cluster_size: 1048576 | ||
909 | |||
910 | image: TEST_IMG | ||
911 | file format: IMGFMT | ||
912 | -virtual size: 64M (67108864 bytes) | ||
913 | +virtual size: 64 MiB (67108864 bytes) | ||
914 | cluster_size: 1048576 | ||
915 | |||
916 | [{ "start": 0, "length": 67108864, "depth": 0, "zero": true, "data": false}] | ||
917 | @@ -XXX,XX +XXX,XX @@ cluster_size: 1048576 | ||
918 | |||
919 | image: TEST_IMG | ||
920 | file format: IMGFMT | ||
921 | -virtual size: 32M (33554432 bytes) | ||
922 | +virtual size: 32 MiB (33554432 bytes) | ||
923 | cluster_size: 1048576 | ||
924 | |||
925 | [{ "start": 0, "length": 3072, "depth": 0, "zero": false, "data": true, "offset": 1024}, | ||
926 | @@ -XXX,XX +XXX,XX @@ Job failed: Cannot find device=this doesn't exist nor node_name=this doesn't exi | ||
927 | |||
928 | image: TEST_IMG | ||
929 | file format: IMGFMT | ||
930 | -virtual size: 0 (0 bytes) | ||
931 | +virtual size: 0 B (0 bytes) | ||
932 | cluster_size: 1048576 | ||
933 | |||
934 | === Maximum size === | ||
935 | @@ -XXX,XX +XXX,XX @@ cluster_size: 1048576 | ||
936 | |||
937 | image: TEST_IMG | ||
938 | file format: IMGFMT | ||
939 | -virtual size: 512T (562949819203584 bytes) | ||
940 | +virtual size: 512 TiB (562949819203584 bytes) | ||
941 | cluster_size: 1048576 | ||
942 | |||
943 | === Invalid sizes === | ||
944 | diff --git a/tests/qemu-iotests/212.out b/tests/qemu-iotests/212.out | ||
945 | index XXXXXXX..XXXXXXX 100644 | ||
946 | --- a/tests/qemu-iotests/212.out | ||
947 | +++ b/tests/qemu-iotests/212.out | ||
948 | @@ -XXX,XX +XXX,XX @@ | ||
949 | |||
950 | image: TEST_IMG | ||
951 | file format: IMGFMT | ||
952 | -virtual size: 128M (134217728 bytes) | ||
953 | +virtual size: 128 MiB (134217728 bytes) | ||
954 | |||
955 | === Successful image creation (explicit defaults) === | ||
956 | |||
957 | @@ -XXX,XX +XXX,XX @@ virtual size: 128M (134217728 bytes) | ||
958 | |||
959 | image: TEST_IMG | ||
960 | file format: IMGFMT | ||
961 | -virtual size: 64M (67108864 bytes) | ||
962 | +virtual size: 64 MiB (67108864 bytes) | ||
963 | |||
964 | === Successful image creation (with non-default options) === | ||
965 | |||
966 | @@ -XXX,XX +XXX,XX @@ virtual size: 64M (67108864 bytes) | ||
967 | |||
968 | image: TEST_IMG | ||
969 | file format: IMGFMT | ||
970 | -virtual size: 32M (33554432 bytes) | ||
971 | +virtual size: 32 MiB (33554432 bytes) | ||
972 | |||
973 | === Invalid BlockdevRef === | ||
974 | |||
975 | @@ -XXX,XX +XXX,XX @@ Job failed: Cannot find device=this doesn't exist nor node_name=this doesn't exi | ||
976 | |||
977 | image: TEST_IMG | ||
978 | file format: IMGFMT | ||
979 | -virtual size: 0 (0 bytes) | ||
980 | +virtual size: 0 B (0 bytes) | ||
981 | |||
982 | === Maximum size === | ||
983 | |||
984 | @@ -XXX,XX +XXX,XX @@ virtual size: 0 (0 bytes) | ||
985 | |||
986 | image: TEST_IMG | ||
987 | file format: IMGFMT | ||
988 | -virtual size: 4096T (4503599627369984 bytes) | ||
989 | +virtual size: 4 PiB (4503599627369984 bytes) | ||
990 | |||
991 | === Invalid sizes === | ||
992 | |||
993 | diff --git a/tests/qemu-iotests/213.out b/tests/qemu-iotests/213.out | ||
994 | index XXXXXXX..XXXXXXX 100644 | ||
995 | --- a/tests/qemu-iotests/213.out | ||
996 | +++ b/tests/qemu-iotests/213.out | ||
997 | @@ -XXX,XX +XXX,XX @@ | ||
998 | |||
999 | image: TEST_IMG | ||
1000 | file format: IMGFMT | ||
1001 | -virtual size: 128M (134217728 bytes) | ||
1002 | +virtual size: 128 MiB (134217728 bytes) | ||
1003 | cluster_size: 8388608 | ||
1004 | |||
1005 | === Successful image creation (explicit defaults) === | ||
1006 | @@ -XXX,XX +XXX,XX @@ cluster_size: 8388608 | ||
1007 | |||
1008 | image: TEST_IMG | ||
1009 | file format: IMGFMT | ||
1010 | -virtual size: 64M (67108864 bytes) | ||
1011 | +virtual size: 64 MiB (67108864 bytes) | ||
1012 | cluster_size: 8388608 | ||
1013 | |||
1014 | === Successful image creation (with non-default options) === | ||
1015 | @@ -XXX,XX +XXX,XX @@ cluster_size: 8388608 | ||
1016 | |||
1017 | image: TEST_IMG | ||
1018 | file format: IMGFMT | ||
1019 | -virtual size: 32M (33554432 bytes) | ||
1020 | +virtual size: 32 MiB (33554432 bytes) | ||
1021 | cluster_size: 268435456 | ||
1022 | |||
1023 | === Invalid BlockdevRef === | ||
1024 | @@ -XXX,XX +XXX,XX @@ Job failed: Cannot find device=this doesn't exist nor node_name=this doesn't exi | ||
1025 | |||
1026 | image: TEST_IMG | ||
1027 | file format: IMGFMT | ||
1028 | -virtual size: 0 (0 bytes) | ||
1029 | +virtual size: 0 B (0 bytes) | ||
1030 | cluster_size: 8388608 | ||
1031 | |||
1032 | === Maximum size === | ||
1033 | @@ -XXX,XX +XXX,XX @@ cluster_size: 8388608 | ||
1034 | |||
1035 | image: TEST_IMG | ||
1036 | file format: IMGFMT | ||
1037 | -virtual size: 64T (70368744177664 bytes) | ||
1038 | +virtual size: 64 TiB (70368744177664 bytes) | ||
1039 | cluster_size: 67108864 | ||
1040 | |||
1041 | === Invalid sizes === | ||
1042 | diff --git a/tests/qemu-iotests/233.out b/tests/qemu-iotests/233.out | ||
1043 | index XXXXXXX..XXXXXXX 100644 | ||
1044 | --- a/tests/qemu-iotests/233.out | ||
1045 | +++ b/tests/qemu-iotests/233.out | ||
1046 | @@ -XXX,XX +XXX,XX @@ server reported: Option 0x8 not permitted before TLS | ||
1047 | == check TLS works == | ||
1048 | image: nbd://127.0.0.1:PORT | ||
1049 | file format: nbd | ||
1050 | -virtual size: 64M (67108864 bytes) | ||
1051 | +virtual size: 64 MiB (67108864 bytes) | ||
1052 | disk size: unavailable | ||
1053 | image: nbd://127.0.0.1:PORT | ||
1054 | file format: nbd | ||
1055 | -virtual size: 64M (67108864 bytes) | ||
1056 | +virtual size: 64 MiB (67108864 bytes) | ||
1057 | disk size: unavailable | ||
1058 | exports available: 1 | ||
1059 | export: '' | ||
1060 | diff --git a/tests/qemu-iotests/237.out b/tests/qemu-iotests/237.out | ||
1061 | index XXXXXXX..XXXXXXX 100644 | ||
1062 | --- a/tests/qemu-iotests/237.out | ||
1063 | +++ b/tests/qemu-iotests/237.out | ||
1064 | @@ -XXX,XX +XXX,XX @@ | ||
1065 | |||
1066 | image: TEST_IMG | ||
1067 | file format: IMGFMT | ||
1068 | -virtual size: 5.0G (5368709120 bytes) | ||
1069 | +virtual size: 5 GiB (5368709120 bytes) | ||
1070 | cluster_size: 65536 | ||
1071 | Format specific information: | ||
1072 | cid: XXXXXXXXXX | ||
1073 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
1074 | |||
1075 | image: TEST_IMG | ||
1076 | file format: IMGFMT | ||
1077 | -virtual size: 64M (67108864 bytes) | ||
1078 | +virtual size: 64 MiB (67108864 bytes) | ||
1079 | cluster_size: 65536 | ||
1080 | Format specific information: | ||
1081 | cid: XXXXXXXXXX | ||
1082 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
1083 | |||
1084 | image: TEST_IMG | ||
1085 | file format: IMGFMT | ||
1086 | -virtual size: 32M (33554432 bytes) | ||
1087 | +virtual size: 32 MiB (33554432 bytes) | ||
1088 | cluster_size: 65536 | ||
1089 | Format specific information: | ||
1090 | cid: XXXXXXXXXX | ||
1091 | @@ -XXX,XX +XXX,XX @@ Job failed: List of extents contains unused extents | ||
1092 | |||
1093 | image: TEST_IMG | ||
1094 | file format: IMGFMT | ||
1095 | -virtual size: 512 (512 bytes) | ||
1096 | +virtual size: 512 B (512 bytes) | ||
1097 | Format specific information: | ||
1098 | cid: XXXXXXXXXX | ||
1099 | parent cid: XXXXXXXXXX | ||
1100 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
1101 | |||
1102 | image: TEST_IMG | ||
1103 | file format: IMGFMT | ||
1104 | -virtual size: 512 (512 bytes) | ||
1105 | +virtual size: 512 B (512 bytes) | ||
1106 | cluster_size: 65536 | ||
1107 | Format specific information: | ||
1108 | cid: XXXXXXXXXX | ||
1109 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
1110 | |||
1111 | image: TEST_IMG | ||
1112 | file format: IMGFMT | ||
1113 | -virtual size: 1.0G (1073741824 bytes) | ||
1114 | +virtual size: 1 GiB (1073741824 bytes) | ||
1115 | Format specific information: | ||
1116 | cid: XXXXXXXXXX | ||
1117 | parent cid: XXXXXXXXXX | ||
1118 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
1119 | |||
1120 | image: TEST_IMG | ||
1121 | file format: IMGFMT | ||
1122 | -virtual size: 1.0G (1073741824 bytes) | ||
1123 | +virtual size: 1 GiB (1073741824 bytes) | ||
1124 | cluster_size: 65536 | ||
1125 | Format specific information: | ||
1126 | cid: XXXXXXXXXX | ||
1127 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
1128 | |||
1129 | image: TEST_IMG | ||
1130 | file format: IMGFMT | ||
1131 | -virtual size: 2.0G (2147483648 bytes) | ||
1132 | +virtual size: 2 GiB (2147483648 bytes) | ||
1133 | Format specific information: | ||
1134 | cid: XXXXXXXXXX | ||
1135 | parent cid: XXXXXXXXXX | ||
1136 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
1137 | |||
1138 | image: TEST_IMG | ||
1139 | file format: IMGFMT | ||
1140 | -virtual size: 2.0G (2147483648 bytes) | ||
1141 | +virtual size: 2 GiB (2147483648 bytes) | ||
1142 | cluster_size: 65536 | ||
1143 | Format specific information: | ||
1144 | cid: XXXXXXXXXX | ||
1145 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
1146 | |||
1147 | image: TEST_IMG | ||
1148 | file format: IMGFMT | ||
1149 | -virtual size: 5.0G (5368709120 bytes) | ||
1150 | +virtual size: 5 GiB (5368709120 bytes) | ||
1151 | Format specific information: | ||
1152 | cid: XXXXXXXXXX | ||
1153 | parent cid: XXXXXXXXXX | ||
1154 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
1155 | |||
1156 | image: TEST_IMG | ||
1157 | file format: IMGFMT | ||
1158 | -virtual size: 5.0G (5368709120 bytes) | ||
1159 | +virtual size: 5 GiB (5368709120 bytes) | ||
1160 | cluster_size: 65536 | ||
1161 | Format specific information: | ||
1162 | cid: XXXXXXXXXX | ||
1163 | diff --git a/tests/qemu-iotests/242.out b/tests/qemu-iotests/242.out | ||
1164 | index XXXXXXX..XXXXXXX 100644 | ||
1165 | --- a/tests/qemu-iotests/242.out | ||
1166 | +++ b/tests/qemu-iotests/242.out | ||
1167 | @@ -XXX,XX +XXX,XX @@ qemu-img info dump: | ||
1168 | |||
1169 | image: TEST_IMG | ||
1170 | file format: IMGFMT | ||
1171 | -virtual size: 1.0M (1048576 bytes) | ||
1172 | +virtual size: 1 MiB (1048576 bytes) | ||
1173 | cluster_size: 65536 | ||
1174 | Format specific information: | ||
1175 | compat: 1.1 | ||
1176 | @@ -XXX,XX +XXX,XX @@ qemu-img info dump: | ||
1177 | |||
1178 | image: TEST_IMG | ||
1179 | file format: IMGFMT | ||
1180 | -virtual size: 1.0M (1048576 bytes) | ||
1181 | +virtual size: 1 MiB (1048576 bytes) | ||
1182 | cluster_size: 65536 | ||
1183 | Format specific information: | ||
1184 | compat: 1.1 | ||
1185 | @@ -XXX,XX +XXX,XX @@ qemu-img info dump: | ||
1186 | |||
1187 | image: TEST_IMG | ||
1188 | file format: IMGFMT | ||
1189 | -virtual size: 1.0M (1048576 bytes) | ||
1190 | +virtual size: 1 MiB (1048576 bytes) | ||
1191 | cluster_size: 65536 | ||
1192 | Format specific information: | ||
1193 | compat: 1.1 | ||
1194 | @@ -XXX,XX +XXX,XX @@ qemu-img info dump: | ||
1195 | |||
1196 | image: TEST_IMG | ||
1197 | file format: IMGFMT | ||
1198 | -virtual size: 1.0M (1048576 bytes) | ||
1199 | +virtual size: 1 MiB (1048576 bytes) | ||
1200 | cluster_size: 65536 | ||
1201 | Format specific information: | ||
1202 | compat: 1.1 | ||
1203 | @@ -XXX,XX +XXX,XX @@ Unset the unknown bitmap flag '0x4' in the bitmap directory entry: | ||
1204 | |||
1205 | image: TEST_IMG | ||
1206 | file format: IMGFMT | ||
1207 | -virtual size: 1.0M (1048576 bytes) | ||
1208 | +virtual size: 1 MiB (1048576 bytes) | ||
1209 | cluster_size: 65536 | ||
1210 | Format specific information: | ||
1211 | compat: 1.1 | ||
30 | -- | 1212 | -- |
31 | 2.13.6 | 1213 | 2.20.1 |
32 | 1214 | ||
33 | 1215 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Limiting the allocation to INT_MAX bytes isn't particularly clever | ||
2 | because it means that the final cluster will be a partial cluster which | ||
3 | will be completed through a COW operation. This results in unnecessary | ||
4 | data read and write requests which lead to an unwanted non-sparse | ||
5 | filesystem block for metadata preallocation. | ||
1 | 6 | ||
7 | Align the maximum allocation size down to the cluster size to avoid this | ||
8 | situation. | ||
9 | |||
10 | Cc: qemu-stable@nongnu.org | ||
11 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
12 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
13 | --- | ||
14 | block/qcow2.c | 2 +- | ||
15 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/block/qcow2.c b/block/qcow2.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/block/qcow2.c | ||
20 | +++ b/block/qcow2.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset, | ||
22 | bytes = new_length - offset; | ||
23 | |||
24 | while (bytes) { | ||
25 | - cur_bytes = MIN(bytes, INT_MAX); | ||
26 | + cur_bytes = MIN(bytes, QEMU_ALIGN_DOWN(INT_MAX, s->cluster_size)); | ||
27 | ret = qcow2_alloc_cluster_offset(bs, offset, &cur_bytes, | ||
28 | &host_offset, &meta); | ||
29 | if (ret < 0) { | ||
30 | -- | ||
31 | 2.20.1 | ||
32 | |||
33 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | We'll add a bdrv_co_truncate() call in the next patch which can return | ||
2 | an Error that we don't want to discard. So add an errp parameter to | ||
3 | preallocate_co(). | ||
1 | 4 | ||
5 | Cc: qemu-stable@nongnu.org | ||
6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
7 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
8 | --- | ||
9 | block/qcow2.c | 11 ++++++----- | ||
10 | 1 file changed, 6 insertions(+), 5 deletions(-) | ||
11 | |||
12 | diff --git a/block/qcow2.c b/block/qcow2.c | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/block/qcow2.c | ||
15 | +++ b/block/qcow2.c | ||
16 | @@ -XXX,XX +XXX,XX @@ static int qcow2_set_up_encryption(BlockDriverState *bs, | ||
17 | * Returns: 0 on success, -errno on failure. | ||
18 | */ | ||
19 | static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset, | ||
20 | - uint64_t new_length) | ||
21 | + uint64_t new_length, Error **errp) | ||
22 | { | ||
23 | BDRVQcow2State *s = bs->opaque; | ||
24 | uint64_t bytes; | ||
25 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset, | ||
26 | ret = qcow2_alloc_cluster_offset(bs, offset, &cur_bytes, | ||
27 | &host_offset, &meta); | ||
28 | if (ret < 0) { | ||
29 | + error_setg_errno(errp, -ret, "Allocating clusters failed"); | ||
30 | return ret; | ||
31 | } | ||
32 | |||
33 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset, | ||
34 | |||
35 | ret = qcow2_alloc_cluster_link_l2(bs, meta); | ||
36 | if (ret < 0) { | ||
37 | + error_setg_errno(errp, -ret, "Mapping clusters failed"); | ||
38 | qcow2_free_any_clusters(bs, meta->alloc_offset, | ||
39 | meta->nb_clusters, QCOW2_DISCARD_NEVER); | ||
40 | return ret; | ||
41 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset, | ||
42 | ret = bdrv_pwrite(s->data_file, (host_offset + cur_bytes) - 1, | ||
43 | &data, 1); | ||
44 | if (ret < 0) { | ||
45 | + error_setg_errno(errp, -ret, "Writing to EOF failed"); | ||
46 | return ret; | ||
47 | } | ||
48 | } | ||
49 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, | ||
50 | break; | ||
51 | |||
52 | case PREALLOC_MODE_METADATA: | ||
53 | - ret = preallocate_co(bs, old_length, offset); | ||
54 | + ret = preallocate_co(bs, old_length, offset, errp); | ||
55 | if (ret < 0) { | ||
56 | - error_setg_errno(errp, -ret, "Preallocation failed"); | ||
57 | goto fail; | ||
58 | } | ||
59 | break; | ||
60 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, | ||
61 | /* With a data file, preallocation means just allocating the metadata | ||
62 | * and forwarding the truncate request to the data file */ | ||
63 | if (has_data_file(bs)) { | ||
64 | - ret = preallocate_co(bs, old_length, offset); | ||
65 | + ret = preallocate_co(bs, old_length, offset, errp); | ||
66 | if (ret < 0) { | ||
67 | - error_setg_errno(errp, -ret, "Preallocation failed"); | ||
68 | goto fail; | ||
69 | } | ||
70 | break; | ||
71 | -- | ||
72 | 2.20.1 | ||
73 | |||
74 | diff view generated by jsdifflib |
1 | From: Cornelia Huck <cohuck@redhat.com> | 1 | preallocate_co() already gave the data file the full size without |
---|---|---|---|
2 | forwarding the requested preallocation mode to the protocol. When | ||
3 | bdrv_co_truncate() was called later with the preallocation mode, the | ||
4 | file didn't actually grow any more, so the data file stayed unallocated | ||
5 | even if full preallocation was requested. | ||
2 | 6 | ||
3 | This reverts commit a7aff6dd10b16b67e8b142d0c94c5d92c3fe88f6. | 7 | Pass the right preallocation mode to preallocate_co() and remove the |
8 | second bdrv_co_truncate() to fix this. As a side effect, the ugly | ||
9 | one-byte write in preallocate_co() is replaced with a truncate call, | ||
10 | now leaving the last block unallocated on the protocol level as it | ||
11 | should be. | ||
4 | 12 | ||
5 | Hold off removing this for one more QEMU release (current libvirt | 13 | Cc: qemu-stable@nongnu.org |
6 | release still uses it.) | 14 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
15 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
16 | --- | ||
17 | block/qcow2.c | 41 +++++++++++++++++++++++------------------ | ||
18 | 1 file changed, 23 insertions(+), 18 deletions(-) | ||
7 | 19 | ||
8 | Signed-off-by: Cornelia Huck <cohuck@redhat.com> | 20 | diff --git a/block/qcow2.c b/block/qcow2.c |
9 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
10 | --- | ||
11 | include/sysemu/blockdev.h | 1 + | ||
12 | blockdev.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++- | ||
13 | hw/block/block.c | 14 +++++++++ | ||
14 | tests/hd-geo-test.c | 37 ++++++++++++++++++----- | ||
15 | hmp-commands.hx | 1 + | ||
16 | qemu-doc.texi | 5 ++++ | ||
17 | qemu-options.hx | 7 ++++- | ||
18 | 7 files changed, 131 insertions(+), 9 deletions(-) | ||
19 | |||
20 | diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h | ||
21 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/include/sysemu/blockdev.h | 22 | --- a/block/qcow2.c |
23 | +++ b/include/sysemu/blockdev.h | 23 | +++ b/block/qcow2.c |
24 | @@ -XXX,XX +XXX,XX @@ struct DriveInfo { | 24 | @@ -XXX,XX +XXX,XX @@ static int qcow2_set_up_encryption(BlockDriverState *bs, |
25 | int auto_del; /* see blockdev_mark_auto_del() */ | 25 | * Returns: 0 on success, -errno on failure. |
26 | bool is_default; /* Added by default_drive() ? */ | 26 | */ |
27 | int media_cd; | 27 | static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset, |
28 | + int cyls, heads, secs, trans; | 28 | - uint64_t new_length, Error **errp) |
29 | QemuOpts *opts; | 29 | + uint64_t new_length, PreallocMode mode, |
30 | char *serial; | 30 | + Error **errp) |
31 | QTAILQ_ENTRY(DriveInfo) next; | 31 | { |
32 | diff --git a/blockdev.c b/blockdev.c | 32 | BDRVQcow2State *s = bs->opaque; |
33 | index XXXXXXX..XXXXXXX 100644 | 33 | uint64_t bytes; |
34 | --- a/blockdev.c | 34 | uint64_t host_offset = 0; |
35 | +++ b/blockdev.c | 35 | + int64_t file_length; |
36 | @@ -XXX,XX +XXX,XX @@ QemuOptsList qemu_legacy_drive_opts = { | 36 | unsigned int cur_bytes; |
37 | .type = QEMU_OPT_STRING, | 37 | int ret; |
38 | .help = "interface (ide, scsi, sd, mtd, floppy, pflash, virtio)", | 38 | QCowL2Meta *meta; |
39 | },{ | 39 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset, |
40 | + .name = "cyls", | 40 | * all of the allocated clusters (otherwise we get failing reads after |
41 | + .type = QEMU_OPT_NUMBER, | 41 | * EOF). Extend the image to the last allocated sector. |
42 | + .help = "number of cylinders (ide disk geometry)", | 42 | */ |
43 | + },{ | 43 | - if (host_offset != 0) { |
44 | + .name = "heads", | 44 | - uint8_t data = 0; |
45 | + .type = QEMU_OPT_NUMBER, | 45 | - ret = bdrv_pwrite(s->data_file, (host_offset + cur_bytes) - 1, |
46 | + .help = "number of heads (ide disk geometry)", | 46 | - &data, 1); |
47 | + },{ | 47 | + file_length = bdrv_getlength(s->data_file->bs); |
48 | + .name = "secs", | 48 | + if (file_length < 0) { |
49 | + .type = QEMU_OPT_NUMBER, | 49 | + error_setg_errno(errp, -file_length, "Could not get file size"); |
50 | + .help = "number of sectors (ide disk geometry)", | 50 | + return file_length; |
51 | + },{ | ||
52 | + .name = "trans", | ||
53 | + .type = QEMU_OPT_STRING, | ||
54 | + .help = "chs translation (auto, lba, none)", | ||
55 | + },{ | ||
56 | .name = "addr", | ||
57 | .type = QEMU_OPT_STRING, | ||
58 | .help = "pci address (virtio only)", | ||
59 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
60 | QemuOpts *legacy_opts; | ||
61 | DriveMediaType media = MEDIA_DISK; | ||
62 | BlockInterfaceType type; | ||
63 | + int cyls, heads, secs, translation; | ||
64 | int max_devs, bus_id, unit_id, index; | ||
65 | const char *devaddr; | ||
66 | const char *werror, *rerror; | ||
67 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
68 | Error *local_err = NULL; | ||
69 | int i; | ||
70 | const char *deprecated[] = { | ||
71 | - "serial", "addr" | ||
72 | + "serial", "trans", "secs", "heads", "cyls", "addr" | ||
73 | }; | ||
74 | |||
75 | /* Change legacy command line options into QMP ones */ | ||
76 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
77 | type = block_default_type; | ||
78 | } | ||
79 | |||
80 | + /* Geometry */ | ||
81 | + cyls = qemu_opt_get_number(legacy_opts, "cyls", 0); | ||
82 | + heads = qemu_opt_get_number(legacy_opts, "heads", 0); | ||
83 | + secs = qemu_opt_get_number(legacy_opts, "secs", 0); | ||
84 | + | ||
85 | + if (cyls || heads || secs) { | ||
86 | + if (cyls < 1) { | ||
87 | + error_report("invalid physical cyls number"); | ||
88 | + goto fail; | ||
89 | + } | ||
90 | + if (heads < 1) { | ||
91 | + error_report("invalid physical heads number"); | ||
92 | + goto fail; | ||
93 | + } | ||
94 | + if (secs < 1) { | ||
95 | + error_report("invalid physical secs number"); | ||
96 | + goto fail; | ||
97 | + } | ||
98 | + } | 51 | + } |
99 | + | 52 | + |
100 | + translation = BIOS_ATA_TRANSLATION_AUTO; | 53 | + if (host_offset + cur_bytes > file_length) { |
101 | + value = qemu_opt_get(legacy_opts, "trans"); | 54 | + if (mode == PREALLOC_MODE_METADATA) { |
102 | + if (value != NULL) { | 55 | + mode = PREALLOC_MODE_OFF; |
103 | + if (!cyls) { | ||
104 | + error_report("'%s' trans must be used with cyls, heads and secs", | ||
105 | + value); | ||
106 | + goto fail; | ||
107 | + } | 56 | + } |
108 | + if (!strcmp(value, "none")) { | 57 | + ret = bdrv_co_truncate(s->data_file, host_offset + cur_bytes, mode, |
109 | + translation = BIOS_ATA_TRANSLATION_NONE; | 58 | + errp); |
110 | + } else if (!strcmp(value, "lba")) { | 59 | if (ret < 0) { |
111 | + translation = BIOS_ATA_TRANSLATION_LBA; | 60 | - error_setg_errno(errp, -ret, "Writing to EOF failed"); |
112 | + } else if (!strcmp(value, "large")) { | 61 | return ret; |
113 | + translation = BIOS_ATA_TRANSLATION_LARGE; | 62 | } |
114 | + } else if (!strcmp(value, "rechs")) { | 63 | } |
115 | + translation = BIOS_ATA_TRANSLATION_RECHS; | 64 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, |
116 | + } else if (!strcmp(value, "auto")) { | 65 | |
117 | + translation = BIOS_ATA_TRANSLATION_AUTO; | 66 | switch (prealloc) { |
118 | + } else { | 67 | case PREALLOC_MODE_OFF: |
119 | + error_report("'%s' invalid translation type", value); | 68 | + if (has_data_file(bs)) { |
120 | + goto fail; | 69 | + ret = bdrv_co_truncate(s->data_file, offset, prealloc, errp); |
121 | + } | 70 | + if (ret < 0) { |
122 | + } | 71 | + goto fail; |
123 | + | ||
124 | + if (media == MEDIA_CDROM) { | ||
125 | + if (cyls || secs || heads) { | ||
126 | + error_report("CHS can't be set with media=cdrom"); | ||
127 | + goto fail; | ||
128 | + } | ||
129 | + } | ||
130 | + | ||
131 | /* Device address specified by bus/unit or index. | ||
132 | * If none was specified, try to find the first free one. */ | ||
133 | bus_id = qemu_opt_get_number(legacy_opts, "bus", 0); | ||
134 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
135 | dinfo = g_malloc0(sizeof(*dinfo)); | ||
136 | dinfo->opts = all_opts; | ||
137 | |||
138 | + dinfo->cyls = cyls; | ||
139 | + dinfo->heads = heads; | ||
140 | + dinfo->secs = secs; | ||
141 | + dinfo->trans = translation; | ||
142 | + | ||
143 | dinfo->type = type; | ||
144 | dinfo->bus = bus_id; | ||
145 | dinfo->unit = unit_id; | ||
146 | diff --git a/hw/block/block.c b/hw/block/block.c | ||
147 | index XXXXXXX..XXXXXXX 100644 | ||
148 | --- a/hw/block/block.c | ||
149 | +++ b/hw/block/block.c | ||
150 | @@ -XXX,XX +XXX,XX @@ bool blkconf_geometry(BlockConf *conf, int *ptrans, | ||
151 | unsigned cyls_max, unsigned heads_max, unsigned secs_max, | ||
152 | Error **errp) | ||
153 | { | ||
154 | + DriveInfo *dinfo; | ||
155 | + | ||
156 | + if (!conf->cyls && !conf->heads && !conf->secs) { | ||
157 | + /* try to fall back to value set with legacy -drive cyls=... */ | ||
158 | + dinfo = blk_legacy_dinfo(conf->blk); | ||
159 | + if (dinfo) { | ||
160 | + conf->cyls = dinfo->cyls; | ||
161 | + conf->heads = dinfo->heads; | ||
162 | + conf->secs = dinfo->secs; | ||
163 | + if (ptrans) { | ||
164 | + *ptrans = dinfo->trans; | ||
165 | + } | 72 | + } |
166 | + } | 73 | + } |
167 | + } | 74 | break; |
168 | if (!conf->cyls && !conf->heads && !conf->secs) { | 75 | |
169 | hd_geometry_guess(conf->blk, | 76 | case PREALLOC_MODE_METADATA: |
170 | &conf->cyls, &conf->heads, &conf->secs, | 77 | - ret = preallocate_co(bs, old_length, offset, errp); |
171 | diff --git a/tests/hd-geo-test.c b/tests/hd-geo-test.c | 78 | + ret = preallocate_co(bs, old_length, offset, prealloc, errp); |
172 | index XXXXXXX..XXXXXXX 100644 | 79 | if (ret < 0) { |
173 | --- a/tests/hd-geo-test.c | 80 | goto fail; |
174 | +++ b/tests/hd-geo-test.c | 81 | } |
175 | @@ -XXX,XX +XXX,XX @@ static void setup_mbr(int img_idx, MBRcontents mbr) | 82 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, |
176 | 83 | /* With a data file, preallocation means just allocating the metadata | |
177 | static int setup_ide(int argc, char *argv[], int argv_sz, | 84 | * and forwarding the truncate request to the data file */ |
178 | int ide_idx, const char *dev, int img_idx, | 85 | if (has_data_file(bs)) { |
179 | - MBRcontents mbr) | 86 | - ret = preallocate_co(bs, old_length, offset, errp); |
180 | + MBRcontents mbr, const char *opts) | 87 | + ret = preallocate_co(bs, old_length, offset, prealloc, errp); |
181 | { | 88 | if (ret < 0) { |
182 | char *s1, *s2, *s3; | 89 | goto fail; |
183 | 90 | } | |
184 | @@ -XXX,XX +XXX,XX @@ static int setup_ide(int argc, char *argv[], int argv_sz, | 91 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, |
185 | s3 = g_strdup(",media=cdrom"); | 92 | |
186 | } | 93 | bs->total_sectors = offset / BDRV_SECTOR_SIZE; |
187 | argc = append_arg(argc, argv, argv_sz, | 94 | |
188 | - g_strdup_printf("%s%s%s", s1, s2, s3)); | 95 | - if (has_data_file(bs)) { |
189 | + g_strdup_printf("%s%s%s%s", s1, s2, s3, opts)); | 96 | - if (prealloc == PREALLOC_MODE_METADATA) { |
190 | g_free(s1); | 97 | - prealloc = PREALLOC_MODE_OFF; |
191 | g_free(s2); | 98 | - } |
192 | g_free(s3); | 99 | - ret = bdrv_co_truncate(s->data_file, offset, prealloc, errp); |
193 | @@ -XXX,XX +XXX,XX @@ static void test_ide_mbr(bool use_device, MBRcontents mbr) | 100 | - if (ret < 0) { |
194 | for (i = 0; i < backend_last; i++) { | 101 | - goto fail; |
195 | cur_ide[i] = &hd_chst[i][mbr]; | 102 | - } |
196 | dev = use_device ? (is_hd(cur_ide[i]) ? "ide-hd" : "ide-cd") : NULL; | 103 | - } |
197 | - argc = setup_ide(argc, argv, ARGV_SIZE, i, dev, i, mbr); | 104 | - |
198 | + argc = setup_ide(argc, argv, ARGV_SIZE, i, dev, i, mbr, ""); | 105 | /* write updated header.size */ |
199 | } | 106 | offset = cpu_to_be64(offset); |
200 | args = g_strjoinv(" ", argv); | 107 | ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, size), |
201 | qtest_start(args); | ||
202 | @@ -XXX,XX +XXX,XX @@ static void test_ide_drive_user(const char *dev, bool trans) | ||
203 | const CHST expected_chst = { secs / (4 * 32) , 4, 32, trans }; | ||
204 | |||
205 | argc = setup_common(argv, ARGV_SIZE); | ||
206 | - opts = g_strdup_printf("%s,%scyls=%d,heads=%d,secs=%d", | ||
207 | - dev, trans ? "bios-chs-trans=lba," : "", | ||
208 | + opts = g_strdup_printf("%s,%s%scyls=%d,heads=%d,secs=%d", | ||
209 | + dev ?: "", | ||
210 | + trans && dev ? "bios-chs-" : "", | ||
211 | + trans ? "trans=lba," : "", | ||
212 | expected_chst.cyls, expected_chst.heads, | ||
213 | expected_chst.secs); | ||
214 | cur_ide[0] = &expected_chst; | ||
215 | - argc = setup_ide(argc, argv, ARGV_SIZE, 0, opts, backend_small, mbr_chs); | ||
216 | + argc = setup_ide(argc, argv, ARGV_SIZE, | ||
217 | + 0, dev ? opts : NULL, backend_small, mbr_chs, | ||
218 | + dev ? "" : opts); | ||
219 | g_free(opts); | ||
220 | args = g_strjoinv(" ", argv); | ||
221 | qtest_start(args); | ||
222 | @@ -XXX,XX +XXX,XX @@ static void test_ide_drive_user(const char *dev, bool trans) | ||
223 | } | ||
224 | |||
225 | /* | ||
226 | + * Test case: IDE device (if=ide) with explicit CHS | ||
227 | + */ | ||
228 | +static void test_ide_drive_user_chs(void) | ||
229 | +{ | ||
230 | + test_ide_drive_user(NULL, false); | ||
231 | +} | ||
232 | + | ||
233 | +/* | ||
234 | + * Test case: IDE device (if=ide) with explicit CHS and translation | ||
235 | + */ | ||
236 | +static void test_ide_drive_user_chst(void) | ||
237 | +{ | ||
238 | + test_ide_drive_user(NULL, true); | ||
239 | +} | ||
240 | + | ||
241 | +/* | ||
242 | * Test case: IDE device (if=none) with explicit CHS | ||
243 | */ | ||
244 | static void test_ide_device_user_chs(void) | ||
245 | @@ -XXX,XX +XXX,XX @@ static void test_ide_drive_cd_0(void) | ||
246 | for (i = 0; i <= backend_empty; i++) { | ||
247 | ide_idx = backend_empty - i; | ||
248 | cur_ide[ide_idx] = &hd_chst[i][mbr_blank]; | ||
249 | - argc = setup_ide(argc, argv, ARGV_SIZE, ide_idx, NULL, i, mbr_blank); | ||
250 | + argc = setup_ide(argc, argv, ARGV_SIZE, | ||
251 | + ide_idx, NULL, i, mbr_blank, ""); | ||
252 | } | ||
253 | args = g_strjoinv(" ", argv); | ||
254 | qtest_start(args); | ||
255 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) | ||
256 | qtest_add_func("hd-geo/ide/drive/mbr/blank", test_ide_drive_mbr_blank); | ||
257 | qtest_add_func("hd-geo/ide/drive/mbr/lba", test_ide_drive_mbr_lba); | ||
258 | qtest_add_func("hd-geo/ide/drive/mbr/chs", test_ide_drive_mbr_chs); | ||
259 | + qtest_add_func("hd-geo/ide/drive/user/chs", test_ide_drive_user_chs); | ||
260 | + qtest_add_func("hd-geo/ide/drive/user/chst", test_ide_drive_user_chst); | ||
261 | qtest_add_func("hd-geo/ide/drive/cd_0", test_ide_drive_cd_0); | ||
262 | qtest_add_func("hd-geo/ide/device/mbr/blank", test_ide_device_mbr_blank); | ||
263 | qtest_add_func("hd-geo/ide/device/mbr/lba", test_ide_device_mbr_lba); | ||
264 | diff --git a/hmp-commands.hx b/hmp-commands.hx | ||
265 | index XXXXXXX..XXXXXXX 100644 | ||
266 | --- a/hmp-commands.hx | ||
267 | +++ b/hmp-commands.hx | ||
268 | @@ -XXX,XX +XXX,XX @@ ETEXI | ||
269 | .params = "[-n] [[<domain>:]<bus>:]<slot>\n" | ||
270 | "[file=file][,if=type][,bus=n]\n" | ||
271 | "[,unit=m][,media=d][,index=i]\n" | ||
272 | + "[,cyls=c,heads=h,secs=s[,trans=t]]\n" | ||
273 | "[,snapshot=on|off][,cache=on|off]\n" | ||
274 | "[,readonly=on|off][,copy-on-read=on|off]", | ||
275 | .help = "add drive to PCI storage controller", | ||
276 | diff --git a/qemu-doc.texi b/qemu-doc.texi | ||
277 | index XXXXXXX..XXXXXXX 100644 | ||
278 | --- a/qemu-doc.texi | ||
279 | +++ b/qemu-doc.texi | ||
280 | @@ -XXX,XX +XXX,XX @@ with ``-device ...,netdev=x''), or ``-nic user,smb=/some/dir'' | ||
281 | (for embedded NICs). The new syntax allows different settings to be | ||
282 | provided per NIC. | ||
283 | |||
284 | +@subsection -drive cyls=...,heads=...,secs=...,trans=... (since 2.10.0) | ||
285 | + | ||
286 | +The drive geometry arguments are replaced by the the geometry arguments | ||
287 | +that can be specified with the ``-device'' parameter. | ||
288 | + | ||
289 | @subsection -drive serial=... (since 2.10.0) | ||
290 | |||
291 | The drive serial argument is replaced by the the serial argument | ||
292 | diff --git a/qemu-options.hx b/qemu-options.hx | ||
293 | index XXXXXXX..XXXXXXX 100644 | ||
294 | --- a/qemu-options.hx | ||
295 | +++ b/qemu-options.hx | ||
296 | @@ -XXX,XX +XXX,XX @@ ETEXI | ||
297 | |||
298 | DEF("drive", HAS_ARG, QEMU_OPTION_drive, | ||
299 | "-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]\n" | ||
300 | + " [,cyls=c,heads=h,secs=s[,trans=t]][,snapshot=on|off]\n" | ||
301 | " [,cache=writethrough|writeback|none|directsync|unsafe][,format=f]\n" | ||
302 | - " [,snapshot=on|off][,serial=s][,addr=A][,rerror=ignore|stop|report]\n" | ||
303 | + " [,serial=s][,addr=A][,rerror=ignore|stop|report]\n" | ||
304 | " [,werror=ignore|stop|report|enospc][,id=name][,aio=threads|native]\n" | ||
305 | " [,readonly=on|off][,copy-on-read=on|off]\n" | ||
306 | " [,discard=ignore|unmap][,detect-zeroes=on|off|unmap]\n" | ||
307 | @@ -XXX,XX +XXX,XX @@ This option defines where is connected the drive by using an index in the list | ||
308 | of available connectors of a given interface type. | ||
309 | @item media=@var{media} | ||
310 | This option defines the type of the media: disk or cdrom. | ||
311 | +@item cyls=@var{c},heads=@var{h},secs=@var{s}[,trans=@var{t}] | ||
312 | +Force disk physical geometry and the optional BIOS translation (trans=none or | ||
313 | +lba). These parameters are deprecated, use the corresponding parameters | ||
314 | +of @code{-device} instead. | ||
315 | @item snapshot=@var{snapshot} | ||
316 | @var{snapshot} is "on" or "off" and controls snapshot mode for the given drive | ||
317 | (see @option{-snapshot}). | ||
318 | -- | 108 | -- |
319 | 2.13.6 | 109 | 2.20.1 |
320 | 110 | ||
321 | 111 | diff view generated by jsdifflib |
1 | From: Fam Zheng <famz@redhat.com> | 1 | From: Max Reitz <mreitz@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | A few trace points that can help reveal what is happening in a copy | 3 | In the "amend" section of 082, we perform a single "convert" test |
4 | offloading I/O path. | 4 | (namely "convert -o help"). That does not make sense, especially |
5 | because we have done exactly that "convert" test earlier in 082 already. | ||
5 | 6 | ||
6 | Signed-off-by: Fam Zheng <famz@redhat.com> | 7 | Replacing "convert" by "amend" yields an error, which is correct because |
8 | there is no point in "amend" having a default format. The user has to | ||
9 | either specify the format, or give a file for qemu-img to probe. | ||
10 | |||
11 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
12 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
7 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 13 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
8 | --- | 14 | --- |
9 | block/file-posix.c | 2 ++ | 15 | tests/qemu-iotests/082 | 5 ++++- |
10 | block/io.c | 4 ++++ | 16 | tests/qemu-iotests/082.out | 5 ++--- |
11 | block/iscsi.c | 3 +++ | 17 | 2 files changed, 6 insertions(+), 4 deletions(-) |
12 | block/trace-events | 6 ++++++ | ||
13 | 4 files changed, 15 insertions(+) | ||
14 | 18 | ||
15 | diff --git a/block/file-posix.c b/block/file-posix.c | 19 | diff --git a/tests/qemu-iotests/082 b/tests/qemu-iotests/082 |
20 | index XXXXXXX..XXXXXXX 100755 | ||
21 | --- a/tests/qemu-iotests/082 | ||
22 | +++ b/tests/qemu-iotests/082 | ||
23 | @@ -XXX,XX +XXX,XX @@ run_qemu_img amend -f $IMGFMT -o backing_file="$TEST_IMG" -o ,, -o help "$TEST_I | ||
24 | |||
25 | # Leave out everything that isn't needed | ||
26 | run_qemu_img amend -f $IMGFMT -o help | ||
27 | -run_qemu_img convert -o help | ||
28 | + | ||
29 | +# amend requires specifying either a format explicitly, or a file | ||
30 | +# which it can probe | ||
31 | +run_qemu_img amend -o help | ||
32 | |||
33 | # Try help option for a format that does not support amendment | ||
34 | run_qemu_img amend -f bochs -o help | ||
35 | diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out | ||
16 | index XXXXXXX..XXXXXXX 100644 | 36 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/block/file-posix.c | 37 | --- a/tests/qemu-iotests/082.out |
18 | +++ b/block/file-posix.c | 38 | +++ b/tests/qemu-iotests/082.out |
19 | @@ -XXX,XX +XXX,XX @@ static ssize_t handle_aiocb_copy_range(RawPosixAIOData *aiocb) | 39 | @@ -XXX,XX +XXX,XX @@ Creation options for 'qcow2': |
20 | ssize_t ret = copy_file_range(aiocb->aio_fildes, &in_off, | 40 | |
21 | aiocb->aio_fd2, &out_off, | 41 | Note that not all of these options may be amendable. |
22 | bytes, 0); | 42 | |
23 | + trace_file_copy_file_range(aiocb->bs, aiocb->aio_fildes, in_off, | 43 | -Testing: convert -o help |
24 | + aiocb->aio_fd2, out_off, bytes, 0, ret); | 44 | -Supported options: |
25 | if (ret == 0) { | 45 | - size=<size> - Virtual disk size |
26 | /* No progress (e.g. when beyond EOF), let the caller fall back to | 46 | +Testing: amend -o help |
27 | * buffer I/O. */ | 47 | +qemu-img: Expecting one image file name |
28 | diff --git a/block/io.c b/block/io.c | 48 | |
29 | index XXXXXXX..XXXXXXX 100644 | 49 | Testing: amend -f bochs -o help |
30 | --- a/block/io.c | 50 | qemu-img: Format driver 'bochs' does not support option amendment |
31 | +++ b/block/io.c | ||
32 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_copy_range_from(BdrvChild *src, uint64_t src_offset, | ||
33 | BdrvRequestFlags read_flags, | ||
34 | BdrvRequestFlags write_flags) | ||
35 | { | ||
36 | + trace_bdrv_co_copy_range_from(src, src_offset, dst, dst_offset, bytes, | ||
37 | + read_flags, write_flags); | ||
38 | return bdrv_co_copy_range_internal(src, src_offset, dst, dst_offset, | ||
39 | bytes, read_flags, write_flags, true); | ||
40 | } | ||
41 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_copy_range_to(BdrvChild *src, uint64_t src_offset, | ||
42 | BdrvRequestFlags read_flags, | ||
43 | BdrvRequestFlags write_flags) | ||
44 | { | ||
45 | + trace_bdrv_co_copy_range_to(src, src_offset, dst, dst_offset, bytes, | ||
46 | + read_flags, write_flags); | ||
47 | return bdrv_co_copy_range_internal(src, src_offset, dst, dst_offset, | ||
48 | bytes, read_flags, write_flags, false); | ||
49 | } | ||
50 | diff --git a/block/iscsi.c b/block/iscsi.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/block/iscsi.c | ||
53 | +++ b/block/iscsi.c | ||
54 | @@ -XXX,XX +XXX,XX @@ | ||
55 | #include "qapi/qmp/qstring.h" | ||
56 | #include "crypto/secret.h" | ||
57 | #include "scsi/utils.h" | ||
58 | +#include "trace.h" | ||
59 | |||
60 | /* Conflict between scsi/utils.h and libiscsi! :( */ | ||
61 | #define SCSI_XFER_NONE ISCSI_XFER_NONE | ||
62 | @@ -XXX,XX +XXX,XX @@ retry: | ||
63 | } | ||
64 | |||
65 | out_unlock: | ||
66 | + | ||
67 | + trace_iscsi_xcopy(src_lun, src_offset, dst_lun, dst_offset, bytes, r); | ||
68 | g_free(iscsi_task.task); | ||
69 | qemu_mutex_unlock(&dst_lun->mutex); | ||
70 | g_free(iscsi_task.err_str); | ||
71 | diff --git a/block/trace-events b/block/trace-events | ||
72 | index XXXXXXX..XXXXXXX 100644 | ||
73 | --- a/block/trace-events | ||
74 | +++ b/block/trace-events | ||
75 | @@ -XXX,XX +XXX,XX @@ bdrv_co_preadv(void *bs, int64_t offset, int64_t nbytes, unsigned int flags) "bs | ||
76 | bdrv_co_pwritev(void *bs, int64_t offset, int64_t nbytes, unsigned int flags) "bs %p offset %"PRId64" nbytes %"PRId64" flags 0x%x" | ||
77 | bdrv_co_pwrite_zeroes(void *bs, int64_t offset, int count, int flags) "bs %p offset %"PRId64" count %d flags 0x%x" | ||
78 | bdrv_co_do_copy_on_readv(void *bs, int64_t offset, unsigned int bytes, int64_t cluster_offset, int64_t cluster_bytes) "bs %p offset %"PRId64" bytes %u cluster_offset %"PRId64" cluster_bytes %"PRId64 | ||
79 | +bdrv_co_copy_range_from(void *src, uint64_t src_offset, void *dst, uint64_t dst_offset, uint64_t bytes, int read_flags, int write_flags) "src %p offset %"PRIu64" dst %p offset %"PRIu64" bytes %"PRIu64" rw flags 0x%x 0x%x" | ||
80 | +bdrv_co_copy_range_to(void *src, uint64_t src_offset, void *dst, uint64_t dst_offset, uint64_t bytes, int read_flags, int write_flags) "src %p offset %"PRIu64" dst %p offset %"PRIu64" bytes %"PRIu64" rw flags 0x%x 0x%x" | ||
81 | |||
82 | # block/stream.c | ||
83 | stream_one_iteration(void *s, int64_t offset, uint64_t bytes, int is_allocated) "s %p offset %" PRId64 " bytes %" PRIu64 " is_allocated %d" | ||
84 | @@ -XXX,XX +XXX,XX @@ qmp_block_stream(void *bs, void *job) "bs %p job %p" | ||
85 | # block/file-posix.c | ||
86 | file_paio_submit_co(int64_t offset, int count, int type) "offset %"PRId64" count %d type %d" | ||
87 | file_paio_submit(void *acb, void *opaque, int64_t offset, int count, int type) "acb %p opaque %p offset %"PRId64" count %d type %d" | ||
88 | +file_copy_file_range(void *bs, int src, int64_t src_off, int dst, int64_t dst_off, int64_t bytes, int flags, int64_t ret) "bs %p src_fd %d offset %"PRIu64" dst_fd %d offset %"PRIu64" bytes %"PRIu64" flags %d ret %"PRId64 | ||
89 | |||
90 | # block/qcow2.c | ||
91 | qcow2_writev_start_req(void *co, int64_t offset, int bytes) "co %p offset 0x%" PRIx64 " bytes %d" | ||
92 | @@ -XXX,XX +XXX,XX @@ nvme_free_req_queue_wait(void *q) "q %p" | ||
93 | nvme_cmd_map_qiov(void *s, void *cmd, void *req, void *qiov, int entries) "s %p cmd %p req %p qiov %p entries %d" | ||
94 | nvme_cmd_map_qiov_pages(void *s, int i, uint64_t page) "s %p page[%d] 0x%"PRIx64 | ||
95 | nvme_cmd_map_qiov_iov(void *s, int i, void *page, int pages) "s %p iov[%d] %p pages %d" | ||
96 | + | ||
97 | +# block/iscsi.c | ||
98 | +iscsi_xcopy(void *src_lun, uint64_t src_off, void *dst_lun, uint64_t dst_off, uint64_t bytes, int ret) "src_lun %p offset %"PRIu64" dst_lun %p offset %"PRIu64" bytes %"PRIu64" ret %d" | ||
99 | -- | 51 | -- |
100 | 2.13.6 | 52 | 2.20.1 |
101 | 53 | ||
102 | 54 | diff view generated by jsdifflib |
1 | From: Cornelia Huck <cohuck@redhat.com> | 1 | From: Max Reitz <mreitz@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | This reverts commit 6266e900b8083945cb766b45c124fb3c42932cb3. | 3 | qemu-img create allows giving just a format and "-o help" to get a list |
4 | of the options supported by that format. Users may not realize that the | ||
5 | protocol level may offer even more options, which they only get to see | ||
6 | by specifying a filename. | ||
4 | 7 | ||
5 | Some deprecated -drive options were still in use by libvirt, only | 8 | This patch adds a note to hint at that fact. |
6 | fixed with libvirt commit b340c6c614 ("qemu: format serial and geometry | ||
7 | on frontend disk device"), which is not yet in any released version | ||
8 | of libvirt. | ||
9 | 9 | ||
10 | So let's hold off removing the deprecated options for one more QEMU | 10 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
11 | release. | 11 | Reviewed-by: John Snow <jsnow@redhat.com> |
12 | |||
13 | Reported-by: Christian Borntraeger <borntraeger@de.ibm.com> | ||
14 | Signed-off-by: Cornelia Huck <cohuck@redhat.com> | ||
15 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 12 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
16 | --- | 13 | --- |
17 | blockdev.c | 12 ++++++++++++ | 14 | qemu-img.c | 13 ++++++++++++- |
18 | 1 file changed, 12 insertions(+) | 15 | tests/qemu-iotests/082.out | 20 ++++++++++++++++---- |
16 | 2 files changed, 28 insertions(+), 5 deletions(-) | ||
19 | 17 | ||
20 | diff --git a/blockdev.c b/blockdev.c | 18 | diff --git a/qemu-img.c b/qemu-img.c |
21 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/blockdev.c | 20 | --- a/qemu-img.c |
23 | +++ b/blockdev.c | 21 | +++ b/qemu-img.c |
24 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | 22 | @@ -XXX,XX +XXX,XX @@ static int print_block_option_help(const char *filename, const char *fmt) |
25 | const char *filename; | 23 | create_opts = qemu_opts_append(create_opts, proto_drv->create_opts); |
26 | Error *local_err = NULL; | ||
27 | int i; | ||
28 | + const char *deprecated[] = { | ||
29 | + }; | ||
30 | |||
31 | /* Change legacy command line options into QMP ones */ | ||
32 | static const struct { | ||
33 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
34 | goto fail; | ||
35 | } | 24 | } |
36 | 25 | ||
37 | + /* Other deprecated options */ | 26 | - printf("Supported options:\n"); |
38 | + if (!qtest_enabled()) { | 27 | + if (filename) { |
39 | + for (i = 0; i < ARRAY_SIZE(deprecated); i++) { | 28 | + printf("Supported options:\n"); |
40 | + if (qemu_opt_get(legacy_opts, deprecated[i]) != NULL) { | 29 | + } else { |
41 | + error_report("'%s' is deprecated, please use the corresponding " | 30 | + printf("Supported %s options:\n", fmt); |
42 | + "option of '-device' instead", deprecated[i]); | 31 | + } |
43 | + } | 32 | qemu_opts_print_help(create_opts, false); |
44 | + } | 33 | qemu_opts_free(create_opts); |
34 | + | ||
35 | + if (!filename) { | ||
36 | + printf("\n" | ||
37 | + "The protocol level may support further options.\n" | ||
38 | + "Specify the target filename to include those options.\n"); | ||
45 | + } | 39 | + } |
46 | + | 40 | + |
47 | /* Media type */ | 41 | return 0; |
48 | value = qemu_opt_get(legacy_opts, "media"); | 42 | } |
49 | if (value) { | 43 | |
44 | diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/tests/qemu-iotests/082.out | ||
47 | +++ b/tests/qemu-iotests/082.out | ||
48 | @@ -XXX,XX +XXX,XX @@ Testing: create -f qcow2 -o backing_file=TEST_DIR/t.qcow2 -o ,, -o help TEST_DIR | ||
49 | qemu-img: Invalid option list: ,, | ||
50 | |||
51 | Testing: create -f qcow2 -o help | ||
52 | -Supported options: | ||
53 | +Supported qcow2 options: | ||
54 | backing_file=<str> - File name of a base image | ||
55 | backing_fmt=<str> - Image format of the base image | ||
56 | cluster_size=<size> - qcow2 cluster size | ||
57 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
58 | refcount_bits=<num> - Width of a reference count entry in bits | ||
59 | size=<size> - Virtual disk size | ||
60 | |||
61 | +The protocol level may support further options. | ||
62 | +Specify the target filename to include those options. | ||
63 | + | ||
64 | Testing: create -o help | ||
65 | -Supported options: | ||
66 | +Supported raw options: | ||
67 | size=<size> - Virtual disk size | ||
68 | |||
69 | +The protocol level may support further options. | ||
70 | +Specify the target filename to include those options. | ||
71 | + | ||
72 | Testing: create -f bochs -o help | ||
73 | qemu-img: Format driver 'bochs' does not support image creation | ||
74 | |||
75 | @@ -XXX,XX +XXX,XX @@ Testing: convert -O qcow2 -o backing_file=TEST_DIR/t.qcow2 -o ,, -o help TEST_DI | ||
76 | qemu-img: Invalid option list: ,, | ||
77 | |||
78 | Testing: convert -O qcow2 -o help | ||
79 | -Supported options: | ||
80 | +Supported qcow2 options: | ||
81 | backing_file=<str> - File name of a base image | ||
82 | backing_fmt=<str> - Image format of the base image | ||
83 | cluster_size=<size> - qcow2 cluster size | ||
84 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
85 | refcount_bits=<num> - Width of a reference count entry in bits | ||
86 | size=<size> - Virtual disk size | ||
87 | |||
88 | +The protocol level may support further options. | ||
89 | +Specify the target filename to include those options. | ||
90 | + | ||
91 | Testing: convert -o help | ||
92 | -Supported options: | ||
93 | +Supported raw options: | ||
94 | size=<size> - Virtual disk size | ||
95 | |||
96 | +The protocol level may support further options. | ||
97 | +Specify the target filename to include those options. | ||
98 | + | ||
99 | Testing: convert -O bochs -o help | ||
100 | qemu-img: Format driver 'bochs' does not support image creation | ||
101 | |||
50 | -- | 102 | -- |
51 | 2.13.6 | 103 | 2.20.1 |
52 | 104 | ||
53 | 105 | diff view generated by jsdifflib |
1 | From: Fam Zheng <famz@redhat.com> | 1 | make_completely_empty() is an optimisated path for bdrv_make_empty() |
---|---|---|---|
2 | where completely new metadata is created inside the image file instead | ||
3 | of going through all clusters and discarding them. For an external data | ||
4 | file, however, we actually need to do discard operations on the data | ||
5 | file; just overwriting the qcow2 file doesn't get rid of the data. | ||
2 | 6 | ||
3 | With in one module, trace points usually have a common prefix named | 7 | The necessary slow path with an explicit discard operation already |
4 | after the module name. paio_submit and paio_submit_co are the only two | 8 | exists for other cases. Use it for external data files, too. |
5 | trace points so far in the two file protocol drivers. As we are adding | ||
6 | more, having a common prefix here is better so that trace points can be | ||
7 | enabled with a glob. Rename them. | ||
8 | 9 | ||
9 | Suggested-by: Kevin Wolf <kwolf@redhat.com> | 10 | Cc: qemu-stable@nongnu.org |
10 | Signed-off-by: Fam Zheng <famz@redhat.com> | ||
11 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 11 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
12 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
12 | --- | 13 | --- |
13 | block/file-posix.c | 2 +- | 14 | block/qcow2.c | 7 +++++-- |
14 | block/file-win32.c | 2 +- | 15 | 1 file changed, 5 insertions(+), 2 deletions(-) |
15 | block/trace-events | 4 ++-- | ||
16 | 3 files changed, 4 insertions(+), 4 deletions(-) | ||
17 | 16 | ||
18 | diff --git a/block/file-posix.c b/block/file-posix.c | 17 | diff --git a/block/qcow2.c b/block/qcow2.c |
19 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/block/file-posix.c | 19 | --- a/block/qcow2.c |
21 | +++ b/block/file-posix.c | 20 | +++ b/block/qcow2.c |
22 | @@ -XXX,XX +XXX,XX @@ static int paio_submit_co_full(BlockDriverState *bs, int fd, | 21 | @@ -XXX,XX +XXX,XX @@ static int qcow2_make_empty(BlockDriverState *bs) |
23 | assert(qiov->size == bytes); | 22 | |
23 | if (s->qcow_version >= 3 && !s->snapshots && !s->nb_bitmaps && | ||
24 | 3 + l1_clusters <= s->refcount_block_size && | ||
25 | - s->crypt_method_header != QCOW_CRYPT_LUKS) { | ||
26 | + s->crypt_method_header != QCOW_CRYPT_LUKS && | ||
27 | + !has_data_file(bs)) { | ||
28 | /* The following function only works for qcow2 v3 images (it | ||
29 | * requires the dirty flag) and only as long as there are no | ||
30 | * features that reserve extra clusters (such as snapshots, | ||
31 | * LUKS header, or persistent bitmaps), because it completely | ||
32 | * empties the image. Furthermore, the L1 table and three | ||
33 | * additional clusters (image header, refcount table, one | ||
34 | - * refcount block) have to fit inside one refcount block. */ | ||
35 | + * refcount block) have to fit inside one refcount block. It | ||
36 | + * only resets the image file, i.e. does not work with an | ||
37 | + * external data file. */ | ||
38 | return make_completely_empty(bs); | ||
24 | } | 39 | } |
25 | 40 | ||
26 | - trace_paio_submit_co(offset, bytes, type); | ||
27 | + trace_file_paio_submit_co(offset, bytes, type); | ||
28 | pool = aio_get_thread_pool(bdrv_get_aio_context(bs)); | ||
29 | return thread_pool_submit_co(pool, aio_worker, acb); | ||
30 | } | ||
31 | diff --git a/block/file-win32.c b/block/file-win32.c | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/block/file-win32.c | ||
34 | +++ b/block/file-win32.c | ||
35 | @@ -XXX,XX +XXX,XX @@ static BlockAIOCB *paio_submit(BlockDriverState *bs, HANDLE hfile, | ||
36 | acb->aio_nbytes = count; | ||
37 | acb->aio_offset = offset; | ||
38 | |||
39 | - trace_paio_submit(acb, opaque, offset, count, type); | ||
40 | + trace_file_paio_submit(acb, opaque, offset, count, type); | ||
41 | pool = aio_get_thread_pool(bdrv_get_aio_context(bs)); | ||
42 | return thread_pool_submit_aio(pool, aio_worker, acb, cb, opaque); | ||
43 | } | ||
44 | diff --git a/block/trace-events b/block/trace-events | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/block/trace-events | ||
47 | +++ b/block/trace-events | ||
48 | @@ -XXX,XX +XXX,XX @@ qmp_block_stream(void *bs, void *job) "bs %p job %p" | ||
49 | |||
50 | # block/file-win32.c | ||
51 | # block/file-posix.c | ||
52 | -paio_submit_co(int64_t offset, int count, int type) "offset %"PRId64" count %d type %d" | ||
53 | -paio_submit(void *acb, void *opaque, int64_t offset, int count, int type) "acb %p opaque %p offset %"PRId64" count %d type %d" | ||
54 | +file_paio_submit_co(int64_t offset, int count, int type) "offset %"PRId64" count %d type %d" | ||
55 | +file_paio_submit(void *acb, void *opaque, int64_t offset, int count, int type) "acb %p opaque %p offset %"PRId64" count %d type %d" | ||
56 | |||
57 | # block/qcow2.c | ||
58 | qcow2_writev_start_req(void *co, int64_t offset, int bytes) "co %p offset 0x%" PRIx64 " bytes %d" | ||
59 | -- | 41 | -- |
60 | 2.13.6 | 42 | 2.20.1 |
61 | 43 | ||
62 | 44 | diff view generated by jsdifflib |
1 | From: Cornelia Huck <cohuck@redhat.com> | 1 | From: Alberto Garcia <berto@igalia.com> |
---|---|---|---|
2 | 2 | ||
3 | This reverts commit eae3bd1eb7c6b105d30ec06008b3bc3dfc5f45bb. | 3 | This patch fixes a few things in the way error codes are handled in |
4 | the qcow2 compression code: | ||
4 | 5 | ||
5 | Reverted to avoid conflicts for geometry options revert. | 6 | a) qcow2_co_pwritev_compressed() expects qcow2_co_compress() to only |
7 | return -1 or -2 on failure, but this is not correct. Since the | ||
8 | change from qcow2_compress() to qcow2_co_compress() in commit | ||
9 | ceb029cd6feccf9f7607 the new code can also return -EINVAL (although | ||
10 | there does not seem to exist any code path that would cause that | ||
11 | error in the current implementation). | ||
6 | 12 | ||
7 | Signed-off-by: Cornelia Huck <cohuck@redhat.com> | 13 | b) -1 and -2 are ad-hoc error codes defined in qcow2_compress(). |
14 | This patch replaces them with standard constants from errno.h. | ||
15 | |||
16 | c) Both qcow2_compress() and qcow2_co_do_compress() return a negative | ||
17 | value on failure, but qcow2_co_pwritev_compressed() stores the | ||
18 | value in an unsigned data type. | ||
19 | |||
20 | Signed-off-by: Alberto Garcia <berto@igalia.com> | ||
8 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 21 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
9 | --- | 22 | --- |
10 | include/sysemu/blockdev.h | 1 + | 23 | block/qcow2.c | 18 +++++++++--------- |
11 | blockdev.c | 17 ++++++++++++++++- | 24 | 1 file changed, 9 insertions(+), 9 deletions(-) |
12 | device-hotplug.c | 4 ++++ | ||
13 | qemu-doc.texi | 5 +++++ | ||
14 | qemu-options.hx | 5 ++++- | ||
15 | 5 files changed, 30 insertions(+), 2 deletions(-) | ||
16 | 25 | ||
17 | diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h | 26 | diff --git a/block/qcow2.c b/block/qcow2.c |
18 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/sysemu/blockdev.h | 28 | --- a/block/qcow2.c |
20 | +++ b/include/sysemu/blockdev.h | 29 | +++ b/block/qcow2.c |
21 | @@ -XXX,XX +XXX,XX @@ typedef enum { | 30 | @@ -XXX,XX +XXX,XX @@ fail: |
22 | } BlockInterfaceType; | 31 | * @src - source buffer, @src_size bytes |
23 | 32 | * | |
24 | struct DriveInfo { | 33 | * Returns: compressed size on success |
25 | + const char *devaddr; | 34 | - * -1 destination buffer is not enough to store compressed data |
26 | BlockInterfaceType type; | 35 | - * -2 on any other error |
27 | int bus; | 36 | + * -ENOMEM destination buffer is not enough to store compressed data |
28 | int unit; | 37 | + * -EIO on any other error |
29 | diff --git a/blockdev.c b/blockdev.c | 38 | */ |
30 | index XXXXXXX..XXXXXXX 100644 | 39 | static ssize_t qcow2_compress(void *dest, size_t dest_size, |
31 | --- a/blockdev.c | 40 | const void *src, size_t src_size) |
32 | +++ b/blockdev.c | 41 | @@ -XXX,XX +XXX,XX @@ static ssize_t qcow2_compress(void *dest, size_t dest_size, |
33 | @@ -XXX,XX +XXX,XX @@ QemuOptsList qemu_legacy_drive_opts = { | 42 | ret = deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, |
34 | .type = QEMU_OPT_STRING, | 43 | -12, 9, Z_DEFAULT_STRATEGY); |
35 | .help = "interface (ide, scsi, sd, mtd, floppy, pflash, virtio)", | 44 | if (ret != Z_OK) { |
36 | },{ | 45 | - return -2; |
37 | + .name = "addr", | 46 | + return -EIO; |
38 | + .type = QEMU_OPT_STRING, | ||
39 | + .help = "pci address (virtio only)", | ||
40 | + },{ | ||
41 | .name = "serial", | ||
42 | .type = QEMU_OPT_STRING, | ||
43 | .help = "disk serial number", | ||
44 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
45 | DriveMediaType media = MEDIA_DISK; | ||
46 | BlockInterfaceType type; | ||
47 | int max_devs, bus_id, unit_id, index; | ||
48 | + const char *devaddr; | ||
49 | const char *werror, *rerror; | ||
50 | bool read_only = false; | ||
51 | bool copy_on_read; | ||
52 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
53 | Error *local_err = NULL; | ||
54 | int i; | ||
55 | const char *deprecated[] = { | ||
56 | - "serial" | ||
57 | + "serial", "addr" | ||
58 | }; | ||
59 | |||
60 | /* Change legacy command line options into QMP ones */ | ||
61 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
62 | } | 47 | } |
63 | 48 | ||
64 | /* Add virtio block device */ | 49 | /* strm.next_in is not const in old zlib versions, such as those used on |
65 | + devaddr = qemu_opt_get(legacy_opts, "addr"); | 50 | @@ -XXX,XX +XXX,XX @@ static ssize_t qcow2_compress(void *dest, size_t dest_size, |
66 | + if (devaddr && type != IF_VIRTIO) { | 51 | if (ret == Z_STREAM_END) { |
67 | + error_report("addr is not supported by this bus type"); | 52 | ret = dest_size - strm.avail_out; |
53 | } else { | ||
54 | - ret = (ret == Z_OK ? -1 : -2); | ||
55 | + ret = (ret == Z_OK ? -ENOMEM : -EIO); | ||
56 | } | ||
57 | |||
58 | deflateEnd(&strm); | ||
59 | @@ -XXX,XX +XXX,XX @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, | ||
60 | BDRVQcow2State *s = bs->opaque; | ||
61 | QEMUIOVector hd_qiov; | ||
62 | int ret; | ||
63 | - size_t out_len; | ||
64 | + ssize_t out_len; | ||
65 | uint8_t *buf, *out_buf; | ||
66 | uint64_t cluster_offset; | ||
67 | |||
68 | @@ -XXX,XX +XXX,XX @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, | ||
69 | |||
70 | out_len = qcow2_co_compress(bs, out_buf, s->cluster_size - 1, | ||
71 | buf, s->cluster_size); | ||
72 | - if (out_len == -2) { | ||
73 | - ret = -EINVAL; | ||
74 | - goto fail; | ||
75 | - } else if (out_len == -1) { | ||
76 | + if (out_len == -ENOMEM) { | ||
77 | /* could not compress: write normal cluster */ | ||
78 | ret = qcow2_co_pwritev(bs, offset, bytes, qiov, 0); | ||
79 | if (ret < 0) { | ||
80 | goto fail; | ||
81 | } | ||
82 | goto success; | ||
83 | + } else if (out_len < 0) { | ||
84 | + ret = -EINVAL; | ||
68 | + goto fail; | 85 | + goto fail; |
69 | + } | ||
70 | + | ||
71 | if (type == IF_VIRTIO) { | ||
72 | QemuOpts *devopts; | ||
73 | devopts = qemu_opts_create(qemu_find_opts("device"), NULL, 0, | ||
74 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
75 | } | ||
76 | qemu_opt_set(devopts, "drive", qdict_get_str(bs_opts, "id"), | ||
77 | &error_abort); | ||
78 | + if (devaddr) { | ||
79 | + qemu_opt_set(devopts, "addr", devaddr, &error_abort); | ||
80 | + } | ||
81 | } | 86 | } |
82 | 87 | ||
83 | filename = qemu_opt_get(legacy_opts, "file"); | 88 | qemu_co_mutex_lock(&s->lock); |
84 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
85 | dinfo->type = type; | ||
86 | dinfo->bus = bus_id; | ||
87 | dinfo->unit = unit_id; | ||
88 | + dinfo->devaddr = devaddr; | ||
89 | dinfo->serial = g_strdup(serial); | ||
90 | |||
91 | blk_set_legacy_dinfo(blk, dinfo); | ||
92 | diff --git a/device-hotplug.c b/device-hotplug.c | ||
93 | index XXXXXXX..XXXXXXX 100644 | ||
94 | --- a/device-hotplug.c | ||
95 | +++ b/device-hotplug.c | ||
96 | @@ -XXX,XX +XXX,XX @@ void hmp_drive_add(Monitor *mon, const QDict *qdict) | ||
97 | if (!dinfo) { | ||
98 | goto err; | ||
99 | } | ||
100 | + if (dinfo->devaddr) { | ||
101 | + monitor_printf(mon, "Parameter addr not supported\n"); | ||
102 | + goto err; | ||
103 | + } | ||
104 | |||
105 | switch (dinfo->type) { | ||
106 | case IF_NONE: | ||
107 | diff --git a/qemu-doc.texi b/qemu-doc.texi | ||
108 | index XXXXXXX..XXXXXXX 100644 | ||
109 | --- a/qemu-doc.texi | ||
110 | +++ b/qemu-doc.texi | ||
111 | @@ -XXX,XX +XXX,XX @@ provided per NIC. | ||
112 | The drive serial argument is replaced by the the serial argument | ||
113 | that can be specified with the ``-device'' parameter. | ||
114 | |||
115 | +@subsection -drive addr=... (since 2.10.0) | ||
116 | + | ||
117 | +The drive addr argument is replaced by the the addr argument | ||
118 | +that can be specified with the ``-device'' parameter. | ||
119 | + | ||
120 | @subsection -usbdevice (since 2.10.0) | ||
121 | |||
122 | The ``-usbdevice DEV'' argument is now a synonym for setting | ||
123 | diff --git a/qemu-options.hx b/qemu-options.hx | ||
124 | index XXXXXXX..XXXXXXX 100644 | ||
125 | --- a/qemu-options.hx | ||
126 | +++ b/qemu-options.hx | ||
127 | @@ -XXX,XX +XXX,XX @@ ETEXI | ||
128 | DEF("drive", HAS_ARG, QEMU_OPTION_drive, | ||
129 | "-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]\n" | ||
130 | " [,cache=writethrough|writeback|none|directsync|unsafe][,format=f]\n" | ||
131 | - " [,snapshot=on|off][,serial=s][,rerror=ignore|stop|report]\n" | ||
132 | + " [,snapshot=on|off][,serial=s][,addr=A][,rerror=ignore|stop|report]\n" | ||
133 | " [,werror=ignore|stop|report|enospc][,id=name][,aio=threads|native]\n" | ||
134 | " [,readonly=on|off][,copy-on-read=on|off]\n" | ||
135 | " [,discard=ignore|unmap][,detect-zeroes=on|off|unmap]\n" | ||
136 | @@ -XXX,XX +XXX,XX @@ an untrusted format header. | ||
137 | This option specifies the serial number to assign to the device. This | ||
138 | parameter is deprecated, use the corresponding parameter of @code{-device} | ||
139 | instead. | ||
140 | +@item addr=@var{addr} | ||
141 | +Specify the controller's PCI address (if=virtio only). This parameter is | ||
142 | +deprecated, use the corresponding parameter of @code{-device} instead. | ||
143 | @item werror=@var{action},rerror=@var{action} | ||
144 | Specify which @var{action} to take on write and read errors. Valid actions are: | ||
145 | "ignore" (ignore the error and try to continue), "stop" (pause QEMU), | ||
146 | -- | 89 | -- |
147 | 2.13.6 | 90 | 2.20.1 |
148 | 91 | ||
149 | 92 | diff view generated by jsdifflib |
1 | From: Fam Zheng <famz@redhat.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | This matches the types used for bytes in the rest parts of block layer. | 3 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
4 | In the case of bdrv_co_truncate, new_bytes can be the image size which | 4 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> |
5 | probably doesn't fit in a 32 bit int. | 5 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> |
6 | |||
7 | Signed-off-by: Fam Zheng <famz@redhat.com> | ||
8 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
9 | --- | 7 | --- |
10 | include/block/block_int.h | 4 ++-- | 8 | include/block/block_int.h | 16 ++++++++++++++++ |
11 | block/io.c | 8 +++++--- | 9 | include/sysemu/block-backend.h | 19 +++++++++++++++++++ |
12 | 2 files changed, 7 insertions(+), 5 deletions(-) | 10 | 2 files changed, 35 insertions(+) |
13 | 11 | ||
14 | diff --git a/include/block/block_int.h b/include/block/block_int.h | 12 | diff --git a/include/block/block_int.h b/include/block/block_int.h |
15 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/include/block/block_int.h | 14 | --- a/include/block/block_int.h |
17 | +++ b/include/block/block_int.h | 15 | +++ b/include/block/block_int.h |
18 | @@ -XXX,XX +XXX,XX @@ enum BdrvTrackedRequestType { | 16 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_pwritev(BdrvChild *child, |
19 | typedef struct BdrvTrackedRequest { | 17 | int64_t offset, unsigned int bytes, QEMUIOVector *qiov, |
20 | BlockDriverState *bs; | 18 | BdrvRequestFlags flags); |
21 | int64_t offset; | 19 | |
22 | - unsigned int bytes; | 20 | +static inline int coroutine_fn bdrv_co_pread(BdrvChild *child, |
23 | + uint64_t bytes; | 21 | + int64_t offset, unsigned int bytes, void *buf, BdrvRequestFlags flags) |
24 | enum BdrvTrackedRequestType type; | 22 | +{ |
25 | 23 | + QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); | |
26 | bool serialising; | 24 | + |
27 | int64_t overlap_offset; | 25 | + return bdrv_co_preadv(child, offset, bytes, &qiov, flags); |
28 | - unsigned int overlap_bytes; | 26 | +} |
29 | + uint64_t overlap_bytes; | 27 | + |
30 | 28 | +static inline int coroutine_fn bdrv_co_pwrite(BdrvChild *child, | |
31 | QLIST_ENTRY(BdrvTrackedRequest) list; | 29 | + int64_t offset, unsigned int bytes, void *buf, BdrvRequestFlags flags) |
32 | Coroutine *co; /* owner, used for deadlock detection */ | 30 | +{ |
33 | diff --git a/block/io.c b/block/io.c | 31 | + QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); |
32 | + | ||
33 | + return bdrv_co_pwritev(child, offset, bytes, &qiov, flags); | ||
34 | +} | ||
35 | + | ||
36 | extern unsigned int bdrv_drain_all_count; | ||
37 | void bdrv_apply_subtree_drain(BdrvChild *child, BlockDriverState *new_parent); | ||
38 | void bdrv_unapply_subtree_drain(BdrvChild *child, BlockDriverState *old_parent); | ||
39 | diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h | ||
34 | index XXXXXXX..XXXXXXX 100644 | 40 | index XXXXXXX..XXXXXXX 100644 |
35 | --- a/block/io.c | 41 | --- a/include/sysemu/block-backend.h |
36 | +++ b/block/io.c | 42 | +++ b/include/sysemu/block-backend.h |
37 | @@ -XXX,XX +XXX,XX @@ static void tracked_request_end(BdrvTrackedRequest *req) | 43 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset, |
38 | static void tracked_request_begin(BdrvTrackedRequest *req, | 44 | int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset, |
39 | BlockDriverState *bs, | 45 | unsigned int bytes, QEMUIOVector *qiov, |
40 | int64_t offset, | 46 | BdrvRequestFlags flags); |
41 | - unsigned int bytes, | ||
42 | + uint64_t bytes, | ||
43 | enum BdrvTrackedRequestType type) | ||
44 | { | ||
45 | + assert(bytes <= INT64_MAX && offset <= INT64_MAX - bytes); | ||
46 | + | 47 | + |
47 | *req = (BdrvTrackedRequest){ | 48 | +static inline int coroutine_fn blk_co_pread(BlockBackend *blk, int64_t offset, |
48 | .bs = bs, | 49 | + unsigned int bytes, void *buf, |
49 | .offset = offset, | 50 | + BdrvRequestFlags flags) |
50 | @@ -XXX,XX +XXX,XX @@ static void tracked_request_begin(BdrvTrackedRequest *req, | 51 | +{ |
51 | static void mark_request_serialising(BdrvTrackedRequest *req, uint64_t align) | 52 | + QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); |
52 | { | 53 | + |
53 | int64_t overlap_offset = req->offset & ~(align - 1); | 54 | + return blk_co_preadv(blk, offset, bytes, &qiov, flags); |
54 | - unsigned int overlap_bytes = ROUND_UP(req->offset + req->bytes, align) | 55 | +} |
55 | + uint64_t overlap_bytes = ROUND_UP(req->offset + req->bytes, align) | 56 | + |
56 | - overlap_offset; | 57 | +static inline int coroutine_fn blk_co_pwrite(BlockBackend *blk, int64_t offset, |
57 | 58 | + unsigned int bytes, void *buf, | |
58 | if (!req->serialising) { | 59 | + BdrvRequestFlags flags) |
59 | @@ -XXX,XX +XXX,XX @@ static int bdrv_get_cluster_size(BlockDriverState *bs) | 60 | +{ |
60 | } | 61 | + QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); |
61 | 62 | + | |
62 | static bool tracked_request_overlaps(BdrvTrackedRequest *req, | 63 | + return blk_co_pwritev(blk, offset, bytes, &qiov, flags); |
63 | - int64_t offset, unsigned int bytes) | 64 | +} |
64 | + int64_t offset, uint64_t bytes) | 65 | + |
65 | { | 66 | int blk_pwrite_zeroes(BlockBackend *blk, int64_t offset, |
66 | /* aaaa bbbb */ | 67 | int bytes, BdrvRequestFlags flags); |
67 | if (offset >= req->overlap_offset + req->overlap_bytes) { | 68 | BlockAIOCB *blk_aio_pwrite_zeroes(BlockBackend *blk, int64_t offset, |
68 | -- | 69 | -- |
69 | 2.13.6 | 70 | 2.20.1 |
70 | 71 | ||
71 | 72 | diff view generated by jsdifflib |
1 | From: Cornelia Huck <cohuck@redhat.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | This reverts commit b0083267444a5e0f28391f6c2831a539f878d424. | 3 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
4 | 4 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | |
5 | Hold off removing this for one more QEMU release (current libvirt | 5 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> |
6 | release still uses it.) | ||
7 | |||
8 | Signed-off-by: Cornelia Huck <cohuck@redhat.com> | ||
9 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
10 | --- | 7 | --- |
11 | include/hw/block/block.h | 1 + | 8 | block/qcow2.c | 9 ++------- |
12 | include/sysemu/blockdev.h | 1 + | 9 | 1 file changed, 2 insertions(+), 7 deletions(-) |
13 | block/block-backend.c | 1 + | ||
14 | blockdev.c | 10 ++++++++++ | ||
15 | hw/block/block.c | 13 +++++++++++++ | ||
16 | hw/block/nvme.c | 1 + | ||
17 | hw/block/virtio-blk.c | 1 + | ||
18 | hw/ide/qdev.c | 1 + | ||
19 | hw/scsi/scsi-disk.c | 1 + | ||
20 | hw/usb/dev-storage.c | 1 + | ||
21 | tests/ahci-test.c | 6 +++--- | ||
22 | tests/ide-test.c | 8 ++++---- | ||
23 | qemu-doc.texi | 5 +++++ | ||
24 | qemu-options.hx | 6 +++++- | ||
25 | 14 files changed, 48 insertions(+), 8 deletions(-) | ||
26 | 10 | ||
27 | diff --git a/include/hw/block/block.h b/include/hw/block/block.h | 11 | diff --git a/block/qcow2.c b/block/qcow2.c |
28 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/include/hw/block/block.h | 13 | --- a/block/qcow2.c |
30 | +++ b/include/hw/block/block.h | 14 | +++ b/block/qcow2.c |
31 | @@ -XXX,XX +XXX,XX @@ static inline unsigned int get_physical_block_exp(BlockConf *conf) | 15 | @@ -XXX,XX +XXX,XX @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, |
32 | 16 | uint64_t bytes, QEMUIOVector *qiov) | |
33 | /* Configuration helpers */ | 17 | { |
34 | 18 | BDRVQcow2State *s = bs->opaque; | |
35 | +void blkconf_serial(BlockConf *conf, char **serial); | 19 | - QEMUIOVector hd_qiov; |
36 | bool blkconf_geometry(BlockConf *conf, int *trans, | 20 | int ret; |
37 | unsigned cyls_max, unsigned heads_max, unsigned secs_max, | 21 | ssize_t out_len; |
38 | Error **errp); | 22 | uint8_t *buf, *out_buf; |
39 | diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h | 23 | @@ -XXX,XX +XXX,XX @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, |
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/include/sysemu/blockdev.h | ||
42 | +++ b/include/sysemu/blockdev.h | ||
43 | @@ -XXX,XX +XXX,XX @@ struct DriveInfo { | ||
44 | bool is_default; /* Added by default_drive() ? */ | ||
45 | int media_cd; | ||
46 | QemuOpts *opts; | ||
47 | + char *serial; | ||
48 | QTAILQ_ENTRY(DriveInfo) next; | ||
49 | }; | ||
50 | |||
51 | diff --git a/block/block-backend.c b/block/block-backend.c | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/block/block-backend.c | ||
54 | +++ b/block/block-backend.c | ||
55 | @@ -XXX,XX +XXX,XX @@ static void drive_info_del(DriveInfo *dinfo) | ||
56 | return; | ||
57 | } | ||
58 | qemu_opts_del(dinfo->opts); | ||
59 | + g_free(dinfo->serial); | ||
60 | g_free(dinfo); | ||
61 | } | ||
62 | |||
63 | diff --git a/blockdev.c b/blockdev.c | ||
64 | index XXXXXXX..XXXXXXX 100644 | ||
65 | --- a/blockdev.c | ||
66 | +++ b/blockdev.c | ||
67 | @@ -XXX,XX +XXX,XX @@ QemuOptsList qemu_legacy_drive_opts = { | ||
68 | .type = QEMU_OPT_STRING, | ||
69 | .help = "interface (ide, scsi, sd, mtd, floppy, pflash, virtio)", | ||
70 | },{ | ||
71 | + .name = "serial", | ||
72 | + .type = QEMU_OPT_STRING, | ||
73 | + .help = "disk serial number", | ||
74 | + },{ | ||
75 | .name = "file", | ||
76 | .type = QEMU_OPT_STRING, | ||
77 | .help = "file name", | ||
78 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
79 | const char *werror, *rerror; | ||
80 | bool read_only = false; | ||
81 | bool copy_on_read; | ||
82 | + const char *serial; | ||
83 | const char *filename; | ||
84 | Error *local_err = NULL; | ||
85 | int i; | ||
86 | const char *deprecated[] = { | ||
87 | + "serial" | ||
88 | }; | ||
89 | |||
90 | /* Change legacy command line options into QMP ones */ | ||
91 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
92 | goto fail; | 24 | goto fail; |
93 | } | 25 | } |
94 | 26 | ||
95 | + /* Serial number */ | 27 | - qemu_iovec_init_buf(&hd_qiov, out_buf, out_len); |
96 | + serial = qemu_opt_get(legacy_opts, "serial"); | 28 | - |
97 | + | 29 | BLKDBG_EVENT(s->data_file, BLKDBG_WRITE_COMPRESSED); |
98 | /* no id supplied -> create one */ | 30 | - ret = bdrv_co_pwritev(s->data_file, cluster_offset, out_len, &hd_qiov, 0); |
99 | if (qemu_opts_id(all_opts) == NULL) { | 31 | + ret = bdrv_co_pwrite(s->data_file, cluster_offset, out_len, out_buf, 0); |
100 | char *new_id; | 32 | if (ret < 0) { |
101 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | 33 | goto fail; |
102 | dinfo->type = type; | ||
103 | dinfo->bus = bus_id; | ||
104 | dinfo->unit = unit_id; | ||
105 | + dinfo->serial = g_strdup(serial); | ||
106 | |||
107 | blk_set_legacy_dinfo(blk, dinfo); | ||
108 | |||
109 | diff --git a/hw/block/block.c b/hw/block/block.c | ||
110 | index XXXXXXX..XXXXXXX 100644 | ||
111 | --- a/hw/block/block.c | ||
112 | +++ b/hw/block/block.c | ||
113 | @@ -XXX,XX +XXX,XX @@ | ||
114 | #include "qapi/qapi-types-block.h" | ||
115 | #include "qemu/error-report.h" | ||
116 | |||
117 | +void blkconf_serial(BlockConf *conf, char **serial) | ||
118 | +{ | ||
119 | + DriveInfo *dinfo; | ||
120 | + | ||
121 | + if (!*serial) { | ||
122 | + /* try to fall back to value set with legacy -drive serial=... */ | ||
123 | + dinfo = blk_legacy_dinfo(conf->blk); | ||
124 | + if (dinfo) { | ||
125 | + *serial = g_strdup(dinfo->serial); | ||
126 | + } | ||
127 | + } | ||
128 | +} | ||
129 | + | ||
130 | void blkconf_blocksizes(BlockConf *conf) | ||
131 | { | ||
132 | BlockBackend *blk = conf->blk; | ||
133 | diff --git a/hw/block/nvme.c b/hw/block/nvme.c | ||
134 | index XXXXXXX..XXXXXXX 100644 | ||
135 | --- a/hw/block/nvme.c | ||
136 | +++ b/hw/block/nvme.c | ||
137 | @@ -XXX,XX +XXX,XX @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp) | ||
138 | return; | ||
139 | } | 34 | } |
140 | 35 | @@ -XXX,XX +XXX,XX @@ qcow2_co_preadv_compressed(BlockDriverState *bs, | |
141 | + blkconf_serial(&n->conf, &n->serial); | 36 | int ret = 0, csize, nb_csectors; |
142 | if (!n->serial) { | 37 | uint64_t coffset; |
143 | error_setg(errp, "serial property not set"); | 38 | uint8_t *buf, *out_buf; |
144 | return; | 39 | - QEMUIOVector local_qiov; |
145 | diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c | 40 | int offset_in_cluster = offset_into_cluster(s, offset); |
146 | index XXXXXXX..XXXXXXX 100644 | 41 | |
147 | --- a/hw/block/virtio-blk.c | 42 | coffset = file_cluster_offset & s->cluster_offset_mask; |
148 | +++ b/hw/block/virtio-blk.c | 43 | @@ -XXX,XX +XXX,XX @@ qcow2_co_preadv_compressed(BlockDriverState *bs, |
149 | @@ -XXX,XX +XXX,XX @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp) | 44 | if (!buf) { |
150 | return; | 45 | return -ENOMEM; |
151 | } | 46 | } |
152 | 47 | - qemu_iovec_init_buf(&local_qiov, buf, csize); | |
153 | + blkconf_serial(&conf->conf, &conf->serial); | 48 | |
154 | if (!blkconf_apply_backend_options(&conf->conf, | 49 | out_buf = qemu_blockalign(bs, s->cluster_size); |
155 | blk_is_read_only(conf->conf.blk), true, | 50 | |
156 | errp)) { | 51 | BLKDBG_EVENT(bs->file, BLKDBG_READ_COMPRESSED); |
157 | diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c | 52 | - ret = bdrv_co_preadv(bs->file, coffset, csize, &local_qiov, 0); |
158 | index XXXXXXX..XXXXXXX 100644 | 53 | + ret = bdrv_co_pread(bs->file, coffset, csize, buf, 0); |
159 | --- a/hw/ide/qdev.c | 54 | if (ret < 0) { |
160 | +++ b/hw/ide/qdev.c | 55 | goto fail; |
161 | @@ -XXX,XX +XXX,XX @@ static void ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind, Error **errp) | ||
162 | return; | ||
163 | } | 56 | } |
164 | |||
165 | + blkconf_serial(&dev->conf, &dev->serial); | ||
166 | if (kind != IDE_CD) { | ||
167 | if (!blkconf_geometry(&dev->conf, &dev->chs_trans, 65535, 16, 255, | ||
168 | errp)) { | ||
169 | diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c | ||
170 | index XXXXXXX..XXXXXXX 100644 | ||
171 | --- a/hw/scsi/scsi-disk.c | ||
172 | +++ b/hw/scsi/scsi-disk.c | ||
173 | @@ -XXX,XX +XXX,XX @@ static void scsi_realize(SCSIDevice *dev, Error **errp) | ||
174 | return; | ||
175 | } | ||
176 | |||
177 | + blkconf_serial(&s->qdev.conf, &s->serial); | ||
178 | blkconf_blocksizes(&s->qdev.conf); | ||
179 | |||
180 | if (s->qdev.conf.logical_block_size > | ||
181 | diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c | ||
182 | index XXXXXXX..XXXXXXX 100644 | ||
183 | --- a/hw/usb/dev-storage.c | ||
184 | +++ b/hw/usb/dev-storage.c | ||
185 | @@ -XXX,XX +XXX,XX @@ static void usb_msd_storage_realize(USBDevice *dev, Error **errp) | ||
186 | return; | ||
187 | } | ||
188 | |||
189 | + blkconf_serial(&s->conf, &dev->serial); | ||
190 | blkconf_blocksizes(&s->conf); | ||
191 | if (!blkconf_apply_backend_options(&s->conf, blk_is_read_only(blk), true, | ||
192 | errp)) { | ||
193 | diff --git a/tests/ahci-test.c b/tests/ahci-test.c | ||
194 | index XXXXXXX..XXXXXXX 100644 | ||
195 | --- a/tests/ahci-test.c | ||
196 | +++ b/tests/ahci-test.c | ||
197 | @@ -XXX,XX +XXX,XX @@ static AHCIQState *ahci_boot(const char *cli, ...) | ||
198 | s = ahci_vboot(cli, ap); | ||
199 | va_end(ap); | ||
200 | } else { | ||
201 | - cli = "-drive if=none,id=drive0,file=%s,cache=writeback,format=%s" | ||
202 | + cli = "-drive if=none,id=drive0,file=%s,cache=writeback,serial=%s" | ||
203 | + ",format=%s" | ||
204 | " -M q35 " | ||
205 | "-device ide-hd,drive=drive0 " | ||
206 | - "-global ide-hd.serial=%s " | ||
207 | "-global ide-hd.ver=%s"; | ||
208 | - s = ahci_boot(cli, tmp_path, imgfmt, "testdisk", "version"); | ||
209 | + s = ahci_boot(cli, tmp_path, "testdisk", imgfmt, "version"); | ||
210 | } | ||
211 | |||
212 | return s; | ||
213 | diff --git a/tests/ide-test.c b/tests/ide-test.c | ||
214 | index XXXXXXX..XXXXXXX 100644 | ||
215 | --- a/tests/ide-test.c | ||
216 | +++ b/tests/ide-test.c | ||
217 | @@ -XXX,XX +XXX,XX @@ static void test_bmdma_no_busmaster(void) | ||
218 | static void test_bmdma_setup(void) | ||
219 | { | ||
220 | ide_test_start( | ||
221 | - "-drive file=%s,if=ide,cache=writeback,format=raw " | ||
222 | - "-global ide-hd.serial=%s -global ide-hd.ver=%s", | ||
223 | + "-drive file=%s,if=ide,serial=%s,cache=writeback,format=raw " | ||
224 | + "-global ide-hd.ver=%s", | ||
225 | tmp_path, "testdisk", "version"); | ||
226 | qtest_irq_intercept_in(global_qtest, "ioapic"); | ||
227 | } | ||
228 | @@ -XXX,XX +XXX,XX @@ static void test_identify(void) | ||
229 | int ret; | ||
230 | |||
231 | ide_test_start( | ||
232 | - "-drive file=%s,if=ide,cache=writeback,format=raw " | ||
233 | - "-global ide-hd.serial=%s -global ide-hd.ver=%s", | ||
234 | + "-drive file=%s,if=ide,serial=%s,cache=writeback,format=raw " | ||
235 | + "-global ide-hd.ver=%s", | ||
236 | tmp_path, "testdisk", "version"); | ||
237 | |||
238 | dev = get_pci_device(&bmdma_bar, &ide_bar); | ||
239 | diff --git a/qemu-doc.texi b/qemu-doc.texi | ||
240 | index XXXXXXX..XXXXXXX 100644 | ||
241 | --- a/qemu-doc.texi | ||
242 | +++ b/qemu-doc.texi | ||
243 | @@ -XXX,XX +XXX,XX @@ with ``-device ...,netdev=x''), or ``-nic user,smb=/some/dir'' | ||
244 | (for embedded NICs). The new syntax allows different settings to be | ||
245 | provided per NIC. | ||
246 | |||
247 | +@subsection -drive serial=... (since 2.10.0) | ||
248 | + | ||
249 | +The drive serial argument is replaced by the the serial argument | ||
250 | +that can be specified with the ``-device'' parameter. | ||
251 | + | ||
252 | @subsection -usbdevice (since 2.10.0) | ||
253 | |||
254 | The ``-usbdevice DEV'' argument is now a synonym for setting | ||
255 | diff --git a/qemu-options.hx b/qemu-options.hx | ||
256 | index XXXXXXX..XXXXXXX 100644 | ||
257 | --- a/qemu-options.hx | ||
258 | +++ b/qemu-options.hx | ||
259 | @@ -XXX,XX +XXX,XX @@ ETEXI | ||
260 | DEF("drive", HAS_ARG, QEMU_OPTION_drive, | ||
261 | "-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]\n" | ||
262 | " [,cache=writethrough|writeback|none|directsync|unsafe][,format=f]\n" | ||
263 | - " [,snapshot=on|off][,rerror=ignore|stop|report]\n" | ||
264 | + " [,snapshot=on|off][,serial=s][,rerror=ignore|stop|report]\n" | ||
265 | " [,werror=ignore|stop|report|enospc][,id=name][,aio=threads|native]\n" | ||
266 | " [,readonly=on|off][,copy-on-read=on|off]\n" | ||
267 | " [,discard=ignore|unmap][,detect-zeroes=on|off|unmap]\n" | ||
268 | @@ -XXX,XX +XXX,XX @@ The default mode is @option{cache=writeback}. | ||
269 | Specify which disk @var{format} will be used rather than detecting | ||
270 | the format. Can be used to specify format=raw to avoid interpreting | ||
271 | an untrusted format header. | ||
272 | +@item serial=@var{serial} | ||
273 | +This option specifies the serial number to assign to the device. This | ||
274 | +parameter is deprecated, use the corresponding parameter of @code{-device} | ||
275 | +instead. | ||
276 | @item werror=@var{action},rerror=@var{action} | ||
277 | Specify which @var{action} to take on write and read errors. Valid actions are: | ||
278 | "ignore" (ignore the error and try to continue), "stop" (pause QEMU), | ||
279 | -- | 57 | -- |
280 | 2.13.6 | 58 | 2.20.1 |
281 | 59 | ||
282 | 60 | diff view generated by jsdifflib |
1 | From: Fam Zheng <famz@redhat.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | This brings the request handling logic inline with write and discard, | 3 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
4 | fixing write_gen, resize_cb, dirty bitmaps and image size refreshing. | 4 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> |
5 | The last of these issues broke iotest case 222, which is now fixed. | 5 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> |
6 | |||
7 | Signed-off-by: Fam Zheng <famz@redhat.com> | ||
8 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
9 | --- | 7 | --- |
10 | block/io.c | 24 ++++++++++-------------- | 8 | block/qcow.c | 19 ++++++------------- |
11 | 1 file changed, 10 insertions(+), 14 deletions(-) | 9 | 1 file changed, 6 insertions(+), 13 deletions(-) |
12 | 10 | ||
13 | diff --git a/block/io.c b/block/io.c | 11 | diff --git a/block/qcow.c b/block/qcow.c |
14 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/block/io.c | 13 | --- a/block/qcow.c |
16 | +++ b/block/io.c | 14 | +++ b/block/qcow.c |
17 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_co_copy_range_internal( | 15 | @@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow_co_preadv(BlockDriverState *bs, uint64_t offset, |
18 | bdrv_inc_in_flight(dst->bs); | 16 | int offset_in_cluster; |
19 | tracked_request_begin(&req, dst->bs, dst_offset, bytes, | 17 | int ret = 0, n; |
20 | BDRV_TRACKED_WRITE); | 18 | uint64_t cluster_offset; |
21 | - | 19 | - QEMUIOVector hd_qiov; |
22 | - /* BDRV_REQ_NO_SERIALISING is only for read operation */ | 20 | uint8_t *buf; |
23 | - assert(!(write_flags & BDRV_REQ_NO_SERIALISING)); | 21 | void *orig_buf; |
24 | - if (write_flags & BDRV_REQ_SERIALISING) { | 22 | |
25 | - mark_request_serialising(&req, bdrv_get_cluster_size(dst->bs)); | 23 | @@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow_co_preadv(BlockDriverState *bs, uint64_t offset, |
26 | - } | 24 | if (!cluster_offset) { |
27 | - wait_serialising_requests(&req); | 25 | if (bs->backing) { |
28 | - | 26 | /* read from the base image */ |
29 | - ret = dst->bs->drv->bdrv_co_copy_range_to(dst->bs, | 27 | - qemu_iovec_init_buf(&hd_qiov, buf, n); |
30 | - src, src_offset, | 28 | qemu_co_mutex_unlock(&s->lock); |
31 | - dst, dst_offset, | 29 | /* qcow2 emits this on bs->file instead of bs->backing */ |
32 | - bytes, | 30 | BLKDBG_EVENT(bs->file, BLKDBG_READ_BACKING_AIO); |
33 | - read_flags, write_flags); | 31 | - ret = bdrv_co_preadv(bs->backing, offset, n, &hd_qiov, 0); |
34 | - | 32 | + ret = bdrv_co_pread(bs->backing, offset, n, buf, 0); |
35 | + ret = bdrv_co_write_req_prepare(dst, dst_offset, bytes, &req, | 33 | qemu_co_mutex_lock(&s->lock); |
36 | + write_flags); | 34 | if (ret < 0) { |
37 | + if (!ret) { | 35 | break; |
38 | + ret = dst->bs->drv->bdrv_co_copy_range_to(dst->bs, | 36 | @@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow_co_preadv(BlockDriverState *bs, uint64_t offset, |
39 | + src, src_offset, | 37 | ret = -EIO; |
40 | + dst, dst_offset, | 38 | break; |
41 | + bytes, | 39 | } |
42 | + read_flags, write_flags); | 40 | - qemu_iovec_init_buf(&hd_qiov, buf, n); |
43 | + } | 41 | qemu_co_mutex_unlock(&s->lock); |
44 | + bdrv_co_write_req_finish(dst, dst_offset, bytes, &req, ret); | 42 | BLKDBG_EVENT(bs->file, BLKDBG_READ_AIO); |
45 | tracked_request_end(&req); | 43 | - ret = bdrv_co_preadv(bs->file, cluster_offset + offset_in_cluster, |
46 | bdrv_dec_in_flight(dst->bs); | 44 | - n, &hd_qiov, 0); |
45 | + ret = bdrv_co_pread(bs->file, cluster_offset + offset_in_cluster, | ||
46 | + n, buf, 0); | ||
47 | qemu_co_mutex_lock(&s->lock); | ||
48 | if (ret < 0) { | ||
49 | break; | ||
50 | @@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow_co_pwritev(BlockDriverState *bs, uint64_t offset, | ||
51 | int offset_in_cluster; | ||
52 | uint64_t cluster_offset; | ||
53 | int ret = 0, n; | ||
54 | - QEMUIOVector hd_qiov; | ||
55 | uint8_t *buf; | ||
56 | void *orig_buf; | ||
57 | |||
58 | @@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow_co_pwritev(BlockDriverState *bs, uint64_t offset, | ||
59 | } | ||
60 | } | ||
61 | |||
62 | - qemu_iovec_init_buf(&hd_qiov, buf, n); | ||
63 | qemu_co_mutex_unlock(&s->lock); | ||
64 | BLKDBG_EVENT(bs->file, BLKDBG_WRITE_AIO); | ||
65 | - ret = bdrv_co_pwritev(bs->file, cluster_offset + offset_in_cluster, | ||
66 | - n, &hd_qiov, 0); | ||
67 | + ret = bdrv_co_pwrite(bs->file, cluster_offset + offset_in_cluster, | ||
68 | + n, buf, 0); | ||
69 | qemu_co_mutex_lock(&s->lock); | ||
70 | if (ret < 0) { | ||
71 | break; | ||
72 | @@ -XXX,XX +XXX,XX @@ qcow_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, | ||
73 | uint64_t bytes, QEMUIOVector *qiov) | ||
74 | { | ||
75 | BDRVQcowState *s = bs->opaque; | ||
76 | - QEMUIOVector hd_qiov; | ||
77 | z_stream strm; | ||
78 | int ret, out_len; | ||
79 | uint8_t *buf, *out_buf; | ||
80 | @@ -XXX,XX +XXX,XX @@ qcow_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, | ||
81 | } | ||
82 | cluster_offset &= s->cluster_offset_mask; | ||
83 | |||
84 | - qemu_iovec_init_buf(&hd_qiov, out_buf, out_len); | ||
85 | BLKDBG_EVENT(bs->file, BLKDBG_WRITE_COMPRESSED); | ||
86 | - ret = bdrv_co_pwritev(bs->file, cluster_offset, out_len, &hd_qiov, 0); | ||
87 | + ret = bdrv_co_pwrite(bs->file, cluster_offset, out_len, out_buf, 0); | ||
88 | if (ret < 0) { | ||
89 | goto fail; | ||
47 | } | 90 | } |
48 | -- | 91 | -- |
49 | 2.13.6 | 92 | 2.20.1 |
50 | 93 | ||
51 | 94 | diff view generated by jsdifflib |
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | Here two things are fixed: | 3 | Move to _co_ versions of io functions qed_read_table() and |
4 | 4 | qed_write_table(), as we use qemu_co_mutex_unlock() | |
5 | 1. Architecture | 5 | anyway. |
6 | |||
7 | On each recursion step, we go to the child of src or dst, only for one | ||
8 | of them. So, it's wrong to create tracked requests for both on each | ||
9 | step. It leads to tracked requests duplication. | ||
10 | |||
11 | 2. Wait for serializing requests on write path independently of | ||
12 | BDRV_REQ_NO_SERIALISING | ||
13 | |||
14 | Before commit 9ded4a01149 "backup: Use copy offloading", | ||
15 | BDRV_REQ_NO_SERIALISING was used for only one case: read in | ||
16 | copy-on-write operation during backup. Also, the flag was handled only | ||
17 | on read path (in bdrv_co_preadv and bdrv_aligned_preadv). | ||
18 | |||
19 | After 9ded4a01149, flag is used for not waiting serializing operations | ||
20 | on backup target (in same case of copy-on-write operation). This | ||
21 | behavior change is unsubstantiated and potentially dangerous, let's | ||
22 | drop it and add additional asserts and documentation. | ||
23 | 6 | ||
24 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 7 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
25 | Reviewed-by: Fam Zheng <famz@redhat.com> | 8 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> |
9 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> | ||
26 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 10 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
27 | --- | 11 | --- |
28 | include/block/block.h | 12 ++++++++++++ | 12 | block/qed-table.c | 12 +++++------- |
29 | block/io.c | 42 +++++++++++++++++++++++++++--------------- | 13 | block/qed.c | 6 ++---- |
30 | 2 files changed, 39 insertions(+), 15 deletions(-) | 14 | 2 files changed, 7 insertions(+), 11 deletions(-) |
31 | 15 | ||
32 | diff --git a/include/block/block.h b/include/block/block.h | 16 | diff --git a/block/qed-table.c b/block/qed-table.c |
33 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/include/block/block.h | 18 | --- a/block/qed-table.c |
35 | +++ b/include/block/block.h | 19 | +++ b/block/qed-table.c |
36 | @@ -XXX,XX +XXX,XX @@ typedef enum { | 20 | @@ -XXX,XX +XXX,XX @@ |
37 | * opened with BDRV_O_UNMAP. | 21 | /* Called with table_lock held. */ |
38 | */ | 22 | static int qed_read_table(BDRVQEDState *s, uint64_t offset, QEDTable *table) |
39 | BDRV_REQ_MAY_UNMAP = 0x4, | 23 | { |
24 | - QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF( | ||
25 | - qiov, table->offsets, s->header.cluster_size * s->header.table_size); | ||
26 | + unsigned int bytes = s->header.cluster_size * s->header.table_size; | ||
40 | + | 27 | + |
41 | + /* | 28 | int noffsets; |
42 | + * The BDRV_REQ_NO_SERIALISING flag is only valid for reads and means that | 29 | int i, ret; |
43 | + * we don't want wait_serialising_requests() during the read operation. | 30 | |
44 | + * | 31 | trace_qed_read_table(s, offset, table); |
45 | + * This flag is used for backup copy-on-write operations, when we need to | 32 | |
46 | + * read old data before write (write notifier triggered). It is okay since | 33 | qemu_co_mutex_unlock(&s->table_lock); |
47 | + * we already waited for other serializing requests in the initiating write | 34 | - ret = bdrv_preadv(s->bs->file, offset, &qiov); |
48 | + * (see bdrv_aligned_pwritev), and it is necessary if the initiating write | 35 | + ret = bdrv_co_pread(s->bs->file, offset, bytes, table->offsets, 0); |
49 | + * is already serializing (without the flag, the read would deadlock | 36 | qemu_co_mutex_lock(&s->table_lock); |
50 | + * waiting for the serialising write to complete). | 37 | if (ret < 0) { |
51 | + */ | 38 | goto out; |
52 | BDRV_REQ_NO_SERIALISING = 0x8, | 39 | } |
53 | BDRV_REQ_FUA = 0x10, | 40 | |
54 | BDRV_REQ_WRITE_COMPRESSED = 0x20, | 41 | /* Byteswap offsets */ |
55 | diff --git a/block/io.c b/block/io.c | 42 | - noffsets = qiov.size / sizeof(uint64_t); |
43 | + noffsets = bytes / sizeof(uint64_t); | ||
44 | for (i = 0; i < noffsets; i++) { | ||
45 | table->offsets[i] = le64_to_cpu(table->offsets[i]); | ||
46 | } | ||
47 | @@ -XXX,XX +XXX,XX @@ static int qed_write_table(BDRVQEDState *s, uint64_t offset, QEDTable *table, | ||
48 | unsigned int sector_mask = BDRV_SECTOR_SIZE / sizeof(uint64_t) - 1; | ||
49 | unsigned int start, end, i; | ||
50 | QEDTable *new_table; | ||
51 | - QEMUIOVector qiov; | ||
52 | size_t len_bytes; | ||
53 | int ret; | ||
54 | |||
55 | @@ -XXX,XX +XXX,XX @@ static int qed_write_table(BDRVQEDState *s, uint64_t offset, QEDTable *table, | ||
56 | len_bytes = (end - start) * sizeof(uint64_t); | ||
57 | |||
58 | new_table = qemu_blockalign(s->bs, len_bytes); | ||
59 | - qemu_iovec_init_buf(&qiov, new_table->offsets, len_bytes); | ||
60 | |||
61 | /* Byteswap table */ | ||
62 | for (i = start; i < end; i++) { | ||
63 | @@ -XXX,XX +XXX,XX @@ static int qed_write_table(BDRVQEDState *s, uint64_t offset, QEDTable *table, | ||
64 | offset += start * sizeof(uint64_t); | ||
65 | |||
66 | qemu_co_mutex_unlock(&s->table_lock); | ||
67 | - ret = bdrv_pwritev(s->bs->file, offset, &qiov); | ||
68 | + ret = bdrv_co_pwrite(s->bs->file, offset, len_bytes, new_table->offsets, 0); | ||
69 | qemu_co_mutex_lock(&s->table_lock); | ||
70 | trace_qed_write_table_cb(s, table, flush, ret); | ||
71 | if (ret < 0) { | ||
72 | diff --git a/block/qed.c b/block/qed.c | ||
56 | index XXXXXXX..XXXXXXX 100644 | 73 | index XXXXXXX..XXXXXXX 100644 |
57 | --- a/block/io.c | 74 | --- a/block/qed.c |
58 | +++ b/block/io.c | 75 | +++ b/block/qed.c |
59 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child, | 76 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qed_write_header(BDRVQEDState *s) |
60 | max_transfer = QEMU_ALIGN_DOWN(MIN_NON_ZERO(bs->bl.max_transfer, INT_MAX), | 77 | int nsectors = DIV_ROUND_UP(sizeof(QEDHeader), BDRV_SECTOR_SIZE); |
61 | align); | 78 | size_t len = nsectors * BDRV_SECTOR_SIZE; |
62 | 79 | uint8_t *buf; | |
63 | + /* BDRV_REQ_NO_SERIALISING is only for read operation */ | 80 | - QEMUIOVector qiov; |
64 | + assert(!(flags & BDRV_REQ_NO_SERIALISING)); | ||
65 | waited = wait_serialising_requests(req); | ||
66 | assert(!waited || !req->serialising); | ||
67 | assert(req->overlap_offset <= offset); | ||
68 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src, | ||
69 | BdrvRequestFlags flags, | ||
70 | bool recurse_src) | ||
71 | { | ||
72 | - BdrvTrackedRequest src_req, dst_req; | ||
73 | + BdrvTrackedRequest req; | ||
74 | int ret; | 81 | int ret; |
75 | 82 | ||
76 | if (!dst || !dst->bs) { | 83 | assert(s->allocating_acb || s->allocating_write_reqs_plugged); |
77 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src, | 84 | |
78 | || src->bs->encrypted || dst->bs->encrypted) { | 85 | buf = qemu_blockalign(s->bs, len); |
79 | return -ENOTSUP; | 86 | - qemu_iovec_init_buf(&qiov, buf, len); |
87 | |||
88 | - ret = bdrv_co_preadv(s->bs->file, 0, qiov.size, &qiov, 0); | ||
89 | + ret = bdrv_co_pread(s->bs->file, 0, len, buf, 0); | ||
90 | if (ret < 0) { | ||
91 | goto out; | ||
80 | } | 92 | } |
81 | - bdrv_inc_in_flight(src->bs); | 93 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qed_write_header(BDRVQEDState *s) |
82 | - bdrv_inc_in_flight(dst->bs); | 94 | /* Update header */ |
83 | - tracked_request_begin(&src_req, src->bs, src_offset, | 95 | qed_header_cpu_to_le(&s->header, (QEDHeader *) buf); |
84 | - bytes, BDRV_TRACKED_READ); | 96 | |
85 | - tracked_request_begin(&dst_req, dst->bs, dst_offset, | 97 | - ret = bdrv_co_pwritev(s->bs->file, 0, qiov.size, &qiov, 0); |
86 | - bytes, BDRV_TRACKED_WRITE); | 98 | + ret = bdrv_co_pwrite(s->bs->file, 0, len, buf, 0); |
87 | 99 | if (ret < 0) { | |
88 | - if (!(flags & BDRV_REQ_NO_SERIALISING)) { | 100 | goto out; |
89 | - wait_serialising_requests(&src_req); | ||
90 | - wait_serialising_requests(&dst_req); | ||
91 | - } | ||
92 | if (recurse_src) { | ||
93 | + bdrv_inc_in_flight(src->bs); | ||
94 | + tracked_request_begin(&req, src->bs, src_offset, bytes, | ||
95 | + BDRV_TRACKED_READ); | ||
96 | + | ||
97 | + if (!(flags & BDRV_REQ_NO_SERIALISING)) { | ||
98 | + wait_serialising_requests(&req); | ||
99 | + } | ||
100 | + | ||
101 | ret = src->bs->drv->bdrv_co_copy_range_from(src->bs, | ||
102 | src, src_offset, | ||
103 | dst, dst_offset, | ||
104 | bytes, flags); | ||
105 | + | ||
106 | + tracked_request_end(&req); | ||
107 | + bdrv_dec_in_flight(src->bs); | ||
108 | } else { | ||
109 | + bdrv_inc_in_flight(dst->bs); | ||
110 | + tracked_request_begin(&req, dst->bs, dst_offset, bytes, | ||
111 | + BDRV_TRACKED_WRITE); | ||
112 | + | ||
113 | + /* BDRV_REQ_NO_SERIALISING is only for read operation, | ||
114 | + * so we ignore it in flags. | ||
115 | + */ | ||
116 | + wait_serialising_requests(&req); | ||
117 | + | ||
118 | ret = dst->bs->drv->bdrv_co_copy_range_to(dst->bs, | ||
119 | src, src_offset, | ||
120 | dst, dst_offset, | ||
121 | bytes, flags); | ||
122 | + | ||
123 | + tracked_request_end(&req); | ||
124 | + bdrv_dec_in_flight(dst->bs); | ||
125 | } | 101 | } |
126 | - tracked_request_end(&src_req); | ||
127 | - tracked_request_end(&dst_req); | ||
128 | - bdrv_dec_in_flight(src->bs); | ||
129 | - bdrv_dec_in_flight(dst->bs); | ||
130 | + | ||
131 | return ret; | ||
132 | } | ||
133 | |||
134 | -- | 102 | -- |
135 | 2.13.6 | 103 | 2.20.1 |
136 | 104 | ||
137 | 105 | diff view generated by jsdifflib |
1 | From: Ari Sundholm <ari@tuxera.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | This was accidentally omitted. Thanks to Eric Blake for spotting this. | 3 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
4 | 4 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | |
5 | Signed-off-by: Ari Sundholm <ari@tuxera.com> | 5 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> |
6 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
7 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
8 | --- | 7 | --- |
9 | qapi/block-core.json | 2 ++ | 8 | block/parallels.c | 14 ++++++-------- |
10 | 1 file changed, 2 insertions(+) | 9 | 1 file changed, 6 insertions(+), 8 deletions(-) |
11 | 10 | ||
12 | diff --git a/qapi/block-core.json b/qapi/block-core.json | 11 | diff --git a/block/parallels.c b/block/parallels.c |
13 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/qapi/block-core.json | 13 | --- a/block/parallels.c |
15 | +++ b/qapi/block-core.json | 14 | +++ b/block/parallels.c |
16 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num, |
17 | # @log-sector-size: sector size used in logging writes to @file, determines | 16 | if (bs->backing) { |
18 | # granularity of offsets and sizes of writes (default: 512) | 17 | int64_t nb_cow_sectors = to_allocate * s->tracks; |
19 | # | 18 | int64_t nb_cow_bytes = nb_cow_sectors << BDRV_SECTOR_BITS; |
20 | +# @log-append: append to an existing log (default: false) | 19 | - QEMUIOVector qiov = |
21 | +# | 20 | - QEMU_IOVEC_INIT_BUF(qiov, qemu_blockalign(bs, nb_cow_bytes), |
22 | # @log-super-update-interval: interval of write requests after which the log | 21 | - nb_cow_bytes); |
23 | # super block is updated to disk (default: 4096) | 22 | + void *buf = qemu_blockalign(bs, nb_cow_bytes); |
24 | # | 23 | |
24 | - ret = bdrv_co_preadv(bs->backing, idx * s->tracks * BDRV_SECTOR_SIZE, | ||
25 | - nb_cow_bytes, &qiov, 0); | ||
26 | + ret = bdrv_co_pread(bs->backing, idx * s->tracks * BDRV_SECTOR_SIZE, | ||
27 | + nb_cow_bytes, buf, 0); | ||
28 | if (ret < 0) { | ||
29 | - qemu_vfree(qemu_iovec_buf(&qiov)); | ||
30 | + qemu_vfree(buf); | ||
31 | return ret; | ||
32 | } | ||
33 | |||
34 | ret = bdrv_co_pwritev(bs->file, s->data_end * BDRV_SECTOR_SIZE, | ||
35 | - nb_cow_bytes, &qiov, 0); | ||
36 | - qemu_vfree(qemu_iovec_buf(&qiov)); | ||
37 | + nb_cow_bytes, buf, 0); | ||
38 | + qemu_vfree(buf); | ||
39 | if (ret < 0) { | ||
40 | return ret; | ||
41 | } | ||
25 | -- | 42 | -- |
26 | 2.13.6 | 43 | 2.20.1 |
27 | 44 | ||
28 | 45 | diff view generated by jsdifflib |
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | Fleecing scheme works as follows: we want a kind of temporary snapshot | ||
4 | of active drive A. We create temporary image B, with B->backing = A. | ||
5 | Then we start backup(sync=none) from A to B. From this point, B reads | ||
6 | as point-in-time snapshot of A (A continues to be active drive, | ||
7 | accepting guest IO). | ||
8 | |||
9 | This scheme needs some additional synchronization between reads from B | ||
10 | and backup COW operations, otherwise, the following situation is | ||
11 | theoretically possible: | ||
12 | |||
13 | (assume B is qcow2, client is NBD client, reading from B) | ||
14 | |||
15 | 1. client starts reading and take qcow2 mutex in qcow2_co_preadv, and | ||
16 | goes up to l2 table loading (assume cache miss) | ||
17 | |||
18 | 2) guest write => backup COW => qcow2 write => | ||
19 | try to take qcow2 mutex => waiting | ||
20 | |||
21 | 3. l2 table loaded, we see that cluster is UNALLOCATED, go to | ||
22 | "case QCOW2_CLUSTER_UNALLOCATED" and unlock mutex before | ||
23 | bdrv_co_preadv(bs->backing, ...) | ||
24 | |||
25 | 4) aha, mutex unlocked, backup COW continues, and we finally finish | ||
26 | guest write and change cluster in our active disk A | ||
27 | |||
28 | 5. actually, do bdrv_co_preadv(bs->backing, ...) and read | ||
29 | _new updated_ data. | ||
30 | |||
31 | To avoid this, let's make backup writes serializing, to not intersect | ||
32 | with reads from B. | ||
33 | |||
34 | Note: we expand range of handled cases from (sync=none and | ||
35 | B->backing = A) to just (A in backing chain of B), to finally allow | ||
36 | safe reading from B during backup for all cases when A in backing chain | ||
37 | of B, i.e. B formally looks like point-in-time snapshot of A. | ||
38 | |||
39 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 3 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
40 | Reviewed-by: Fam Zheng <famz@redhat.com> | 4 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> |
5 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> | ||
41 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
42 | --- | 7 | --- |
43 | block/backup.c | 20 ++++++++++++++------ | 8 | block/backup.c | 14 ++++++-------- |
44 | 1 file changed, 14 insertions(+), 6 deletions(-) | 9 | 1 file changed, 6 insertions(+), 8 deletions(-) |
45 | 10 | ||
46 | diff --git a/block/backup.c b/block/backup.c | 11 | diff --git a/block/backup.c b/block/backup.c |
47 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
48 | --- a/block/backup.c | 13 | --- a/block/backup.c |
49 | +++ b/block/backup.c | 14 | +++ b/block/backup.c |
50 | @@ -XXX,XX +XXX,XX @@ typedef struct BackupBlockJob { | ||
51 | HBitmap *copy_bitmap; | ||
52 | bool use_copy_range; | ||
53 | int64_t copy_range_size; | ||
54 | + | ||
55 | + bool serialize_target_writes; | ||
56 | } BackupBlockJob; | ||
57 | |||
58 | static const BlockJobDriver backup_job_driver; | ||
59 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job, | 15 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job, |
60 | QEMUIOVector qiov; | 16 | void **bounce_buffer) |
17 | { | ||
18 | int ret; | ||
19 | - QEMUIOVector qiov; | ||
61 | BlockBackend *blk = job->common.blk; | 20 | BlockBackend *blk = job->common.blk; |
62 | int nbytes; | 21 | int nbytes; |
63 | + int read_flags = is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0; | 22 | int read_flags = is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0; |
64 | + int write_flags = job->serialize_target_writes ? BDRV_REQ_SERIALISING : 0; | ||
65 | |||
66 | hbitmap_reset(job->copy_bitmap, start / job->cluster_size, 1); | ||
67 | nbytes = MIN(job->cluster_size, job->len - start); | ||
68 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job, | 23 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job, |
69 | iov.iov_len = nbytes; | 24 | if (!*bounce_buffer) { |
70 | qemu_iovec_init_external(&qiov, &iov, 1); | 25 | *bounce_buffer = blk_blockalign(blk, job->cluster_size); |
71 | 26 | } | |
72 | - ret = blk_co_preadv(blk, start, qiov.size, &qiov, | 27 | - qemu_iovec_init_buf(&qiov, *bounce_buffer, nbytes); |
73 | - is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0); | 28 | |
74 | + ret = blk_co_preadv(blk, start, qiov.size, &qiov, read_flags); | 29 | - ret = blk_co_preadv(blk, start, qiov.size, &qiov, read_flags); |
30 | + ret = blk_co_pread(blk, start, nbytes, *bounce_buffer, read_flags); | ||
75 | if (ret < 0) { | 31 | if (ret < 0) { |
76 | trace_backup_do_cow_read_fail(job, start, ret); | 32 | trace_backup_do_cow_read_fail(job, start, ret); |
77 | if (error_is_read) { | 33 | if (error_is_read) { |
78 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job, | 34 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job, |
79 | 35 | goto fail; | |
80 | if (qemu_iovec_is_zero(&qiov)) { | 36 | } |
37 | |||
38 | - if (qemu_iovec_is_zero(&qiov)) { | ||
39 | + if (buffer_is_zero(*bounce_buffer, nbytes)) { | ||
81 | ret = blk_co_pwrite_zeroes(job->target, start, | 40 | ret = blk_co_pwrite_zeroes(job->target, start, |
82 | - qiov.size, BDRV_REQ_MAY_UNMAP); | 41 | - qiov.size, write_flags | BDRV_REQ_MAY_UNMAP); |
83 | + qiov.size, write_flags | BDRV_REQ_MAY_UNMAP); | 42 | + nbytes, write_flags | BDRV_REQ_MAY_UNMAP); |
84 | } else { | 43 | } else { |
85 | ret = blk_co_pwritev(job->target, start, | 44 | - ret = blk_co_pwritev(job->target, start, |
86 | - qiov.size, &qiov, | 45 | - qiov.size, &qiov, write_flags | |
87 | - job->compress ? BDRV_REQ_WRITE_COMPRESSED : 0); | 46 | - (job->compress ? BDRV_REQ_WRITE_COMPRESSED : 0)); |
88 | + qiov.size, &qiov, write_flags | | 47 | + ret = blk_co_pwrite(job->target, start, |
89 | + (job->compress ? BDRV_REQ_WRITE_COMPRESSED : 0)); | 48 | + nbytes, *bounce_buffer, write_flags | |
49 | + (job->compress ? BDRV_REQ_WRITE_COMPRESSED : 0)); | ||
90 | } | 50 | } |
91 | if (ret < 0) { | 51 | if (ret < 0) { |
92 | trace_backup_do_cow_write_fail(job, start, ret); | 52 | trace_backup_do_cow_write_fail(job, start, ret); |
93 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn backup_cow_with_offload(BackupBlockJob *job, | ||
94 | int nr_clusters; | ||
95 | BlockBackend *blk = job->common.blk; | ||
96 | int nbytes; | ||
97 | + int read_flags = is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0; | ||
98 | + int write_flags = job->serialize_target_writes ? BDRV_REQ_SERIALISING : 0; | ||
99 | |||
100 | assert(QEMU_IS_ALIGNED(job->copy_range_size, job->cluster_size)); | ||
101 | nbytes = MIN(job->copy_range_size, end - start); | ||
102 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn backup_cow_with_offload(BackupBlockJob *job, | ||
103 | hbitmap_reset(job->copy_bitmap, start / job->cluster_size, | ||
104 | nr_clusters); | ||
105 | ret = blk_co_copy_range(blk, start, job->target, start, nbytes, | ||
106 | - is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0, 0); | ||
107 | + read_flags, write_flags); | ||
108 | if (ret < 0) { | ||
109 | trace_backup_do_cow_copy_range_fail(job, start, ret); | ||
110 | hbitmap_set(job->copy_bitmap, start / job->cluster_size, | ||
111 | @@ -XXX,XX +XXX,XX @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, | ||
112 | sync_bitmap : NULL; | ||
113 | job->compress = compress; | ||
114 | |||
115 | + /* Detect image-fleecing (and similar) schemes */ | ||
116 | + job->serialize_target_writes = bdrv_chain_contains(target, bs); | ||
117 | + | ||
118 | /* If there is no backing file on the target, we cannot rely on COW if our | ||
119 | * backup cluster size is smaller than the target cluster size. Even for | ||
120 | * targets with a backing file, try to avoid COW if possible. */ | ||
121 | -- | 53 | -- |
122 | 2.13.6 | 54 | 2.20.1 |
123 | 55 | ||
124 | 56 | diff view generated by jsdifflib |
1 | From: Fam Zheng <famz@redhat.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | Other I/O functions are already using a BdrvChild pointer in the API, so | 3 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
4 | make discard do the same. It makes it possible to initiate the same | 4 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> |
5 | permission checks before doing I/O, and much easier to share the | 5 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> |
6 | helper functions for this, which will be added and used by write, | ||
7 | truncate and copy range paths. | ||
8 | |||
9 | Signed-off-by: Fam Zheng <famz@redhat.com> | ||
10 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
11 | --- | 7 | --- |
12 | include/block/block.h | 4 ++-- | 8 | block/commit.c | 5 ++--- |
13 | block/blkdebug.c | 2 +- | 9 | 1 file changed, 2 insertions(+), 3 deletions(-) |
14 | block/blklogwrites.c | 2 +- | ||
15 | block/blkreplay.c | 2 +- | ||
16 | block/block-backend.c | 2 +- | ||
17 | block/copy-on-read.c | 2 +- | ||
18 | block/io.c | 18 +++++++++--------- | ||
19 | block/mirror.c | 2 +- | ||
20 | block/qcow2-refcount.c | 2 +- | ||
21 | block/raw-format.c | 2 +- | ||
22 | block/throttle.c | 2 +- | ||
23 | 11 files changed, 20 insertions(+), 20 deletions(-) | ||
24 | 10 | ||
25 | diff --git a/include/block/block.h b/include/block/block.h | 11 | diff --git a/block/commit.c b/block/commit.c |
26 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/include/block/block.h | 13 | --- a/block/commit.c |
28 | +++ b/include/block/block.h | 14 | +++ b/block/commit.c |
29 | @@ -XXX,XX +XXX,XX @@ AioWait *bdrv_get_aio_wait(BlockDriverState *bs); | 15 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn commit_populate(BlockBackend *bs, BlockBackend *base, |
30 | bdrv_get_aio_context(bs_), \ | 16 | void *buf) |
31 | cond); }) | ||
32 | |||
33 | -int bdrv_pdiscard(BlockDriverState *bs, int64_t offset, int bytes); | ||
34 | -int bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset, int bytes); | ||
35 | +int bdrv_pdiscard(BdrvChild *child, int64_t offset, int bytes); | ||
36 | +int bdrv_co_pdiscard(BdrvChild *child, int64_t offset, int bytes); | ||
37 | int bdrv_has_zero_init_1(BlockDriverState *bs); | ||
38 | int bdrv_has_zero_init(BlockDriverState *bs); | ||
39 | bool bdrv_unallocated_blocks_are_zero(BlockDriverState *bs); | ||
40 | diff --git a/block/blkdebug.c b/block/blkdebug.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/block/blkdebug.c | ||
43 | +++ b/block/blkdebug.c | ||
44 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn blkdebug_co_pdiscard(BlockDriverState *bs, | ||
45 | return err; | ||
46 | } | ||
47 | |||
48 | - return bdrv_co_pdiscard(bs->file->bs, offset, bytes); | ||
49 | + return bdrv_co_pdiscard(bs->file, offset, bytes); | ||
50 | } | ||
51 | |||
52 | static int coroutine_fn blkdebug_co_block_status(BlockDriverState *bs, | ||
53 | diff --git a/block/blklogwrites.c b/block/blklogwrites.c | ||
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/block/blklogwrites.c | ||
56 | +++ b/block/blklogwrites.c | ||
57 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn blk_log_writes_co_do_file_flush(BlkLogWritesFileReq *fr) | ||
58 | static int coroutine_fn | ||
59 | blk_log_writes_co_do_file_pdiscard(BlkLogWritesFileReq *fr) | ||
60 | { | 17 | { |
61 | - return bdrv_co_pdiscard(fr->bs->file->bs, fr->offset, fr->bytes); | 18 | int ret = 0; |
62 | + return bdrv_co_pdiscard(fr->bs->file, fr->offset, fr->bytes); | 19 | - QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); |
63 | } | 20 | |
64 | 21 | assert(bytes < SIZE_MAX); | |
65 | static int coroutine_fn | 22 | |
66 | diff --git a/block/blkreplay.c b/block/blkreplay.c | 23 | - ret = blk_co_preadv(bs, offset, qiov.size, &qiov, 0); |
67 | index XXXXXXX..XXXXXXX 100755 | 24 | + ret = blk_co_pread(bs, offset, bytes, buf, 0); |
68 | --- a/block/blkreplay.c | 25 | if (ret < 0) { |
69 | +++ b/block/blkreplay.c | ||
70 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn blkreplay_co_pdiscard(BlockDriverState *bs, | ||
71 | int64_t offset, int bytes) | ||
72 | { | ||
73 | uint64_t reqid = blkreplay_next_id(); | ||
74 | - int ret = bdrv_co_pdiscard(bs->file->bs, offset, bytes); | ||
75 | + int ret = bdrv_co_pdiscard(bs->file, offset, bytes); | ||
76 | block_request_create(reqid, bs, qemu_coroutine_self()); | ||
77 | qemu_coroutine_yield(); | ||
78 | |||
79 | diff --git a/block/block-backend.c b/block/block-backend.c | ||
80 | index XXXXXXX..XXXXXXX 100644 | ||
81 | --- a/block/block-backend.c | ||
82 | +++ b/block/block-backend.c | ||
83 | @@ -XXX,XX +XXX,XX @@ int blk_co_pdiscard(BlockBackend *blk, int64_t offset, int bytes) | ||
84 | return ret; | 26 | return ret; |
85 | } | 27 | } |
86 | 28 | ||
87 | - return bdrv_co_pdiscard(blk_bs(blk), offset, bytes); | 29 | - ret = blk_co_pwritev(base, offset, qiov.size, &qiov, 0); |
88 | + return bdrv_co_pdiscard(blk->root, offset, bytes); | 30 | + ret = blk_co_pwrite(base, offset, bytes, buf, 0); |
89 | } | 31 | if (ret < 0) { |
90 | |||
91 | int blk_co_flush(BlockBackend *blk) | ||
92 | diff --git a/block/copy-on-read.c b/block/copy-on-read.c | ||
93 | index XXXXXXX..XXXXXXX 100644 | ||
94 | --- a/block/copy-on-read.c | ||
95 | +++ b/block/copy-on-read.c | ||
96 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn cor_co_pwrite_zeroes(BlockDriverState *bs, | ||
97 | static int coroutine_fn cor_co_pdiscard(BlockDriverState *bs, | ||
98 | int64_t offset, int bytes) | ||
99 | { | ||
100 | - return bdrv_co_pdiscard(bs->file->bs, offset, bytes); | ||
101 | + return bdrv_co_pdiscard(bs->file, offset, bytes); | ||
102 | } | ||
103 | |||
104 | |||
105 | diff --git a/block/io.c b/block/io.c | ||
106 | index XXXXXXX..XXXXXXX 100644 | ||
107 | --- a/block/io.c | ||
108 | +++ b/block/io.c | ||
109 | @@ -XXX,XX +XXX,XX @@ int bdrv_flush(BlockDriverState *bs) | ||
110 | } | ||
111 | |||
112 | typedef struct DiscardCo { | ||
113 | - BlockDriverState *bs; | ||
114 | + BdrvChild *child; | ||
115 | int64_t offset; | ||
116 | int bytes; | ||
117 | int ret; | ||
118 | @@ -XXX,XX +XXX,XX @@ static void coroutine_fn bdrv_pdiscard_co_entry(void *opaque) | ||
119 | { | ||
120 | DiscardCo *rwco = opaque; | ||
121 | |||
122 | - rwco->ret = bdrv_co_pdiscard(rwco->bs, rwco->offset, rwco->bytes); | ||
123 | + rwco->ret = bdrv_co_pdiscard(rwco->child, rwco->offset, rwco->bytes); | ||
124 | } | ||
125 | |||
126 | -int coroutine_fn bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset, | ||
127 | - int bytes) | ||
128 | +int coroutine_fn bdrv_co_pdiscard(BdrvChild *child, int64_t offset, int bytes) | ||
129 | { | ||
130 | BdrvTrackedRequest req; | ||
131 | int max_pdiscard, ret; | ||
132 | int head, tail, align; | ||
133 | + BlockDriverState *bs = child->bs; | ||
134 | |||
135 | - if (!bs->drv) { | ||
136 | + if (!bs || !bs->drv) { | ||
137 | return -ENOMEDIUM; | ||
138 | } | ||
139 | |||
140 | @@ -XXX,XX +XXX,XX @@ out: | ||
141 | return ret; | ||
142 | } | ||
143 | |||
144 | -int bdrv_pdiscard(BlockDriverState *bs, int64_t offset, int bytes) | ||
145 | +int bdrv_pdiscard(BdrvChild *child, int64_t offset, int bytes) | ||
146 | { | ||
147 | Coroutine *co; | ||
148 | DiscardCo rwco = { | ||
149 | - .bs = bs, | ||
150 | + .child = child, | ||
151 | .offset = offset, | ||
152 | .bytes = bytes, | ||
153 | .ret = NOT_DONE, | ||
154 | @@ -XXX,XX +XXX,XX @@ int bdrv_pdiscard(BlockDriverState *bs, int64_t offset, int bytes) | ||
155 | bdrv_pdiscard_co_entry(&rwco); | ||
156 | } else { | ||
157 | co = qemu_coroutine_create(bdrv_pdiscard_co_entry, &rwco); | ||
158 | - bdrv_coroutine_enter(bs, co); | ||
159 | - BDRV_POLL_WHILE(bs, rwco.ret == NOT_DONE); | ||
160 | + bdrv_coroutine_enter(child->bs, co); | ||
161 | + BDRV_POLL_WHILE(child->bs, rwco.ret == NOT_DONE); | ||
162 | } | ||
163 | |||
164 | return rwco.ret; | ||
165 | diff --git a/block/mirror.c b/block/mirror.c | ||
166 | index XXXXXXX..XXXXXXX 100644 | ||
167 | --- a/block/mirror.c | ||
168 | +++ b/block/mirror.c | ||
169 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_mirror_top_do_write(BlockDriverState *bs, | ||
170 | break; | ||
171 | |||
172 | case MIRROR_METHOD_DISCARD: | ||
173 | - ret = bdrv_co_pdiscard(bs->backing->bs, offset, bytes); | ||
174 | + ret = bdrv_co_pdiscard(bs->backing, offset, bytes); | ||
175 | break; | ||
176 | |||
177 | default: | ||
178 | diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c | ||
179 | index XXXXXXX..XXXXXXX 100644 | ||
180 | --- a/block/qcow2-refcount.c | ||
181 | +++ b/block/qcow2-refcount.c | ||
182 | @@ -XXX,XX +XXX,XX @@ void qcow2_process_discards(BlockDriverState *bs, int ret) | ||
183 | |||
184 | /* Discard is optional, ignore the return value */ | ||
185 | if (ret >= 0) { | ||
186 | - bdrv_pdiscard(bs->file->bs, d->offset, d->bytes); | ||
187 | + bdrv_pdiscard(bs->file, d->offset, d->bytes); | ||
188 | } | ||
189 | |||
190 | g_free(d); | ||
191 | diff --git a/block/raw-format.c b/block/raw-format.c | ||
192 | index XXXXXXX..XXXXXXX 100644 | ||
193 | --- a/block/raw-format.c | ||
194 | +++ b/block/raw-format.c | ||
195 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn raw_co_pdiscard(BlockDriverState *bs, | ||
196 | if (ret) { | ||
197 | return ret; | 32 | return ret; |
198 | } | 33 | } |
199 | - return bdrv_co_pdiscard(bs->file->bs, offset, bytes); | ||
200 | + return bdrv_co_pdiscard(bs->file, offset, bytes); | ||
201 | } | ||
202 | |||
203 | static int64_t raw_getlength(BlockDriverState *bs) | ||
204 | diff --git a/block/throttle.c b/block/throttle.c | ||
205 | index XXXXXXX..XXXXXXX 100644 | ||
206 | --- a/block/throttle.c | ||
207 | +++ b/block/throttle.c | ||
208 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn throttle_co_pdiscard(BlockDriverState *bs, | ||
209 | ThrottleGroupMember *tgm = bs->opaque; | ||
210 | throttle_group_co_io_limits_intercept(tgm, bytes, true); | ||
211 | |||
212 | - return bdrv_co_pdiscard(bs->file->bs, offset, bytes); | ||
213 | + return bdrv_co_pdiscard(bs->file, offset, bytes); | ||
214 | } | ||
215 | |||
216 | static int throttle_co_flush(BlockDriverState *bs) | ||
217 | -- | 34 | -- |
218 | 2.13.6 | 35 | 2.20.1 |
219 | 36 | ||
220 | 37 | diff view generated by jsdifflib |
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | Serialized writes should be used in copy-on-write of backup(sync=none) | ||
4 | for image fleecing scheme. | ||
5 | |||
6 | We need to change an assert in bdrv_aligned_pwritev, added in | ||
7 | 28de2dcd88de. The assert may fail now, because call to | ||
8 | wait_serialising_requests here may become first call to it for this | ||
9 | request with serializing flag set. It occurs if the request is aligned | ||
10 | (otherwise, we should already set serializing flag before calling | ||
11 | bdrv_aligned_pwritev and correspondingly waited for all intersecting | ||
12 | requests). However, for aligned requests, we should not care about | ||
13 | outdating of previously read data, as there no such data. Therefore, | ||
14 | let's just update an assert to not care about aligned requests. | ||
15 | |||
16 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 3 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
17 | Reviewed-by: Fam Zheng <famz@redhat.com> | 4 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> |
5 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> | ||
18 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
19 | --- | 7 | --- |
20 | include/block/block.h | 14 +++++++++++++- | 8 | block/stream.c | 4 +--- |
21 | block/io.c | 28 +++++++++++++++++++++++++++- | 9 | 1 file changed, 1 insertion(+), 3 deletions(-) |
22 | 2 files changed, 40 insertions(+), 2 deletions(-) | ||
23 | 10 | ||
24 | diff --git a/include/block/block.h b/include/block/block.h | 11 | diff --git a/block/stream.c b/block/stream.c |
25 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/include/block/block.h | 13 | --- a/block/stream.c |
27 | +++ b/include/block/block.h | 14 | +++ b/block/stream.c |
28 | @@ -XXX,XX +XXX,XX @@ typedef enum { | 15 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn stream_populate(BlockBackend *blk, |
29 | * content. */ | 16 | int64_t offset, uint64_t bytes, |
30 | BDRV_REQ_WRITE_UNCHANGED = 0x40, | 17 | void *buf) |
31 | 18 | { | |
32 | + /* | 19 | - QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); |
33 | + * BDRV_REQ_SERIALISING forces request serialisation for writes. | 20 | - |
34 | + * It is used to ensure that writes to the backing file of a backup process | 21 | assert(bytes < SIZE_MAX); |
35 | + * target cannot race with a read of the backup target that defers to the | 22 | |
36 | + * backing file. | 23 | /* Copy-on-read the unallocated clusters */ |
37 | + * | 24 | - return blk_co_preadv(blk, offset, qiov.size, &qiov, BDRV_REQ_COPY_ON_READ); |
38 | + * Note, that BDRV_REQ_SERIALISING is _not_ opposite in meaning to | 25 | + return blk_co_pread(blk, offset, bytes, buf, BDRV_REQ_COPY_ON_READ); |
39 | + * BDRV_REQ_NO_SERIALISING. A more descriptive name for the latter might be | ||
40 | + * _DO_NOT_WAIT_FOR_SERIALISING, except that is too long. | ||
41 | + */ | ||
42 | + BDRV_REQ_SERIALISING = 0x80, | ||
43 | + | ||
44 | /* Mask of valid flags */ | ||
45 | - BDRV_REQ_MASK = 0x7f, | ||
46 | + BDRV_REQ_MASK = 0xff, | ||
47 | } BdrvRequestFlags; | ||
48 | |||
49 | typedef struct BlockSizes { | ||
50 | diff --git a/block/io.c b/block/io.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/block/io.c | ||
53 | +++ b/block/io.c | ||
54 | @@ -XXX,XX +XXX,XX @@ static void mark_request_serialising(BdrvTrackedRequest *req, uint64_t align) | ||
55 | req->overlap_bytes = MAX(req->overlap_bytes, overlap_bytes); | ||
56 | } | 26 | } |
57 | 27 | ||
58 | +static bool is_request_serialising_and_aligned(BdrvTrackedRequest *req) | 28 | static void stream_abort(Job *job) |
59 | +{ | ||
60 | + /* | ||
61 | + * If the request is serialising, overlap_offset and overlap_bytes are set, | ||
62 | + * so we can check if the request is aligned. Otherwise, don't care and | ||
63 | + * return false. | ||
64 | + */ | ||
65 | + | ||
66 | + return req->serialising && (req->offset == req->overlap_offset) && | ||
67 | + (req->bytes == req->overlap_bytes); | ||
68 | +} | ||
69 | + | ||
70 | /** | ||
71 | * Round a region to cluster boundaries | ||
72 | */ | ||
73 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_aligned_preadv(BdrvChild *child, | ||
74 | mark_request_serialising(req, bdrv_get_cluster_size(bs)); | ||
75 | } | ||
76 | |||
77 | + /* BDRV_REQ_SERIALISING is only for write operation */ | ||
78 | + assert(!(flags & BDRV_REQ_SERIALISING)); | ||
79 | + | ||
80 | if (!(flags & BDRV_REQ_NO_SERIALISING)) { | ||
81 | wait_serialising_requests(req); | ||
82 | } | ||
83 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child, | ||
84 | |||
85 | /* BDRV_REQ_NO_SERIALISING is only for read operation */ | ||
86 | assert(!(flags & BDRV_REQ_NO_SERIALISING)); | ||
87 | + | ||
88 | + if (flags & BDRV_REQ_SERIALISING) { | ||
89 | + mark_request_serialising(req, bdrv_get_cluster_size(bs)); | ||
90 | + } | ||
91 | + | ||
92 | waited = wait_serialising_requests(req); | ||
93 | - assert(!waited || !req->serialising); | ||
94 | + assert(!waited || !req->serialising || | ||
95 | + is_request_serialising_and_aligned(req)); | ||
96 | assert(req->overlap_offset <= offset); | ||
97 | assert(offset + bytes <= req->overlap_offset + req->overlap_bytes); | ||
98 | if (flags & BDRV_REQ_WRITE_UNCHANGED) { | ||
99 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_co_copy_range_internal( | ||
100 | tracked_request_begin(&req, src->bs, src_offset, bytes, | ||
101 | BDRV_TRACKED_READ); | ||
102 | |||
103 | + /* BDRV_REQ_SERIALISING is only for write operation */ | ||
104 | + assert(!(read_flags & BDRV_REQ_SERIALISING)); | ||
105 | if (!(read_flags & BDRV_REQ_NO_SERIALISING)) { | ||
106 | wait_serialising_requests(&req); | ||
107 | } | ||
108 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_co_copy_range_internal( | ||
109 | |||
110 | /* BDRV_REQ_NO_SERIALISING is only for read operation */ | ||
111 | assert(!(write_flags & BDRV_REQ_NO_SERIALISING)); | ||
112 | + if (write_flags & BDRV_REQ_SERIALISING) { | ||
113 | + mark_request_serialising(&req, bdrv_get_cluster_size(dst->bs)); | ||
114 | + } | ||
115 | wait_serialising_requests(&req); | ||
116 | |||
117 | ret = dst->bs->drv->bdrv_co_copy_range_to(dst->bs, | ||
118 | -- | 29 | -- |
119 | 2.13.6 | 30 | 2.20.1 |
120 | 31 | ||
121 | 32 | diff view generated by jsdifflib |
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | Pass read flags and write flags separately. This is needed to handle | ||
4 | coming BDRV_REQ_NO_SERIALISING clearly in following patches. | ||
5 | |||
6 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 3 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
7 | Reviewed-by: Fam Zheng <famz@redhat.com> | 4 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> |
5 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> | ||
8 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
9 | --- | 7 | --- |
10 | include/block/block.h | 3 ++- | 8 | qemu-img.c | 13 ++++--------- |
11 | include/block/block_int.h | 14 +++++++++---- | 9 | 1 file changed, 4 insertions(+), 9 deletions(-) |
12 | include/sysemu/block-backend.h | 3 ++- | ||
13 | block/backup.c | 2 +- | ||
14 | block/block-backend.c | 5 +++-- | ||
15 | block/file-posix.c | 21 +++++++++++-------- | ||
16 | block/io.c | 46 +++++++++++++++++++++++------------------- | ||
17 | block/iscsi.c | 9 ++++++--- | ||
18 | block/qcow2.c | 20 +++++++++--------- | ||
19 | block/raw-format.c | 24 ++++++++++++++-------- | ||
20 | qemu-img.c | 2 +- | ||
21 | 11 files changed, 90 insertions(+), 59 deletions(-) | ||
22 | 10 | ||
23 | diff --git a/include/block/block.h b/include/block/block.h | ||
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/include/block/block.h | ||
26 | +++ b/include/block/block.h | ||
27 | @@ -XXX,XX +XXX,XX @@ void bdrv_unregister_buf(BlockDriverState *bs, void *host); | ||
28 | **/ | ||
29 | int coroutine_fn bdrv_co_copy_range(BdrvChild *src, uint64_t src_offset, | ||
30 | BdrvChild *dst, uint64_t dst_offset, | ||
31 | - uint64_t bytes, BdrvRequestFlags flags); | ||
32 | + uint64_t bytes, BdrvRequestFlags read_flags, | ||
33 | + BdrvRequestFlags write_flags); | ||
34 | #endif | ||
35 | diff --git a/include/block/block_int.h b/include/block/block_int.h | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/include/block/block_int.h | ||
38 | +++ b/include/block/block_int.h | ||
39 | @@ -XXX,XX +XXX,XX @@ struct BlockDriver { | ||
40 | BdrvChild *dst, | ||
41 | uint64_t dst_offset, | ||
42 | uint64_t bytes, | ||
43 | - BdrvRequestFlags flags); | ||
44 | + BdrvRequestFlags read_flags, | ||
45 | + BdrvRequestFlags write_flags); | ||
46 | |||
47 | /* Map [offset, offset + nbytes) range onto a child of bs to copy data to, | ||
48 | * and invoke bdrv_co_copy_range_to(child, src, ...), or perform the copy | ||
49 | @@ -XXX,XX +XXX,XX @@ struct BlockDriver { | ||
50 | BdrvChild *dst, | ||
51 | uint64_t dst_offset, | ||
52 | uint64_t bytes, | ||
53 | - BdrvRequestFlags flags); | ||
54 | + BdrvRequestFlags read_flags, | ||
55 | + BdrvRequestFlags write_flags); | ||
56 | |||
57 | /* | ||
58 | * Building block for bdrv_block_status[_above] and | ||
59 | @@ -XXX,XX +XXX,XX @@ void blockdev_close_all_bdrv_states(void); | ||
60 | |||
61 | int coroutine_fn bdrv_co_copy_range_from(BdrvChild *src, uint64_t src_offset, | ||
62 | BdrvChild *dst, uint64_t dst_offset, | ||
63 | - uint64_t bytes, BdrvRequestFlags flags); | ||
64 | + uint64_t bytes, | ||
65 | + BdrvRequestFlags read_flags, | ||
66 | + BdrvRequestFlags write_flags); | ||
67 | int coroutine_fn bdrv_co_copy_range_to(BdrvChild *src, uint64_t src_offset, | ||
68 | BdrvChild *dst, uint64_t dst_offset, | ||
69 | - uint64_t bytes, BdrvRequestFlags flags); | ||
70 | + uint64_t bytes, | ||
71 | + BdrvRequestFlags read_flags, | ||
72 | + BdrvRequestFlags write_flags); | ||
73 | |||
74 | int refresh_total_sectors(BlockDriverState *bs, int64_t hint); | ||
75 | |||
76 | diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h | ||
77 | index XXXXXXX..XXXXXXX 100644 | ||
78 | --- a/include/sysemu/block-backend.h | ||
79 | +++ b/include/sysemu/block-backend.h | ||
80 | @@ -XXX,XX +XXX,XX @@ void blk_unregister_buf(BlockBackend *blk, void *host); | ||
81 | |||
82 | int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in, | ||
83 | BlockBackend *blk_out, int64_t off_out, | ||
84 | - int bytes, BdrvRequestFlags flags); | ||
85 | + int bytes, BdrvRequestFlags read_flags, | ||
86 | + BdrvRequestFlags write_flags); | ||
87 | |||
88 | #endif | ||
89 | diff --git a/block/backup.c b/block/backup.c | ||
90 | index XXXXXXX..XXXXXXX 100644 | ||
91 | --- a/block/backup.c | ||
92 | +++ b/block/backup.c | ||
93 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn backup_cow_with_offload(BackupBlockJob *job, | ||
94 | hbitmap_reset(job->copy_bitmap, start / job->cluster_size, | ||
95 | nr_clusters); | ||
96 | ret = blk_co_copy_range(blk, start, job->target, start, nbytes, | ||
97 | - is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0); | ||
98 | + is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0, 0); | ||
99 | if (ret < 0) { | ||
100 | trace_backup_do_cow_copy_range_fail(job, start, ret); | ||
101 | hbitmap_set(job->copy_bitmap, start / job->cluster_size, | ||
102 | diff --git a/block/block-backend.c b/block/block-backend.c | ||
103 | index XXXXXXX..XXXXXXX 100644 | ||
104 | --- a/block/block-backend.c | ||
105 | +++ b/block/block-backend.c | ||
106 | @@ -XXX,XX +XXX,XX @@ void blk_unregister_buf(BlockBackend *blk, void *host) | ||
107 | |||
108 | int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in, | ||
109 | BlockBackend *blk_out, int64_t off_out, | ||
110 | - int bytes, BdrvRequestFlags flags) | ||
111 | + int bytes, BdrvRequestFlags read_flags, | ||
112 | + BdrvRequestFlags write_flags) | ||
113 | { | ||
114 | int r; | ||
115 | r = blk_check_byte_request(blk_in, off_in, bytes); | ||
116 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in, | ||
117 | } | ||
118 | return bdrv_co_copy_range(blk_in->root, off_in, | ||
119 | blk_out->root, off_out, | ||
120 | - bytes, flags); | ||
121 | + bytes, read_flags, write_flags); | ||
122 | } | ||
123 | diff --git a/block/file-posix.c b/block/file-posix.c | ||
124 | index XXXXXXX..XXXXXXX 100644 | ||
125 | --- a/block/file-posix.c | ||
126 | +++ b/block/file-posix.c | ||
127 | @@ -XXX,XX +XXX,XX @@ static void raw_abort_perm_update(BlockDriverState *bs) | ||
128 | raw_handle_perm_lock(bs, RAW_PL_ABORT, 0, 0, NULL); | ||
129 | } | ||
130 | |||
131 | -static int coroutine_fn raw_co_copy_range_from(BlockDriverState *bs, | ||
132 | - BdrvChild *src, uint64_t src_offset, | ||
133 | - BdrvChild *dst, uint64_t dst_offset, | ||
134 | - uint64_t bytes, BdrvRequestFlags flags) | ||
135 | +static int coroutine_fn raw_co_copy_range_from( | ||
136 | + BlockDriverState *bs, BdrvChild *src, uint64_t src_offset, | ||
137 | + BdrvChild *dst, uint64_t dst_offset, uint64_t bytes, | ||
138 | + BdrvRequestFlags read_flags, BdrvRequestFlags write_flags) | ||
139 | { | ||
140 | - return bdrv_co_copy_range_to(src, src_offset, dst, dst_offset, bytes, flags); | ||
141 | + return bdrv_co_copy_range_to(src, src_offset, dst, dst_offset, bytes, | ||
142 | + read_flags, write_flags); | ||
143 | } | ||
144 | |||
145 | static int coroutine_fn raw_co_copy_range_to(BlockDriverState *bs, | ||
146 | - BdrvChild *src, uint64_t src_offset, | ||
147 | - BdrvChild *dst, uint64_t dst_offset, | ||
148 | - uint64_t bytes, BdrvRequestFlags flags) | ||
149 | + BdrvChild *src, | ||
150 | + uint64_t src_offset, | ||
151 | + BdrvChild *dst, | ||
152 | + uint64_t dst_offset, | ||
153 | + uint64_t bytes, | ||
154 | + BdrvRequestFlags read_flags, | ||
155 | + BdrvRequestFlags write_flags) | ||
156 | { | ||
157 | BDRVRawState *s = bs->opaque; | ||
158 | BDRVRawState *src_s; | ||
159 | diff --git a/block/io.c b/block/io.c | ||
160 | index XXXXXXX..XXXXXXX 100644 | ||
161 | --- a/block/io.c | ||
162 | +++ b/block/io.c | ||
163 | @@ -XXX,XX +XXX,XX @@ void bdrv_unregister_buf(BlockDriverState *bs, void *host) | ||
164 | } | ||
165 | } | ||
166 | |||
167 | -static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src, | ||
168 | - uint64_t src_offset, | ||
169 | - BdrvChild *dst, | ||
170 | - uint64_t dst_offset, | ||
171 | - uint64_t bytes, | ||
172 | - BdrvRequestFlags flags, | ||
173 | - bool recurse_src) | ||
174 | +static int coroutine_fn bdrv_co_copy_range_internal( | ||
175 | + BdrvChild *src, uint64_t src_offset, BdrvChild *dst, | ||
176 | + uint64_t dst_offset, uint64_t bytes, | ||
177 | + BdrvRequestFlags read_flags, BdrvRequestFlags write_flags, | ||
178 | + bool recurse_src) | ||
179 | { | ||
180 | BdrvTrackedRequest req; | ||
181 | int ret; | ||
182 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src, | ||
183 | if (ret) { | ||
184 | return ret; | ||
185 | } | ||
186 | - if (flags & BDRV_REQ_ZERO_WRITE) { | ||
187 | - return bdrv_co_pwrite_zeroes(dst, dst_offset, bytes, flags); | ||
188 | + if (write_flags & BDRV_REQ_ZERO_WRITE) { | ||
189 | + return bdrv_co_pwrite_zeroes(dst, dst_offset, bytes, write_flags); | ||
190 | } | ||
191 | |||
192 | if (!src || !src->bs) { | ||
193 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src, | ||
194 | tracked_request_begin(&req, src->bs, src_offset, bytes, | ||
195 | BDRV_TRACKED_READ); | ||
196 | |||
197 | - if (!(flags & BDRV_REQ_NO_SERIALISING)) { | ||
198 | + if (!(read_flags & BDRV_REQ_NO_SERIALISING)) { | ||
199 | wait_serialising_requests(&req); | ||
200 | } | ||
201 | |||
202 | ret = src->bs->drv->bdrv_co_copy_range_from(src->bs, | ||
203 | src, src_offset, | ||
204 | dst, dst_offset, | ||
205 | - bytes, flags); | ||
206 | + bytes, | ||
207 | + read_flags, write_flags); | ||
208 | |||
209 | tracked_request_end(&req); | ||
210 | bdrv_dec_in_flight(src->bs); | ||
211 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src, | ||
212 | tracked_request_begin(&req, dst->bs, dst_offset, bytes, | ||
213 | BDRV_TRACKED_WRITE); | ||
214 | |||
215 | - /* BDRV_REQ_NO_SERIALISING is only for read operation, | ||
216 | - * so we ignore it in flags. | ||
217 | - */ | ||
218 | + /* BDRV_REQ_NO_SERIALISING is only for read operation */ | ||
219 | + assert(!(write_flags & BDRV_REQ_NO_SERIALISING)); | ||
220 | wait_serialising_requests(&req); | ||
221 | |||
222 | ret = dst->bs->drv->bdrv_co_copy_range_to(dst->bs, | ||
223 | src, src_offset, | ||
224 | dst, dst_offset, | ||
225 | - bytes, flags); | ||
226 | + bytes, | ||
227 | + read_flags, write_flags); | ||
228 | |||
229 | tracked_request_end(&req); | ||
230 | bdrv_dec_in_flight(dst->bs); | ||
231 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src, | ||
232 | * semantics. */ | ||
233 | int coroutine_fn bdrv_co_copy_range_from(BdrvChild *src, uint64_t src_offset, | ||
234 | BdrvChild *dst, uint64_t dst_offset, | ||
235 | - uint64_t bytes, BdrvRequestFlags flags) | ||
236 | + uint64_t bytes, | ||
237 | + BdrvRequestFlags read_flags, | ||
238 | + BdrvRequestFlags write_flags) | ||
239 | { | ||
240 | return bdrv_co_copy_range_internal(src, src_offset, dst, dst_offset, | ||
241 | - bytes, flags, true); | ||
242 | + bytes, read_flags, write_flags, true); | ||
243 | } | ||
244 | |||
245 | /* Copy range from @src to @dst. | ||
246 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_copy_range_from(BdrvChild *src, uint64_t src_offset, | ||
247 | * semantics. */ | ||
248 | int coroutine_fn bdrv_co_copy_range_to(BdrvChild *src, uint64_t src_offset, | ||
249 | BdrvChild *dst, uint64_t dst_offset, | ||
250 | - uint64_t bytes, BdrvRequestFlags flags) | ||
251 | + uint64_t bytes, | ||
252 | + BdrvRequestFlags read_flags, | ||
253 | + BdrvRequestFlags write_flags) | ||
254 | { | ||
255 | return bdrv_co_copy_range_internal(src, src_offset, dst, dst_offset, | ||
256 | - bytes, flags, false); | ||
257 | + bytes, read_flags, write_flags, false); | ||
258 | } | ||
259 | |||
260 | int coroutine_fn bdrv_co_copy_range(BdrvChild *src, uint64_t src_offset, | ||
261 | BdrvChild *dst, uint64_t dst_offset, | ||
262 | - uint64_t bytes, BdrvRequestFlags flags) | ||
263 | + uint64_t bytes, BdrvRequestFlags read_flags, | ||
264 | + BdrvRequestFlags write_flags) | ||
265 | { | ||
266 | return bdrv_co_copy_range_from(src, src_offset, | ||
267 | dst, dst_offset, | ||
268 | - bytes, flags); | ||
269 | + bytes, read_flags, write_flags); | ||
270 | } | ||
271 | |||
272 | static void bdrv_parent_cb_resize(BlockDriverState *bs) | ||
273 | diff --git a/block/iscsi.c b/block/iscsi.c | ||
274 | index XXXXXXX..XXXXXXX 100644 | ||
275 | --- a/block/iscsi.c | ||
276 | +++ b/block/iscsi.c | ||
277 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn iscsi_co_copy_range_from(BlockDriverState *bs, | ||
278 | BdrvChild *dst, | ||
279 | uint64_t dst_offset, | ||
280 | uint64_t bytes, | ||
281 | - BdrvRequestFlags flags) | ||
282 | + BdrvRequestFlags read_flags, | ||
283 | + BdrvRequestFlags write_flags) | ||
284 | { | ||
285 | - return bdrv_co_copy_range_to(src, src_offset, dst, dst_offset, bytes, flags); | ||
286 | + return bdrv_co_copy_range_to(src, src_offset, dst, dst_offset, bytes, | ||
287 | + read_flags, write_flags); | ||
288 | } | ||
289 | |||
290 | static struct scsi_task *iscsi_xcopy_task(int param_len) | ||
291 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn iscsi_co_copy_range_to(BlockDriverState *bs, | ||
292 | BdrvChild *dst, | ||
293 | uint64_t dst_offset, | ||
294 | uint64_t bytes, | ||
295 | - BdrvRequestFlags flags) | ||
296 | + BdrvRequestFlags read_flags, | ||
297 | + BdrvRequestFlags write_flags) | ||
298 | { | ||
299 | IscsiLun *dst_lun = dst->bs->opaque; | ||
300 | IscsiLun *src_lun; | ||
301 | diff --git a/block/qcow2.c b/block/qcow2.c | ||
302 | index XXXXXXX..XXXXXXX 100644 | ||
303 | --- a/block/qcow2.c | ||
304 | +++ b/block/qcow2.c | ||
305 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn | ||
306 | qcow2_co_copy_range_from(BlockDriverState *bs, | ||
307 | BdrvChild *src, uint64_t src_offset, | ||
308 | BdrvChild *dst, uint64_t dst_offset, | ||
309 | - uint64_t bytes, BdrvRequestFlags flags) | ||
310 | + uint64_t bytes, BdrvRequestFlags read_flags, | ||
311 | + BdrvRequestFlags write_flags) | ||
312 | { | ||
313 | BDRVQcow2State *s = bs->opaque; | ||
314 | int ret; | ||
315 | unsigned int cur_bytes; /* number of bytes in current iteration */ | ||
316 | BdrvChild *child = NULL; | ||
317 | - BdrvRequestFlags cur_flags; | ||
318 | + BdrvRequestFlags cur_write_flags; | ||
319 | |||
320 | assert(!bs->encrypted); | ||
321 | qemu_co_mutex_lock(&s->lock); | ||
322 | @@ -XXX,XX +XXX,XX @@ qcow2_co_copy_range_from(BlockDriverState *bs, | ||
323 | uint64_t copy_offset = 0; | ||
324 | /* prepare next request */ | ||
325 | cur_bytes = MIN(bytes, INT_MAX); | ||
326 | - cur_flags = flags; | ||
327 | + cur_write_flags = write_flags; | ||
328 | |||
329 | ret = qcow2_get_cluster_offset(bs, src_offset, &cur_bytes, ©_offset); | ||
330 | if (ret < 0) { | ||
331 | @@ -XXX,XX +XXX,XX @@ qcow2_co_copy_range_from(BlockDriverState *bs, | ||
332 | if (bs->backing && bs->backing->bs) { | ||
333 | int64_t backing_length = bdrv_getlength(bs->backing->bs); | ||
334 | if (src_offset >= backing_length) { | ||
335 | - cur_flags |= BDRV_REQ_ZERO_WRITE; | ||
336 | + cur_write_flags |= BDRV_REQ_ZERO_WRITE; | ||
337 | } else { | ||
338 | child = bs->backing; | ||
339 | cur_bytes = MIN(cur_bytes, backing_length - src_offset); | ||
340 | copy_offset = src_offset; | ||
341 | } | ||
342 | } else { | ||
343 | - cur_flags |= BDRV_REQ_ZERO_WRITE; | ||
344 | + cur_write_flags |= BDRV_REQ_ZERO_WRITE; | ||
345 | } | ||
346 | break; | ||
347 | |||
348 | case QCOW2_CLUSTER_ZERO_PLAIN: | ||
349 | case QCOW2_CLUSTER_ZERO_ALLOC: | ||
350 | - cur_flags |= BDRV_REQ_ZERO_WRITE; | ||
351 | + cur_write_flags |= BDRV_REQ_ZERO_WRITE; | ||
352 | break; | ||
353 | |||
354 | case QCOW2_CLUSTER_COMPRESSED: | ||
355 | @@ -XXX,XX +XXX,XX @@ qcow2_co_copy_range_from(BlockDriverState *bs, | ||
356 | ret = bdrv_co_copy_range_from(child, | ||
357 | copy_offset, | ||
358 | dst, dst_offset, | ||
359 | - cur_bytes, cur_flags); | ||
360 | + cur_bytes, read_flags, cur_write_flags); | ||
361 | qemu_co_mutex_lock(&s->lock); | ||
362 | if (ret < 0) { | ||
363 | goto out; | ||
364 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn | ||
365 | qcow2_co_copy_range_to(BlockDriverState *bs, | ||
366 | BdrvChild *src, uint64_t src_offset, | ||
367 | BdrvChild *dst, uint64_t dst_offset, | ||
368 | - uint64_t bytes, BdrvRequestFlags flags) | ||
369 | + uint64_t bytes, BdrvRequestFlags read_flags, | ||
370 | + BdrvRequestFlags write_flags) | ||
371 | { | ||
372 | BDRVQcow2State *s = bs->opaque; | ||
373 | int offset_in_cluster; | ||
374 | @@ -XXX,XX +XXX,XX @@ qcow2_co_copy_range_to(BlockDriverState *bs, | ||
375 | ret = bdrv_co_copy_range_to(src, src_offset, | ||
376 | bs->file, | ||
377 | cluster_offset + offset_in_cluster, | ||
378 | - cur_bytes, flags); | ||
379 | + cur_bytes, read_flags, write_flags); | ||
380 | qemu_co_mutex_lock(&s->lock); | ||
381 | if (ret < 0) { | ||
382 | goto fail; | ||
383 | diff --git a/block/raw-format.c b/block/raw-format.c | ||
384 | index XXXXXXX..XXXXXXX 100644 | ||
385 | --- a/block/raw-format.c | ||
386 | +++ b/block/raw-format.c | ||
387 | @@ -XXX,XX +XXX,XX @@ static int raw_probe_geometry(BlockDriverState *bs, HDGeometry *geo) | ||
388 | } | ||
389 | |||
390 | static int coroutine_fn raw_co_copy_range_from(BlockDriverState *bs, | ||
391 | - BdrvChild *src, uint64_t src_offset, | ||
392 | - BdrvChild *dst, uint64_t dst_offset, | ||
393 | - uint64_t bytes, BdrvRequestFlags flags) | ||
394 | + BdrvChild *src, | ||
395 | + uint64_t src_offset, | ||
396 | + BdrvChild *dst, | ||
397 | + uint64_t dst_offset, | ||
398 | + uint64_t bytes, | ||
399 | + BdrvRequestFlags read_flags, | ||
400 | + BdrvRequestFlags write_flags) | ||
401 | { | ||
402 | int ret; | ||
403 | |||
404 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn raw_co_copy_range_from(BlockDriverState *bs, | ||
405 | return ret; | ||
406 | } | ||
407 | return bdrv_co_copy_range_from(bs->file, src_offset, dst, dst_offset, | ||
408 | - bytes, flags); | ||
409 | + bytes, read_flags, write_flags); | ||
410 | } | ||
411 | |||
412 | static int coroutine_fn raw_co_copy_range_to(BlockDriverState *bs, | ||
413 | - BdrvChild *src, uint64_t src_offset, | ||
414 | - BdrvChild *dst, uint64_t dst_offset, | ||
415 | - uint64_t bytes, BdrvRequestFlags flags) | ||
416 | + BdrvChild *src, | ||
417 | + uint64_t src_offset, | ||
418 | + BdrvChild *dst, | ||
419 | + uint64_t dst_offset, | ||
420 | + uint64_t bytes, | ||
421 | + BdrvRequestFlags read_flags, | ||
422 | + BdrvRequestFlags write_flags) | ||
423 | { | ||
424 | int ret; | ||
425 | |||
426 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn raw_co_copy_range_to(BlockDriverState *bs, | ||
427 | return ret; | ||
428 | } | ||
429 | return bdrv_co_copy_range_to(src, src_offset, bs->file, dst_offset, bytes, | ||
430 | - flags); | ||
431 | + read_flags, write_flags); | ||
432 | } | ||
433 | |||
434 | BlockDriver bdrv_raw = { | ||
435 | diff --git a/qemu-img.c b/qemu-img.c | 11 | diff --git a/qemu-img.c b/qemu-img.c |
436 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
437 | --- a/qemu-img.c | 13 | --- a/qemu-img.c |
438 | +++ b/qemu-img.c | 14 | +++ b/qemu-img.c |
439 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn convert_co_copy_range(ImgConvertState *s, int64_t sector | 15 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn convert_co_read(ImgConvertState *s, int64_t sector_num, |
440 | 16 | int nb_sectors, uint8_t *buf) | |
441 | ret = blk_co_copy_range(blk, offset, s->target, | 17 | { |
442 | sector_num << BDRV_SECTOR_BITS, | 18 | int n, ret; |
443 | - n << BDRV_SECTOR_BITS, 0); | 19 | - QEMUIOVector qiov; |
444 | + n << BDRV_SECTOR_BITS, 0, 0); | 20 | |
21 | assert(nb_sectors <= s->buf_sectors); | ||
22 | while (nb_sectors > 0) { | ||
23 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn convert_co_read(ImgConvertState *s, int64_t sector_num, | ||
24 | bs_sectors = s->src_sectors[src_cur]; | ||
25 | |||
26 | n = MIN(nb_sectors, bs_sectors - (sector_num - src_cur_offset)); | ||
27 | - qemu_iovec_init_buf(&qiov, buf, n << BDRV_SECTOR_BITS); | ||
28 | |||
29 | - ret = blk_co_preadv( | ||
30 | + ret = blk_co_pread( | ||
31 | blk, (sector_num - src_cur_offset) << BDRV_SECTOR_BITS, | ||
32 | - n << BDRV_SECTOR_BITS, &qiov, 0); | ||
33 | + n << BDRV_SECTOR_BITS, buf, 0); | ||
445 | if (ret < 0) { | 34 | if (ret < 0) { |
446 | return ret; | 35 | return ret; |
447 | } | 36 | } |
37 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn convert_co_write(ImgConvertState *s, int64_t sector_num, | ||
38 | enum ImgConvertBlockStatus status) | ||
39 | { | ||
40 | int ret; | ||
41 | - QEMUIOVector qiov; | ||
42 | |||
43 | while (nb_sectors > 0) { | ||
44 | int n = nb_sectors; | ||
45 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn convert_co_write(ImgConvertState *s, int64_t sector_num, | ||
46 | (s->compressed && | ||
47 | !buffer_is_zero(buf, n * BDRV_SECTOR_SIZE))) | ||
48 | { | ||
49 | - qemu_iovec_init_buf(&qiov, buf, n << BDRV_SECTOR_BITS); | ||
50 | - | ||
51 | - ret = blk_co_pwritev(s->target, sector_num << BDRV_SECTOR_BITS, | ||
52 | - n << BDRV_SECTOR_BITS, &qiov, flags); | ||
53 | + ret = blk_co_pwrite(s->target, sector_num << BDRV_SECTOR_BITS, | ||
54 | + n << BDRV_SECTOR_BITS, buf, flags); | ||
55 | if (ret < 0) { | ||
56 | return ret; | ||
57 | } | ||
448 | -- | 58 | -- |
449 | 2.13.6 | 59 | 2.20.1 |
450 | 60 | ||
451 | 61 | diff view generated by jsdifflib |
1 | From: Fam Zheng <famz@redhat.com> | 1 | From: Alberto Garcia <berto@igalia.com> |
---|---|---|---|
2 | 2 | ||
3 | Luks needs special parameters to operate the image. Since this test is | 3 | You can reproduce this by passing an invalid filter-node-name (like |
4 | focusing on image fleecing, skip skip that format. | 4 | "1234") to block-commit. In this case the base image is put in |
5 | read-write mode but is never reset back to read-only. | ||
5 | 6 | ||
6 | Signed-off-by: Fam Zheng <famz@redhat.com> | 7 | Signed-off-by: Alberto Garcia <berto@igalia.com> |
8 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
7 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 9 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
8 | --- | 10 | --- |
9 | tests/qemu-iotests/222 | 2 ++ | 11 | block/commit.c | 3 +++ |
10 | 1 file changed, 2 insertions(+) | 12 | 1 file changed, 3 insertions(+) |
11 | 13 | ||
12 | diff --git a/tests/qemu-iotests/222 b/tests/qemu-iotests/222 | 14 | diff --git a/block/commit.c b/block/commit.c |
13 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/tests/qemu-iotests/222 | 16 | --- a/block/commit.c |
15 | +++ b/tests/qemu-iotests/222 | 17 | +++ b/block/commit.c |
16 | @@ -XXX,XX +XXX,XX @@ import iotests | 18 | @@ -XXX,XX +XXX,XX @@ fail: |
17 | from iotests import log, qemu_img, qemu_io, qemu_io_silent | 19 | if (s->top) { |
18 | 20 | blk_unref(s->top); | |
19 | iotests.verify_platform(['linux']) | 21 | } |
20 | +iotests.verify_image_format(supported_fmts=['qcow2', 'qcow', 'qed', 'vmdk', | 22 | + if (s->base_read_only) { |
21 | + 'vhdx', 'raw']) | 23 | + bdrv_reopen_set_read_only(base, true, NULL); |
22 | 24 | + } | |
23 | patterns = [("0x5d", "0", "64k"), | 25 | job_early_fail(&s->common.job); |
24 | ("0xd5", "1M", "64k"), | 26 | /* commit_top_bs has to be replaced after deleting the block job, |
27 | * otherwise this would fail because of lack of permissions. */ | ||
25 | -- | 28 | -- |
26 | 2.13.6 | 29 | 2.20.1 |
27 | 30 | ||
28 | 31 | diff view generated by jsdifflib |
1 | From: Alberto Garcia <berto@igalia.com> | ||
---|---|---|---|
2 | |||
3 | This tests the fix from the previous patch. | ||
4 | |||
5 | Signed-off-by: Alberto Garcia <berto@igalia.com> | ||
1 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
2 | --- | 7 | --- |
3 | tests/test-bdrv-drain.c | 43 +++++++++++++++++++++++++++++++++++++++++++ | 8 | tests/qemu-iotests/249 | 115 +++++++++++++++++++++++++++++++++++++ |
4 | 1 file changed, 43 insertions(+) | 9 | tests/qemu-iotests/249.out | 35 +++++++++++ |
10 | tests/qemu-iotests/group | 1 + | ||
11 | 3 files changed, 151 insertions(+) | ||
12 | create mode 100755 tests/qemu-iotests/249 | ||
13 | create mode 100644 tests/qemu-iotests/249.out | ||
5 | 14 | ||
6 | diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c | 15 | diff --git a/tests/qemu-iotests/249 b/tests/qemu-iotests/249 |
16 | new file mode 100755 | ||
17 | index XXXXXXX..XXXXXXX | ||
18 | --- /dev/null | ||
19 | +++ b/tests/qemu-iotests/249 | ||
20 | @@ -XXX,XX +XXX,XX @@ | ||
21 | +#!/usr/bin/env bash | ||
22 | +# | ||
23 | +# Test that a backing image is put back in read-only mode after | ||
24 | +# block-commit (both when it fails and when it succeeds). | ||
25 | +# | ||
26 | +# Copyright (C) 2019 Igalia, S.L. | ||
27 | +# | ||
28 | +# This program is free software; you can redistribute it and/or modify | ||
29 | +# it under the terms of the GNU General Public License as published by | ||
30 | +# the Free Software Foundation; either version 2 of the License, or | ||
31 | +# (at your option) any later version. | ||
32 | +# | ||
33 | +# This program is distributed in the hope that it will be useful, | ||
34 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
35 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
36 | +# GNU General Public License for more details. | ||
37 | +# | ||
38 | +# You should have received a copy of the GNU General Public License | ||
39 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
40 | +# | ||
41 | + | ||
42 | +# creator | ||
43 | +owner=berto@igalia.com | ||
44 | + | ||
45 | +seq="$(basename $0)" | ||
46 | +echo "QA output created by $seq" | ||
47 | + | ||
48 | +status=1 # failure is the default! | ||
49 | + | ||
50 | +_cleanup() | ||
51 | +{ | ||
52 | + _cleanup_test_img | ||
53 | + rm -f "$TEST_IMG.base" | ||
54 | + rm -f "$TEST_IMG.int" | ||
55 | +} | ||
56 | +trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
57 | + | ||
58 | +# get standard environment, filters and checks | ||
59 | +. ./common.rc | ||
60 | +. ./common.filter | ||
61 | +. ./common.qemu | ||
62 | + | ||
63 | +# Any format implementing BlockDriver.bdrv_change_backing_file | ||
64 | +_supported_fmt qcow2 qed | ||
65 | +_supported_proto file | ||
66 | +_supported_os Linux | ||
67 | + | ||
68 | +IMG_SIZE=1M | ||
69 | + | ||
70 | +# Create the images: base <- int <- active | ||
71 | +TEST_IMG="$TEST_IMG.base" _make_test_img $IMG_SIZE | _filter_imgfmt | ||
72 | +TEST_IMG="$TEST_IMG.int" _make_test_img -b "$TEST_IMG.base" | _filter_imgfmt | ||
73 | +_make_test_img -b "$TEST_IMG.int" | _filter_imgfmt | ||
74 | + | ||
75 | +# Launch QEMU with these two drives: | ||
76 | +# none0: base (read-only) | ||
77 | +# none1: base <- int <- active | ||
78 | +_launch_qemu -drive if=none,file="${TEST_IMG}.base",node-name=base,read-only=on \ | ||
79 | + -drive if=none,file="${TEST_IMG}",backing.node-name=int,backing.backing=base | ||
80 | + | ||
81 | +_send_qemu_cmd $QEMU_HANDLE \ | ||
82 | + "{ 'execute': 'qmp_capabilities' }" \ | ||
83 | + 'return' | ||
84 | + | ||
85 | +echo | ||
86 | +echo '=== Send a write command to a drive opened in read-only mode (1)' | ||
87 | +echo | ||
88 | +_send_qemu_cmd $QEMU_HANDLE \ | ||
89 | + "{ 'execute': 'human-monitor-command', | ||
90 | + 'arguments': {'command-line': 'qemu-io none0 \"aio_write 0 2k\"'}}" \ | ||
91 | + 'return' | ||
92 | + | ||
93 | +echo | ||
94 | +echo '=== Run block-commit on base using an invalid filter node name' | ||
95 | +echo | ||
96 | +_send_qemu_cmd $QEMU_HANDLE \ | ||
97 | + "{ 'execute': 'block-commit', | ||
98 | + 'arguments': {'job-id': 'job0', 'device': 'none1', 'top-node': 'int', | ||
99 | + 'filter-node-name': '1234'}}" \ | ||
100 | + 'error' | ||
101 | + | ||
102 | +echo | ||
103 | +echo '=== Send a write command to a drive opened in read-only mode (2)' | ||
104 | +echo | ||
105 | +_send_qemu_cmd $QEMU_HANDLE \ | ||
106 | + "{ 'execute': 'human-monitor-command', | ||
107 | + 'arguments': {'command-line': 'qemu-io none0 \"aio_write 0 2k\"'}}" \ | ||
108 | + 'return' | ||
109 | + | ||
110 | +echo | ||
111 | +echo '=== Run block-commit on base using the default filter node name' | ||
112 | +echo | ||
113 | +_send_qemu_cmd $QEMU_HANDLE \ | ||
114 | + "{ 'execute': 'block-commit', | ||
115 | + 'arguments': {'job-id': 'job0', 'device': 'none1', 'top-node': 'int'}}" \ | ||
116 | + 'return' | ||
117 | + | ||
118 | +# Wait for block-commit to finish | ||
119 | +_send_qemu_cmd $QEMU_HANDLE '' \ | ||
120 | + '"status": "null"' | ||
121 | + | ||
122 | +echo | ||
123 | +echo '=== Send a write command to a drive opened in read-only mode (3)' | ||
124 | +echo | ||
125 | +_send_qemu_cmd $QEMU_HANDLE \ | ||
126 | + "{ 'execute': 'human-monitor-command', | ||
127 | + 'arguments': {'command-line': 'qemu-io none0 \"aio_write 0 2k\"'}}" \ | ||
128 | + 'return' | ||
129 | + | ||
130 | +_cleanup_qemu | ||
131 | + | ||
132 | +# success, all done | ||
133 | +echo "*** done" | ||
134 | +rm -f $seq.full | ||
135 | +status=0 | ||
136 | diff --git a/tests/qemu-iotests/249.out b/tests/qemu-iotests/249.out | ||
137 | new file mode 100644 | ||
138 | index XXXXXXX..XXXXXXX | ||
139 | --- /dev/null | ||
140 | +++ b/tests/qemu-iotests/249.out | ||
141 | @@ -XXX,XX +XXX,XX @@ | ||
142 | +QA output created by 249 | ||
143 | +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=1048576 | ||
144 | +Formatting 'TEST_DIR/t.IMGFMT.int', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT.base | ||
145 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT.int | ||
146 | +{"return": {}} | ||
147 | + | ||
148 | +=== Send a write command to a drive opened in read-only mode (1) | ||
149 | + | ||
150 | +{"return": "Block node is read-onlyrn"} | ||
151 | + | ||
152 | +=== Run block-commit on base using an invalid filter node name | ||
153 | + | ||
154 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}} | ||
155 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "job0"}} | ||
156 | +{"error": {"class": "GenericError", "desc": "Invalid node name"}} | ||
157 | + | ||
158 | +=== Send a write command to a drive opened in read-only mode (2) | ||
159 | + | ||
160 | +{"return": "Block node is read-onlyrn"} | ||
161 | + | ||
162 | +=== Run block-commit on base using the default filter node name | ||
163 | + | ||
164 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}} | ||
165 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}} | ||
166 | +{"return": {}} | ||
167 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "job0"}} | ||
168 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "job0"}} | ||
169 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "job0", "len": 1048576, "offset": 1048576, "speed": 0, "type": "commit"}} | ||
170 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "job0"}} | ||
171 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "job0"}} | ||
172 | + | ||
173 | +=== Send a write command to a drive opened in read-only mode (3) | ||
174 | + | ||
175 | +{"return": "Block node is read-onlyrn"} | ||
176 | +*** done | ||
177 | diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group | ||
7 | index XXXXXXX..XXXXXXX 100644 | 178 | index XXXXXXX..XXXXXXX 100644 |
8 | --- a/tests/test-bdrv-drain.c | 179 | --- a/tests/qemu-iotests/group |
9 | +++ b/tests/test-bdrv-drain.c | 180 | +++ b/tests/qemu-iotests/group |
10 | @@ -XXX,XX +XXX,XX @@ static void test_detach_by_driver_cb(void) | 181 | @@ -XXX,XX +XXX,XX @@ |
11 | test_detach_indirect(false); | 182 | 246 rw auto quick |
12 | } | 183 | 247 rw auto quick |
13 | 184 | 248 rw auto quick | |
14 | +static void test_append_to_drained(void) | 185 | +249 rw auto quick |
15 | +{ | ||
16 | + BlockBackend *blk; | ||
17 | + BlockDriverState *base, *overlay; | ||
18 | + BDRVTestState *base_s, *overlay_s; | ||
19 | + | ||
20 | + blk = blk_new(BLK_PERM_ALL, BLK_PERM_ALL); | ||
21 | + base = bdrv_new_open_driver(&bdrv_test, "base", BDRV_O_RDWR, &error_abort); | ||
22 | + base_s = base->opaque; | ||
23 | + blk_insert_bs(blk, base, &error_abort); | ||
24 | + | ||
25 | + overlay = bdrv_new_open_driver(&bdrv_test, "overlay", BDRV_O_RDWR, | ||
26 | + &error_abort); | ||
27 | + overlay_s = overlay->opaque; | ||
28 | + | ||
29 | + do_drain_begin(BDRV_DRAIN, base); | ||
30 | + g_assert_cmpint(base->quiesce_counter, ==, 1); | ||
31 | + g_assert_cmpint(base_s->drain_count, ==, 1); | ||
32 | + g_assert_cmpint(base->in_flight, ==, 0); | ||
33 | + | ||
34 | + /* Takes ownership of overlay, so we don't have to unref it later */ | ||
35 | + bdrv_append(overlay, base, &error_abort); | ||
36 | + g_assert_cmpint(base->in_flight, ==, 0); | ||
37 | + g_assert_cmpint(overlay->in_flight, ==, 0); | ||
38 | + | ||
39 | + g_assert_cmpint(base->quiesce_counter, ==, 1); | ||
40 | + g_assert_cmpint(base_s->drain_count, ==, 1); | ||
41 | + g_assert_cmpint(overlay->quiesce_counter, ==, 1); | ||
42 | + g_assert_cmpint(overlay_s->drain_count, ==, 1); | ||
43 | + | ||
44 | + do_drain_end(BDRV_DRAIN, base); | ||
45 | + | ||
46 | + g_assert_cmpint(base->quiesce_counter, ==, 0); | ||
47 | + g_assert_cmpint(base_s->drain_count, ==, 0); | ||
48 | + g_assert_cmpint(overlay->quiesce_counter, ==, 0); | ||
49 | + g_assert_cmpint(overlay_s->drain_count, ==, 0); | ||
50 | + | ||
51 | + bdrv_unref(base); | ||
52 | + blk_unref(blk); | ||
53 | +} | ||
54 | + | ||
55 | int main(int argc, char **argv) | ||
56 | { | ||
57 | int ret; | ||
58 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) | ||
59 | g_test_add_func("/bdrv-drain/detach/parent_cb", test_detach_by_parent_cb); | ||
60 | g_test_add_func("/bdrv-drain/detach/driver_cb", test_detach_by_driver_cb); | ||
61 | |||
62 | + g_test_add_func("/bdrv-drain/attach/drain", test_append_to_drained); | ||
63 | + | ||
64 | ret = g_test_run(); | ||
65 | qemu_event_destroy(&done_event); | ||
66 | return ret; | ||
67 | -- | 186 | -- |
68 | 2.13.6 | 187 | 2.20.1 |
69 | 188 | ||
70 | 189 | diff view generated by jsdifflib |
1 | From: Fam Zheng <famz@redhat.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | As a mechanical refactoring patch, this is the first step towards | 3 | qed_read_table and qed_write_table use coroutine-only interfaces but |
4 | unified and more correct write code paths. This is helpful because | 4 | are not marked coroutine_fn. Happily, they are called only from |
5 | multiple BlockDriverState fields need to be updated after modifying | 5 | coroutine context, so we only need to add missed markers. |
6 | image data, and it's hard to maintain in multiple places such as copy | ||
7 | offload, discard and truncate. | ||
8 | 6 | ||
9 | Suggested-by: Kevin Wolf <kwolf@redhat.com> | 7 | Reported-by: Kevin Wolf <kwolf@redhat.com> |
10 | Signed-off-by: Fam Zheng <famz@redhat.com> | 8 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
11 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 9 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
12 | --- | 10 | --- |
13 | block/io.c | 91 +++++++++++++++++++++++++++++++++++++++----------------------- | 11 | block/qed.h | 28 ++++++++++++++++------------ |
14 | 1 file changed, 57 insertions(+), 34 deletions(-) | 12 | block/qed-check.c | 4 ++-- |
13 | block/qed-table.c | 33 ++++++++++++++++++++------------- | ||
14 | block/qed.c | 5 +++-- | ||
15 | 4 files changed, 41 insertions(+), 29 deletions(-) | ||
15 | 16 | ||
16 | diff --git a/block/io.c b/block/io.c | 17 | diff --git a/block/qed.h b/block/qed.h |
17 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/block/io.c | 19 | --- a/block/qed.h |
19 | +++ b/block/io.c | 20 | +++ b/block/qed.h |
20 | @@ -XXX,XX +XXX,XX @@ fail: | 21 | @@ -XXX,XX +XXX,XX @@ void qed_commit_l2_cache_entry(L2TableCache *l2_cache, CachedL2Table *l2_table); |
22 | /** | ||
23 | * Table I/O functions | ||
24 | */ | ||
25 | -int qed_read_l1_table_sync(BDRVQEDState *s); | ||
26 | -int qed_write_l1_table(BDRVQEDState *s, unsigned int index, unsigned int n); | ||
27 | -int qed_write_l1_table_sync(BDRVQEDState *s, unsigned int index, | ||
28 | - unsigned int n); | ||
29 | -int qed_read_l2_table_sync(BDRVQEDState *s, QEDRequest *request, | ||
30 | - uint64_t offset); | ||
31 | -int qed_read_l2_table(BDRVQEDState *s, QEDRequest *request, uint64_t offset); | ||
32 | -int qed_write_l2_table(BDRVQEDState *s, QEDRequest *request, | ||
33 | - unsigned int index, unsigned int n, bool flush); | ||
34 | -int qed_write_l2_table_sync(BDRVQEDState *s, QEDRequest *request, | ||
35 | - unsigned int index, unsigned int n, bool flush); | ||
36 | +int coroutine_fn qed_read_l1_table_sync(BDRVQEDState *s); | ||
37 | +int coroutine_fn qed_write_l1_table(BDRVQEDState *s, unsigned int index, | ||
38 | + unsigned int n); | ||
39 | +int coroutine_fn qed_write_l1_table_sync(BDRVQEDState *s, unsigned int index, | ||
40 | + unsigned int n); | ||
41 | +int coroutine_fn qed_read_l2_table_sync(BDRVQEDState *s, QEDRequest *request, | ||
42 | + uint64_t offset); | ||
43 | +int coroutine_fn qed_read_l2_table(BDRVQEDState *s, QEDRequest *request, | ||
44 | + uint64_t offset); | ||
45 | +int coroutine_fn qed_write_l2_table(BDRVQEDState *s, QEDRequest *request, | ||
46 | + unsigned int index, unsigned int n, | ||
47 | + bool flush); | ||
48 | +int coroutine_fn qed_write_l2_table_sync(BDRVQEDState *s, QEDRequest *request, | ||
49 | + unsigned int index, unsigned int n, | ||
50 | + bool flush); | ||
51 | |||
52 | /** | ||
53 | * Cluster functions | ||
54 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn qed_find_cluster(BDRVQEDState *s, QEDRequest *request, | ||
55 | /** | ||
56 | * Consistency check | ||
57 | */ | ||
58 | -int qed_check(BDRVQEDState *s, BdrvCheckResult *result, bool fix); | ||
59 | +int coroutine_fn qed_check(BDRVQEDState *s, BdrvCheckResult *result, bool fix); | ||
60 | |||
61 | QEDTable *qed_alloc_table(BDRVQEDState *s); | ||
62 | |||
63 | diff --git a/block/qed-check.c b/block/qed-check.c | ||
64 | index XXXXXXX..XXXXXXX 100644 | ||
65 | --- a/block/qed-check.c | ||
66 | +++ b/block/qed-check.c | ||
67 | @@ -XXX,XX +XXX,XX @@ static unsigned int qed_check_l2_table(QEDCheck *check, QEDTable *table) | ||
68 | /** | ||
69 | * Descend tables and check each cluster is referenced once only | ||
70 | */ | ||
71 | -static int qed_check_l1_table(QEDCheck *check, QEDTable *table) | ||
72 | +static int coroutine_fn qed_check_l1_table(QEDCheck *check, QEDTable *table) | ||
73 | { | ||
74 | BDRVQEDState *s = check->s; | ||
75 | unsigned int i, num_invalid_l1 = 0; | ||
76 | @@ -XXX,XX +XXX,XX @@ static void qed_check_mark_clean(BDRVQEDState *s, BdrvCheckResult *result) | ||
77 | } | ||
78 | |||
79 | /* Called with table_lock held. */ | ||
80 | -int qed_check(BDRVQEDState *s, BdrvCheckResult *result, bool fix) | ||
81 | +int coroutine_fn qed_check(BDRVQEDState *s, BdrvCheckResult *result, bool fix) | ||
82 | { | ||
83 | QEDCheck check = { | ||
84 | .s = s, | ||
85 | diff --git a/block/qed-table.c b/block/qed-table.c | ||
86 | index XXXXXXX..XXXXXXX 100644 | ||
87 | --- a/block/qed-table.c | ||
88 | +++ b/block/qed-table.c | ||
89 | @@ -XXX,XX +XXX,XX @@ | ||
90 | #include "qemu/bswap.h" | ||
91 | |||
92 | /* Called with table_lock held. */ | ||
93 | -static int qed_read_table(BDRVQEDState *s, uint64_t offset, QEDTable *table) | ||
94 | +static int coroutine_fn qed_read_table(BDRVQEDState *s, uint64_t offset, | ||
95 | + QEDTable *table) | ||
96 | { | ||
97 | unsigned int bytes = s->header.cluster_size * s->header.table_size; | ||
98 | |||
99 | @@ -XXX,XX +XXX,XX @@ out: | ||
100 | * | ||
101 | * Called with table_lock held. | ||
102 | */ | ||
103 | -static int qed_write_table(BDRVQEDState *s, uint64_t offset, QEDTable *table, | ||
104 | - unsigned int index, unsigned int n, bool flush) | ||
105 | +static int coroutine_fn qed_write_table(BDRVQEDState *s, uint64_t offset, | ||
106 | + QEDTable *table, unsigned int index, | ||
107 | + unsigned int n, bool flush) | ||
108 | { | ||
109 | unsigned int sector_mask = BDRV_SECTOR_SIZE / sizeof(uint64_t) - 1; | ||
110 | unsigned int start, end, i; | ||
111 | @@ -XXX,XX +XXX,XX @@ out: | ||
21 | return ret; | 112 | return ret; |
22 | } | 113 | } |
23 | 114 | ||
24 | +static inline int coroutine_fn | 115 | -int qed_read_l1_table_sync(BDRVQEDState *s) |
25 | +bdrv_co_write_req_prepare(BdrvChild *child, int64_t offset, uint64_t bytes, | 116 | +int coroutine_fn qed_read_l1_table_sync(BDRVQEDState *s) |
26 | + BdrvTrackedRequest *req, int flags) | ||
27 | +{ | ||
28 | + BlockDriverState *bs = child->bs; | ||
29 | + bool waited; | ||
30 | + int64_t end_sector = DIV_ROUND_UP(offset + bytes, BDRV_SECTOR_SIZE); | ||
31 | + | ||
32 | + if (bs->read_only) { | ||
33 | + return -EPERM; | ||
34 | + } | ||
35 | + | ||
36 | + /* BDRV_REQ_NO_SERIALISING is only for read operation */ | ||
37 | + assert(!(flags & BDRV_REQ_NO_SERIALISING)); | ||
38 | + assert(!(bs->open_flags & BDRV_O_INACTIVE)); | ||
39 | + assert((bs->open_flags & BDRV_O_NO_IO) == 0); | ||
40 | + assert(!(flags & ~BDRV_REQ_MASK)); | ||
41 | + | ||
42 | + if (flags & BDRV_REQ_SERIALISING) { | ||
43 | + mark_request_serialising(req, bdrv_get_cluster_size(bs)); | ||
44 | + } | ||
45 | + | ||
46 | + waited = wait_serialising_requests(req); | ||
47 | + | ||
48 | + assert(!waited || !req->serialising || | ||
49 | + is_request_serialising_and_aligned(req)); | ||
50 | + assert(req->overlap_offset <= offset); | ||
51 | + assert(offset + bytes <= req->overlap_offset + req->overlap_bytes); | ||
52 | + | ||
53 | + if (flags & BDRV_REQ_WRITE_UNCHANGED) { | ||
54 | + assert(child->perm & (BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE)); | ||
55 | + } else { | ||
56 | + assert(child->perm & BLK_PERM_WRITE); | ||
57 | + } | ||
58 | + assert(end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE); | ||
59 | + return notifier_with_return_list_notify(&bs->before_write_notifiers, req); | ||
60 | +} | ||
61 | + | ||
62 | +static inline void coroutine_fn | ||
63 | +bdrv_co_write_req_finish(BdrvChild *child, int64_t offset, uint64_t bytes, | ||
64 | + BdrvTrackedRequest *req, int ret) | ||
65 | +{ | ||
66 | + int64_t end_sector = DIV_ROUND_UP(offset + bytes, BDRV_SECTOR_SIZE); | ||
67 | + BlockDriverState *bs = child->bs; | ||
68 | + | ||
69 | + atomic_inc(&bs->write_gen); | ||
70 | + bdrv_set_dirty(bs, offset, bytes); | ||
71 | + | ||
72 | + stat64_max(&bs->wr_highest_offset, offset + bytes); | ||
73 | + | ||
74 | + if (ret == 0) { | ||
75 | + bs->total_sectors = MAX(bs->total_sectors, end_sector); | ||
76 | + } | ||
77 | +} | ||
78 | + | ||
79 | /* | ||
80 | * Forwards an already correctly aligned write request to the BlockDriver, | ||
81 | * after possibly fragmenting it. | ||
82 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child, | ||
83 | { | 117 | { |
84 | BlockDriverState *bs = child->bs; | 118 | return qed_read_table(s, s->header.l1_table_offset, s->l1_table); |
85 | BlockDriver *drv = bs->drv; | 119 | } |
86 | - bool waited; | 120 | |
121 | /* Called with table_lock held. */ | ||
122 | -int qed_write_l1_table(BDRVQEDState *s, unsigned int index, unsigned int n) | ||
123 | +int coroutine_fn qed_write_l1_table(BDRVQEDState *s, unsigned int index, | ||
124 | + unsigned int n) | ||
125 | { | ||
126 | BLKDBG_EVENT(s->bs->file, BLKDBG_L1_UPDATE); | ||
127 | return qed_write_table(s, s->header.l1_table_offset, | ||
128 | s->l1_table, index, n, false); | ||
129 | } | ||
130 | |||
131 | -int qed_write_l1_table_sync(BDRVQEDState *s, unsigned int index, | ||
132 | - unsigned int n) | ||
133 | +int coroutine_fn qed_write_l1_table_sync(BDRVQEDState *s, unsigned int index, | ||
134 | + unsigned int n) | ||
135 | { | ||
136 | return qed_write_l1_table(s, index, n); | ||
137 | } | ||
138 | |||
139 | /* Called with table_lock held. */ | ||
140 | -int qed_read_l2_table(BDRVQEDState *s, QEDRequest *request, uint64_t offset) | ||
141 | +int coroutine_fn qed_read_l2_table(BDRVQEDState *s, QEDRequest *request, | ||
142 | + uint64_t offset) | ||
143 | { | ||
87 | int ret; | 144 | int ret; |
88 | 145 | ||
89 | - int64_t end_sector = DIV_ROUND_UP(offset + bytes, BDRV_SECTOR_SIZE); | 146 | @@ -XXX,XX +XXX,XX @@ int qed_read_l2_table(BDRVQEDState *s, QEDRequest *request, uint64_t offset) |
90 | uint64_t bytes_remaining = bytes; | ||
91 | int max_transfer; | ||
92 | |||
93 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child, | ||
94 | assert((offset & (align - 1)) == 0); | ||
95 | assert((bytes & (align - 1)) == 0); | ||
96 | assert(!qiov || bytes == qiov->size); | ||
97 | - assert((bs->open_flags & BDRV_O_NO_IO) == 0); | ||
98 | - assert(!(flags & ~BDRV_REQ_MASK)); | ||
99 | max_transfer = QEMU_ALIGN_DOWN(MIN_NON_ZERO(bs->bl.max_transfer, INT_MAX), | ||
100 | align); | ||
101 | |||
102 | - /* BDRV_REQ_NO_SERIALISING is only for read operation */ | ||
103 | - assert(!(flags & BDRV_REQ_NO_SERIALISING)); | ||
104 | - | ||
105 | - if (flags & BDRV_REQ_SERIALISING) { | ||
106 | - mark_request_serialising(req, bdrv_get_cluster_size(bs)); | ||
107 | - } | ||
108 | - | ||
109 | - waited = wait_serialising_requests(req); | ||
110 | - assert(!waited || !req->serialising || | ||
111 | - is_request_serialising_and_aligned(req)); | ||
112 | - assert(req->overlap_offset <= offset); | ||
113 | - assert(offset + bytes <= req->overlap_offset + req->overlap_bytes); | ||
114 | - if (flags & BDRV_REQ_WRITE_UNCHANGED) { | ||
115 | - assert(child->perm & (BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE)); | ||
116 | - } else { | ||
117 | - assert(child->perm & BLK_PERM_WRITE); | ||
118 | - } | ||
119 | - assert(end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE); | ||
120 | - | ||
121 | - ret = notifier_with_return_list_notify(&bs->before_write_notifiers, req); | ||
122 | + ret = bdrv_co_write_req_prepare(child, offset, bytes, req, flags); | ||
123 | |||
124 | if (!ret && bs->detect_zeroes != BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF && | ||
125 | !(flags & BDRV_REQ_ZERO_WRITE) && drv->bdrv_co_pwrite_zeroes && | ||
126 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child, | ||
127 | } | ||
128 | bdrv_debug_event(bs, BLKDBG_PWRITEV_DONE); | ||
129 | |||
130 | - atomic_inc(&bs->write_gen); | ||
131 | - bdrv_set_dirty(bs, offset, bytes); | ||
132 | - | ||
133 | - stat64_max(&bs->wr_highest_offset, offset + bytes); | ||
134 | - | ||
135 | if (ret >= 0) { | ||
136 | - bs->total_sectors = MAX(bs->total_sectors, end_sector); | ||
137 | ret = 0; | ||
138 | } | ||
139 | + bdrv_co_write_req_finish(child, offset, bytes, req, ret); | ||
140 | |||
141 | return ret; | 147 | return ret; |
142 | } | 148 | } |
143 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_pwritev(BdrvChild *child, | 149 | |
144 | if (!bs->drv) { | 150 | -int qed_read_l2_table_sync(BDRVQEDState *s, QEDRequest *request, uint64_t offset) |
145 | return -ENOMEDIUM; | 151 | +int coroutine_fn qed_read_l2_table_sync(BDRVQEDState *s, QEDRequest *request, |
152 | + uint64_t offset) | ||
153 | { | ||
154 | return qed_read_l2_table(s, request, offset); | ||
155 | } | ||
156 | |||
157 | /* Called with table_lock held. */ | ||
158 | -int qed_write_l2_table(BDRVQEDState *s, QEDRequest *request, | ||
159 | - unsigned int index, unsigned int n, bool flush) | ||
160 | +int coroutine_fn qed_write_l2_table(BDRVQEDState *s, QEDRequest *request, | ||
161 | + unsigned int index, unsigned int n, | ||
162 | + bool flush) | ||
163 | { | ||
164 | BLKDBG_EVENT(s->bs->file, BLKDBG_L2_UPDATE); | ||
165 | return qed_write_table(s, request->l2_table->offset, | ||
166 | request->l2_table->table, index, n, flush); | ||
167 | } | ||
168 | |||
169 | -int qed_write_l2_table_sync(BDRVQEDState *s, QEDRequest *request, | ||
170 | - unsigned int index, unsigned int n, bool flush) | ||
171 | +int coroutine_fn qed_write_l2_table_sync(BDRVQEDState *s, QEDRequest *request, | ||
172 | + unsigned int index, unsigned int n, | ||
173 | + bool flush) | ||
174 | { | ||
175 | return qed_write_l2_table(s, request, index, n, flush); | ||
176 | } | ||
177 | diff --git a/block/qed.c b/block/qed.c | ||
178 | index XXXXXXX..XXXXXXX 100644 | ||
179 | --- a/block/qed.c | ||
180 | +++ b/block/qed.c | ||
181 | @@ -XXX,XX +XXX,XX @@ static void coroutine_fn bdrv_qed_co_invalidate_cache(BlockDriverState *bs, | ||
146 | } | 182 | } |
147 | - if (bs->read_only) { | 183 | } |
148 | - return -EPERM; | 184 | |
149 | - } | 185 | -static int bdrv_qed_co_check(BlockDriverState *bs, BdrvCheckResult *result, |
150 | - assert(!(bs->open_flags & BDRV_O_INACTIVE)); | 186 | - BdrvCheckMode fix) |
151 | 187 | +static int coroutine_fn bdrv_qed_co_check(BlockDriverState *bs, | |
152 | ret = bdrv_check_byte_request(bs, offset, bytes); | 188 | + BdrvCheckResult *result, |
153 | if (ret < 0) { | 189 | + BdrvCheckMode fix) |
190 | { | ||
191 | BDRVQEDState *s = bs->opaque; | ||
192 | int ret; | ||
154 | -- | 193 | -- |
155 | 2.13.6 | 194 | 2.20.1 |
156 | 195 | ||
157 | 196 | diff view generated by jsdifflib |