1
The following changes since commit ac5f7bf8e208cd7893dbb1a9520559e569a4677c:
1
The following changes since commit 813bac3d8d70d85cb7835f7945eb9eed84c2d8d0:
2
2
3
Merge tag 'migration-20230424-pull-request' of https://gitlab.com/juan.quintela/qemu into staging (2023-04-24 15:00:39 +0100)
3
Merge tag '2023q3-bsd-user-pull-request' of https://gitlab.com/bsdimp/qemu into staging (2023-08-29 08:58:00 -0400)
4
4
5
are available in the Git repository at:
5
are available in the Git repository at:
6
6
7
https://gitlab.com/stefanha/qemu.git tags/block-pull-request
7
https://gitlab.com/stefanha/qemu.git tags/block-pull-request
8
8
9
for you to fetch changes up to 9d672e290475001fcecdcc9dc79ad088ff89d17f:
9
for you to fetch changes up to 87ec6f55af38e29be5b2b65a8acf84da73e06d06:
10
10
11
tracetool: use relative paths for '#line' preprocessor directives (2023-04-24 13:53:44 -0400)
11
aio-posix: zero out io_uring sqe user_data (2023-08-30 07:39:59 -0400)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Pull request (v2)
14
Pull request
15
15
16
I dropped the zoned storage patches that had CI failures. This pull request
16
v3:
17
only contains fixes now.
17
- Drop UFS emulation due to CI failures
18
- Add "aio-posix: zero out io_uring sqe user_data"
18
19
19
----------------------------------------------------------------
20
----------------------------------------------------------------
20
21
21
Philippe Mathieu-Daudé (1):
22
Andrey Drobyshev (3):
22
block/dmg: Declare a type definition for DMG uncompress function
23
block: add subcluster_size field to BlockDriverInfo
24
block/io: align requests to subcluster_size
25
tests/qemu-iotests/197: add testcase for CoR with subclusters
23
26
24
Thomas De Schampheleire (1):
27
Fabiano Rosas (1):
25
tracetool: use relative paths for '#line' preprocessor directives
28
block-migration: Ensure we don't crash during migration cleanup
26
29
27
block/dmg.h | 8 ++++----
30
Stefan Hajnoczi (1):
28
block/dmg.c | 7 ++-----
31
aio-posix: zero out io_uring sqe user_data
29
scripts/tracetool/backend/ftrace.py | 4 +++-
32
30
scripts/tracetool/backend/log.py | 4 +++-
33
include/block/block-common.h | 5 ++++
31
scripts/tracetool/backend/syslog.py | 4 +++-
34
include/block/block-io.h | 8 +++---
32
5 files changed, 15 insertions(+), 12 deletions(-)
35
block.c | 7 +++++
36
block/io.c | 50 ++++++++++++++++++------------------
37
block/mirror.c | 8 +++---
38
block/qcow2.c | 1 +
39
migration/block.c | 11 ++++++--
40
util/fdmon-io_uring.c | 2 ++
41
tests/qemu-iotests/197 | 29 +++++++++++++++++++++
42
tests/qemu-iotests/197.out | 24 +++++++++++++++++
43
10 files changed, 110 insertions(+), 35 deletions(-)
33
44
34
--
45
--
35
2.39.2
46
2.41.0
36
37
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
Introduce the BdrvDmgUncompressFunc type defintion. To emphasis
3
We can fail the blk_insert_bs() at init_blk_migration(), leaving the
4
dmg_uncompress_bz2 and dmg_uncompress_lzfse are pointer to functions,
4
BlkMigDevState without a dirty_bitmap and BlockDriverState. Account
5
declare them using this new typedef.
5
for the possibly missing elements when doing cleanup.
6
6
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Fix the following crashes:
8
Message-id: 20230320152610.32052-1-philmd@linaro.org
8
9
Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
10
0x0000555555ec83ef in bdrv_release_dirty_bitmap (bitmap=0x0) at ../block/dirty-bitmap.c:359
11
359 BlockDriverState *bs = bitmap->bs;
12
#0 0x0000555555ec83ef in bdrv_release_dirty_bitmap (bitmap=0x0) at ../block/dirty-bitmap.c:359
13
#1 0x0000555555bba331 in unset_dirty_tracking () at ../migration/block.c:371
14
#2 0x0000555555bbad98 in block_migration_cleanup_bmds () at ../migration/block.c:681
15
16
Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
17
0x0000555555e971ff in bdrv_op_unblock (bs=0x0, op=BLOCK_OP_TYPE_BACKUP_SOURCE, reason=0x0) at ../block.c:7073
18
7073 QLIST_FOREACH_SAFE(blocker, &bs->op_blockers[op], list, next) {
19
#0 0x0000555555e971ff in bdrv_op_unblock (bs=0x0, op=BLOCK_OP_TYPE_BACKUP_SOURCE, reason=0x0) at ../block.c:7073
20
#1 0x0000555555e9734a in bdrv_op_unblock_all (bs=0x0, reason=0x0) at ../block.c:7095
21
#2 0x0000555555bbae13 in block_migration_cleanup_bmds () at ../migration/block.c:690
22
23
Signed-off-by: Fabiano Rosas <farosas@suse.de>
24
Message-id: 20230731203338.27581-1-farosas@suse.de
9
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
25
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10
---
26
---
11
block/dmg.h | 8 ++++----
27
migration/block.c | 11 +++++++++--
12
block/dmg.c | 7 ++-----
28
1 file changed, 9 insertions(+), 2 deletions(-)
13
2 files changed, 6 insertions(+), 9 deletions(-)
14
29
15
diff --git a/block/dmg.h b/block/dmg.h
30
diff --git a/migration/block.c b/migration/block.c
16
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
17
--- a/block/dmg.h
32
--- a/migration/block.c
18
+++ b/block/dmg.h
33
+++ b/migration/block.c
19
@@ -XXX,XX +XXX,XX @@ typedef struct BDRVDMGState {
34
@@ -XXX,XX +XXX,XX @@ static void unset_dirty_tracking(void)
20
z_stream zstream;
35
BlkMigDevState *bmds;
21
} BDRVDMGState;
36
22
37
QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
23
-extern int (*dmg_uncompress_bz2)(char *next_in, unsigned int avail_in,
38
- bdrv_release_dirty_bitmap(bmds->dirty_bitmap);
24
- char *next_out, unsigned int avail_out);
39
+ if (bmds->dirty_bitmap) {
25
+typedef int BdrvDmgUncompressFunc(char *next_in, unsigned int avail_in,
40
+ bdrv_release_dirty_bitmap(bmds->dirty_bitmap);
26
+ char *next_out, unsigned int avail_out);
41
+ }
27
42
}
28
-extern int (*dmg_uncompress_lzfse)(char *next_in, unsigned int avail_in,
43
}
29
- char *next_out, unsigned int avail_out);
44
30
+extern BdrvDmgUncompressFunc *dmg_uncompress_bz2;
45
@@ -XXX,XX +XXX,XX @@ static int64_t get_remaining_dirty(void)
31
+extern BdrvDmgUncompressFunc *dmg_uncompress_lzfse;
46
static void block_migration_cleanup_bmds(void)
32
47
{
33
#endif
48
BlkMigDevState *bmds;
34
diff --git a/block/dmg.c b/block/dmg.c
49
+ BlockDriverState *bs;
35
index XXXXXXX..XXXXXXX 100644
50
AioContext *ctx;
36
--- a/block/dmg.c
51
37
+++ b/block/dmg.c
52
unset_dirty_tracking();
38
@@ -XXX,XX +XXX,XX @@
53
39
#include "qemu/memalign.h"
54
while ((bmds = QSIMPLEQ_FIRST(&block_mig_state.bmds_list)) != NULL) {
40
#include "dmg.h"
55
QSIMPLEQ_REMOVE_HEAD(&block_mig_state.bmds_list, entry);
41
56
- bdrv_op_unblock_all(blk_bs(bmds->blk), bmds->blocker);
42
-int (*dmg_uncompress_bz2)(char *next_in, unsigned int avail_in,
57
+
43
- char *next_out, unsigned int avail_out);
58
+ bs = blk_bs(bmds->blk);
44
-
59
+ if (bs) {
45
-int (*dmg_uncompress_lzfse)(char *next_in, unsigned int avail_in,
60
+ bdrv_op_unblock_all(bs, bmds->blocker);
46
- char *next_out, unsigned int avail_out);
61
+ }
47
+BdrvDmgUncompressFunc *dmg_uncompress_bz2;
62
error_free(bmds->blocker);
48
+BdrvDmgUncompressFunc *dmg_uncompress_lzfse;
63
49
64
/* Save ctx, because bmds->blk can disappear during blk_unref. */
50
enum {
51
/* Limit chunk sizes to prevent unreasonable amounts of memory being used
52
--
65
--
53
2.39.2
66
2.41.0
54
55
diff view generated by jsdifflib
New patch
1
From: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
1
2
3
This is going to be used in the subsequent commit as requests alignment
4
(in particular, during copy-on-read). This value only makes sense for
5
the formats which support subclusters (currently QCOW2 only). If this
6
field isn't set by driver's own bdrv_get_info() implementation, we
7
simply set it equal to the cluster size thus treating each cluster as
8
having a single subcluster.
9
10
Reviewed-by: Eric Blake <eblake@redhat.com>
11
Reviewed-by: Denis V. Lunev <den@openvz.org>
12
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
13
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
14
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
15
Message-ID: <20230711172553.234055-2-andrey.drobyshev@virtuozzo.com>
16
---
17
include/block/block-common.h | 5 +++++
18
block.c | 7 +++++++
19
block/qcow2.c | 1 +
20
3 files changed, 13 insertions(+)
21
22
diff --git a/include/block/block-common.h b/include/block/block-common.h
23
index XXXXXXX..XXXXXXX 100644
24
--- a/include/block/block-common.h
25
+++ b/include/block/block-common.h
26
@@ -XXX,XX +XXX,XX @@ typedef struct BlockZoneWps {
27
typedef struct BlockDriverInfo {
28
/* in bytes, 0 if irrelevant */
29
int cluster_size;
30
+ /*
31
+ * A fraction of cluster_size, if supported (currently QCOW2 only); if
32
+ * disabled or unsupported, set equal to cluster_size.
33
+ */
34
+ int subcluster_size;
35
/* offset at which the VM state can be saved (0 if not possible) */
36
int64_t vm_state_offset;
37
bool is_dirty;
38
diff --git a/block.c b/block.c
39
index XXXXXXX..XXXXXXX 100644
40
--- a/block.c
41
+++ b/block.c
42
@@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
43
}
44
memset(bdi, 0, sizeof(*bdi));
45
ret = drv->bdrv_co_get_info(bs, bdi);
46
+ if (bdi->subcluster_size == 0) {
47
+ /*
48
+ * If the driver left this unset, subclusters are not supported.
49
+ * Then it is safe to treat each cluster as having only one subcluster.
50
+ */
51
+ bdi->subcluster_size = bdi->cluster_size;
52
+ }
53
if (ret < 0) {
54
return ret;
55
}
56
diff --git a/block/qcow2.c b/block/qcow2.c
57
index XXXXXXX..XXXXXXX 100644
58
--- a/block/qcow2.c
59
+++ b/block/qcow2.c
60
@@ -XXX,XX +XXX,XX @@ qcow2_co_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
61
{
62
BDRVQcow2State *s = bs->opaque;
63
bdi->cluster_size = s->cluster_size;
64
+ bdi->subcluster_size = s->subcluster_size;
65
bdi->vm_state_offset = qcow2_vm_state_offset(s);
66
bdi->is_dirty = s->incompatible_features & QCOW2_INCOMPAT_DIRTY;
67
return 0;
68
--
69
2.41.0
diff view generated by jsdifflib
New patch
1
1
From: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
2
3
When target image is using subclusters, and we align the request during
4
copy-on-read, it makes sense to align to subcluster_size rather than
5
cluster_size. Otherwise we end up with unnecessary allocations.
6
7
This commit renames bdrv_round_to_clusters() to bdrv_round_to_subclusters()
8
and utilizes subcluster_size field of BlockDriverInfo to make necessary
9
alignments. It affects copy-on-read as well as mirror job (which is
10
using bdrv_round_to_clusters()).
11
12
This change also fixes the following bug with failing assert (covered by
13
the test in the subsequent commit):
14
15
qemu-img create -f qcow2 base.qcow2 64K
16
qemu-img create -f qcow2 -o extended_l2=on,backing_file=base.qcow2,backing_fmt=qcow2 img.qcow2 64K
17
qemu-io -c "write -P 0xaa 0 2K" img.qcow2
18
qemu-io -C -c "read -P 0x00 2K 62K" img.qcow2
19
20
qemu-io: ../block/io.c:1236: bdrv_co_do_copy_on_readv: Assertion `skip_bytes < pnum' failed.
21
22
Reviewed-by: Eric Blake <eblake@redhat.com>
23
Reviewed-by: Denis V. Lunev <den@openvz.org>
24
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
25
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
26
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
27
Message-ID: <20230711172553.234055-3-andrey.drobyshev@virtuozzo.com>
28
---
29
include/block/block-io.h | 8 +++----
30
block/io.c | 50 ++++++++++++++++++++--------------------
31
block/mirror.c | 8 +++----
32
3 files changed, 33 insertions(+), 33 deletions(-)
33
34
diff --git a/include/block/block-io.h b/include/block/block-io.h
35
index XXXXXXX..XXXXXXX 100644
36
--- a/include/block/block-io.h
37
+++ b/include/block/block-io.h
38
@@ -XXX,XX +XXX,XX @@ bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi);
39
ImageInfoSpecific *bdrv_get_specific_info(BlockDriverState *bs,
40
Error **errp);
41
BlockStatsSpecific *bdrv_get_specific_stats(BlockDriverState *bs);
42
-void bdrv_round_to_clusters(BlockDriverState *bs,
43
- int64_t offset, int64_t bytes,
44
- int64_t *cluster_offset,
45
- int64_t *cluster_bytes);
46
+void bdrv_round_to_subclusters(BlockDriverState *bs,
47
+ int64_t offset, int64_t bytes,
48
+ int64_t *cluster_offset,
49
+ int64_t *cluster_bytes);
50
51
void bdrv_get_backing_filename(BlockDriverState *bs,
52
char *filename, int filename_size);
53
diff --git a/block/io.c b/block/io.c
54
index XXXXXXX..XXXXXXX 100644
55
--- a/block/io.c
56
+++ b/block/io.c
57
@@ -XXX,XX +XXX,XX @@ BdrvTrackedRequest *coroutine_fn bdrv_co_get_self_request(BlockDriverState *bs)
58
}
59
60
/**
61
- * Round a region to cluster boundaries
62
+ * Round a region to subcluster (if supported) or cluster boundaries
63
*/
64
void coroutine_fn GRAPH_RDLOCK
65
-bdrv_round_to_clusters(BlockDriverState *bs, int64_t offset, int64_t bytes,
66
- int64_t *cluster_offset, int64_t *cluster_bytes)
67
+bdrv_round_to_subclusters(BlockDriverState *bs, int64_t offset, int64_t bytes,
68
+ int64_t *align_offset, int64_t *align_bytes)
69
{
70
BlockDriverInfo bdi;
71
IO_CODE();
72
- if (bdrv_co_get_info(bs, &bdi) < 0 || bdi.cluster_size == 0) {
73
- *cluster_offset = offset;
74
- *cluster_bytes = bytes;
75
+ if (bdrv_co_get_info(bs, &bdi) < 0 || bdi.subcluster_size == 0) {
76
+ *align_offset = offset;
77
+ *align_bytes = bytes;
78
} else {
79
- int64_t c = bdi.cluster_size;
80
- *cluster_offset = QEMU_ALIGN_DOWN(offset, c);
81
- *cluster_bytes = QEMU_ALIGN_UP(offset - *cluster_offset + bytes, c);
82
+ int64_t c = bdi.subcluster_size;
83
+ *align_offset = QEMU_ALIGN_DOWN(offset, c);
84
+ *align_bytes = QEMU_ALIGN_UP(offset - *align_offset + bytes, c);
85
}
86
}
87
88
@@ -XXX,XX +XXX,XX @@ bdrv_co_do_copy_on_readv(BdrvChild *child, int64_t offset, int64_t bytes,
89
void *bounce_buffer = NULL;
90
91
BlockDriver *drv = bs->drv;
92
- int64_t cluster_offset;
93
- int64_t cluster_bytes;
94
+ int64_t align_offset;
95
+ int64_t align_bytes;
96
int64_t skip_bytes;
97
int ret;
98
int max_transfer = MIN_NON_ZERO(bs->bl.max_transfer,
99
@@ -XXX,XX +XXX,XX @@ bdrv_co_do_copy_on_readv(BdrvChild *child, int64_t offset, int64_t bytes,
100
* BDRV_REQUEST_MAX_BYTES (even when the original read did not), which
101
* is one reason we loop rather than doing it all at once.
102
*/
103
- bdrv_round_to_clusters(bs, offset, bytes, &cluster_offset, &cluster_bytes);
104
- skip_bytes = offset - cluster_offset;
105
+ bdrv_round_to_subclusters(bs, offset, bytes, &align_offset, &align_bytes);
106
+ skip_bytes = offset - align_offset;
107
108
trace_bdrv_co_do_copy_on_readv(bs, offset, bytes,
109
- cluster_offset, cluster_bytes);
110
+ align_offset, align_bytes);
111
112
- while (cluster_bytes) {
113
+ while (align_bytes) {
114
int64_t pnum;
115
116
if (skip_write) {
117
ret = 1; /* "already allocated", so nothing will be copied */
118
- pnum = MIN(cluster_bytes, max_transfer);
119
+ pnum = MIN(align_bytes, max_transfer);
120
} else {
121
- ret = bdrv_is_allocated(bs, cluster_offset,
122
- MIN(cluster_bytes, max_transfer), &pnum);
123
+ ret = bdrv_is_allocated(bs, align_offset,
124
+ MIN(align_bytes, max_transfer), &pnum);
125
if (ret < 0) {
126
/*
127
* Safe to treat errors in querying allocation as if
128
* unallocated; we'll probably fail again soon on the
129
* read, but at least that will set a decent errno.
130
*/
131
- pnum = MIN(cluster_bytes, max_transfer);
132
+ pnum = MIN(align_bytes, max_transfer);
133
}
134
135
/* Stop at EOF if the image ends in the middle of the cluster */
136
@@ -XXX,XX +XXX,XX @@ bdrv_co_do_copy_on_readv(BdrvChild *child, int64_t offset, int64_t bytes,
137
/* Must copy-on-read; use the bounce buffer */
138
pnum = MIN(pnum, MAX_BOUNCE_BUFFER);
139
if (!bounce_buffer) {
140
- int64_t max_we_need = MAX(pnum, cluster_bytes - pnum);
141
+ int64_t max_we_need = MAX(pnum, align_bytes - pnum);
142
int64_t max_allowed = MIN(max_transfer, MAX_BOUNCE_BUFFER);
143
int64_t bounce_buffer_len = MIN(max_we_need, max_allowed);
144
145
@@ -XXX,XX +XXX,XX @@ bdrv_co_do_copy_on_readv(BdrvChild *child, int64_t offset, int64_t bytes,
146
}
147
qemu_iovec_init_buf(&local_qiov, bounce_buffer, pnum);
148
149
- ret = bdrv_driver_preadv(bs, cluster_offset, pnum,
150
+ ret = bdrv_driver_preadv(bs, align_offset, pnum,
151
&local_qiov, 0, 0);
152
if (ret < 0) {
153
goto err;
154
@@ -XXX,XX +XXX,XX @@ bdrv_co_do_copy_on_readv(BdrvChild *child, int64_t offset, int64_t bytes,
155
/* FIXME: Should we (perhaps conditionally) be setting
156
* BDRV_REQ_MAY_UNMAP, if it will allow for a sparser copy
157
* that still correctly reads as zero? */
158
- ret = bdrv_co_do_pwrite_zeroes(bs, cluster_offset, pnum,
159
+ ret = bdrv_co_do_pwrite_zeroes(bs, align_offset, pnum,
160
BDRV_REQ_WRITE_UNCHANGED);
161
} else {
162
/* This does not change the data on the disk, it is not
163
* necessary to flush even in cache=writethrough mode.
164
*/
165
- ret = bdrv_driver_pwritev(bs, cluster_offset, pnum,
166
+ ret = bdrv_driver_pwritev(bs, align_offset, pnum,
167
&local_qiov, 0,
168
BDRV_REQ_WRITE_UNCHANGED);
169
}
170
@@ -XXX,XX +XXX,XX @@ bdrv_co_do_copy_on_readv(BdrvChild *child, int64_t offset, int64_t bytes,
171
}
172
}
173
174
- cluster_offset += pnum;
175
- cluster_bytes -= pnum;
176
+ align_offset += pnum;
177
+ align_bytes -= pnum;
178
progress += pnum - skip_bytes;
179
skip_bytes = 0;
180
}
181
diff --git a/block/mirror.c b/block/mirror.c
182
index XXXXXXX..XXXXXXX 100644
183
--- a/block/mirror.c
184
+++ b/block/mirror.c
185
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn mirror_cow_align(MirrorBlockJob *s, int64_t *offset,
186
need_cow |= !test_bit((*offset + *bytes - 1) / s->granularity,
187
s->cow_bitmap);
188
if (need_cow) {
189
- bdrv_round_to_clusters(blk_bs(s->target), *offset, *bytes,
190
- &align_offset, &align_bytes);
191
+ bdrv_round_to_subclusters(blk_bs(s->target), *offset, *bytes,
192
+ &align_offset, &align_bytes);
193
}
194
195
if (align_bytes > max_bytes) {
196
@@ -XXX,XX +XXX,XX @@ static void coroutine_fn mirror_iteration(MirrorBlockJob *s)
197
int64_t target_offset;
198
int64_t target_bytes;
199
WITH_GRAPH_RDLOCK_GUARD() {
200
- bdrv_round_to_clusters(blk_bs(s->target), offset, io_bytes,
201
- &target_offset, &target_bytes);
202
+ bdrv_round_to_subclusters(blk_bs(s->target), offset, io_bytes,
203
+ &target_offset, &target_bytes);
204
}
205
if (target_offset == offset &&
206
target_bytes == io_bytes) {
207
--
208
2.41.0
diff view generated by jsdifflib
New patch
1
From: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
1
2
3
Add testcase which checks that allocations during copy-on-read are
4
performed on the subcluster basis when subclusters are enabled in target
5
image.
6
7
This testcase also triggers the following assert with previous commit
8
not being applied, so we check that as well:
9
10
qemu-io: ../block/io.c:1236: bdrv_co_do_copy_on_readv: Assertion `skip_bytes < pnum' failed.
11
12
Reviewed-by: Eric Blake <eblake@redhat.com>
13
Reviewed-by: Denis V. Lunev <den@openvz.org>
14
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
15
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
16
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
17
Message-ID: <20230711172553.234055-4-andrey.drobyshev@virtuozzo.com>
18
---
19
tests/qemu-iotests/197 | 29 +++++++++++++++++++++++++++++
20
tests/qemu-iotests/197.out | 24 ++++++++++++++++++++++++
21
2 files changed, 53 insertions(+)
22
23
diff --git a/tests/qemu-iotests/197 b/tests/qemu-iotests/197
24
index XXXXXXX..XXXXXXX 100755
25
--- a/tests/qemu-iotests/197
26
+++ b/tests/qemu-iotests/197
27
@@ -XXX,XX +XXX,XX @@ $QEMU_IO -f qcow2 -C -c 'read 0 1024' "$TEST_WRAP" | _filter_qemu_io
28
$QEMU_IO -f qcow2 -c map "$TEST_WRAP"
29
_check_test_img
30
31
+echo
32
+echo '=== Copy-on-read with subclusters ==='
33
+echo
34
+
35
+# Create base and top images 64K (1 cluster) each. Make subclusters enabled
36
+# for the top image
37
+_make_test_img 64K
38
+IMGPROTO=file IMGFMT=qcow2 TEST_IMG_FILE="$TEST_WRAP" \
39
+ _make_test_img --no-opts -o extended_l2=true -F "$IMGFMT" -b "$TEST_IMG" \
40
+ 64K | _filter_img_create
41
+
42
+$QEMU_IO -c "write -P 0xaa 0 64k" "$TEST_IMG" | _filter_qemu_io
43
+
44
+# Allocate individual subclusters in the top image, and not the whole cluster
45
+$QEMU_IO -c "write -P 0xbb 28K 2K" -c "write -P 0xcc 34K 2K" "$TEST_WRAP" \
46
+ | _filter_qemu_io
47
+
48
+# Only 2 subclusters should be allocated in the top image at this point
49
+$QEMU_IMG map "$TEST_WRAP" | _filter_qemu_img_map
50
+
51
+# Actual copy-on-read operation
52
+$QEMU_IO -C -c "read -P 0xaa 30K 4K" "$TEST_WRAP" | _filter_qemu_io
53
+
54
+# And here we should have 4 subclusters allocated right in the middle of the
55
+# top image. Make sure the whole cluster remains unallocated
56
+$QEMU_IMG map "$TEST_WRAP" | _filter_qemu_img_map
57
+
58
+_check_test_img
59
+
60
# success, all done
61
echo '*** done'
62
status=0
63
diff --git a/tests/qemu-iotests/197.out b/tests/qemu-iotests/197.out
64
index XXXXXXX..XXXXXXX 100644
65
--- a/tests/qemu-iotests/197.out
66
+++ b/tests/qemu-iotests/197.out
67
@@ -XXX,XX +XXX,XX @@ read 1024/1024 bytes at offset 0
68
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
69
1 KiB (0x400) bytes allocated at offset 0 bytes (0x0)
70
No errors were found on the image.
71
+
72
+=== Copy-on-read with subclusters ===
73
+
74
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=65536
75
+Formatting 'TEST_DIR/t.wrap.IMGFMT', fmt=IMGFMT size=65536 backing_file=TEST_DIR/t.IMGFMT backing_fmt=IMGFMT
76
+wrote 65536/65536 bytes at offset 0
77
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
78
+wrote 2048/2048 bytes at offset 28672
79
+2 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
80
+wrote 2048/2048 bytes at offset 34816
81
+2 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
82
+Offset Length File
83
+0 0x7000 TEST_DIR/t.IMGFMT
84
+0x7000 0x800 TEST_DIR/t.wrap.IMGFMT
85
+0x7800 0x1000 TEST_DIR/t.IMGFMT
86
+0x8800 0x800 TEST_DIR/t.wrap.IMGFMT
87
+0x9000 0x7000 TEST_DIR/t.IMGFMT
88
+read 4096/4096 bytes at offset 30720
89
+4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
90
+Offset Length File
91
+0 0x7000 TEST_DIR/t.IMGFMT
92
+0x7000 0x2000 TEST_DIR/t.wrap.IMGFMT
93
+0x9000 0x7000 TEST_DIR/t.IMGFMT
94
+No errors were found on the image.
95
*** done
96
--
97
2.41.0
diff view generated by jsdifflib
1
From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
1
liburing does not clear sqe->user_data. We must do it ourselves to avoid
2
undefined behavior in process_cqe() when user_data is used.
2
3
3
The event filename is an absolute path. Convert it to a relative path when
4
Note that fdmon-io_uring is currently disabled, so this is a latent bug
4
writing '#line' directives, to preserve reproducibility of the generated
5
that does not affect users. Let's merge this fix now to make it easier
5
output when different base paths are used.
6
to enable fdmon-io_uring in the future (and I'm working on that).
6
7
7
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9
Message-Id: <20230406080045.21696-1-thomas.de_schampheleire@nokia.com>
9
Message-ID: <20230426212639.82310-1-stefanha@redhat.com>
10
---
10
---
11
scripts/tracetool/backend/ftrace.py | 4 +++-
11
util/fdmon-io_uring.c | 2 ++
12
scripts/tracetool/backend/log.py | 4 +++-
12
1 file changed, 2 insertions(+)
13
scripts/tracetool/backend/syslog.py | 4 +++-
14
3 files changed, 9 insertions(+), 3 deletions(-)
15
13
16
diff --git a/scripts/tracetool/backend/ftrace.py b/scripts/tracetool/backend/ftrace.py
14
diff --git a/util/fdmon-io_uring.c b/util/fdmon-io_uring.c
17
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
18
--- a/scripts/tracetool/backend/ftrace.py
16
--- a/util/fdmon-io_uring.c
19
+++ b/scripts/tracetool/backend/ftrace.py
17
+++ b/util/fdmon-io_uring.c
20
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@ static void add_poll_remove_sqe(AioContext *ctx, AioHandler *node)
21
__email__ = "stefanha@redhat.com"
19
#else
22
20
io_uring_prep_poll_remove(sqe, node);
23
21
#endif
24
+import os.path
22
+ io_uring_sqe_set_data(sqe, NULL);
25
+
23
}
26
from tracetool import out
24
27
25
/* Add a timeout that self-cancels when another cqe becomes ready */
28
26
@@ -XXX,XX +XXX,XX @@ static void add_timeout_sqe(AioContext *ctx, int64_t ns)
29
@@ -XXX,XX +XXX,XX @@ def generate_h(event, group):
27
30
args=event.args,
28
sqe = get_sqe(ctx);
31
event_id="TRACE_" + event.name.upper(),
29
io_uring_prep_timeout(sqe, &ts, 1, 0);
32
event_lineno=event.lineno,
30
+ io_uring_sqe_set_data(sqe, NULL);
33
- event_filename=event.filename,
31
}
34
+ event_filename=os.path.relpath(event.filename),
32
35
fmt=event.fmt.rstrip("\n"),
33
/* Add sqes from ctx->submit_list for submission */
36
argnames=argnames)
37
38
diff --git a/scripts/tracetool/backend/log.py b/scripts/tracetool/backend/log.py
39
index XXXXXXX..XXXXXXX 100644
40
--- a/scripts/tracetool/backend/log.py
41
+++ b/scripts/tracetool/backend/log.py
42
@@ -XXX,XX +XXX,XX @@
43
__email__ = "stefanha@redhat.com"
44
45
46
+import os.path
47
+
48
from tracetool import out
49
50
51
@@ -XXX,XX +XXX,XX @@ def generate_h(event, group):
52
' }',
53
cond=cond,
54
event_lineno=event.lineno,
55
- event_filename=event.filename,
56
+ event_filename=os.path.relpath(event.filename),
57
name=event.name,
58
fmt=event.fmt.rstrip("\n"),
59
argnames=argnames)
60
diff --git a/scripts/tracetool/backend/syslog.py b/scripts/tracetool/backend/syslog.py
61
index XXXXXXX..XXXXXXX 100644
62
--- a/scripts/tracetool/backend/syslog.py
63
+++ b/scripts/tracetool/backend/syslog.py
64
@@ -XXX,XX +XXX,XX @@
65
__email__ = "stefanha@redhat.com"
66
67
68
+import os.path
69
+
70
from tracetool import out
71
72
73
@@ -XXX,XX +XXX,XX @@ def generate_h(event, group):
74
' }',
75
cond=cond,
76
event_lineno=event.lineno,
77
- event_filename=event.filename,
78
+ event_filename=os.path.relpath(event.filename),
79
name=event.name,
80
fmt=event.fmt.rstrip("\n"),
81
argnames=argnames)
82
--
34
--
83
2.39.2
35
2.41.0
diff view generated by jsdifflib