... | ... | ||
---|---|---|---|
4 | implemented. | 4 | implemented. |
5 | 5 | ||
6 | The second patch adds an iotest which reads and writes to a VHDX image with 4k | 6 | The second patch adds an iotest which reads and writes to a VHDX image with 4k |
7 | logical sector size. | 7 | logical sector size. |
8 | 8 | ||
9 | Takeshi Suzuki (2): | 9 | The third patch adds logical sector size to VHDX specific image info. |
10 | |||
11 | ``` | ||
12 | Format specific information: | ||
13 | logical sector size: 4096 | ||
14 | ``` | ||
15 | |||
16 | Takeshi Suzuki (3): | ||
10 | Add RW support for 4k sector size vhdx | 17 | Add RW support for 4k sector size vhdx |
11 | Add iotest for 4k sector size vhdx | 18 | Add iotest for 4k sector size vhdx |
19 | Add VHDX specific image info | ||
12 | 20 | ||
13 | block/vhdx.c | 76 +++++++++++++++++-- | 21 | block/vhdx.c | 97 +++++++++++++++++-- |
14 | tests/qemu-iotests/315 | 65 ++++++++++++++++ | 22 | qapi/block-core.json | 27 +++++- |
15 | tests/qemu-iotests/315.out | 20 +++++ | 23 | tests/qemu-iotests/315 | 65 +++++++++++++ |
24 | tests/qemu-iotests/315.out | 20 ++++ | ||
16 | tests/qemu-iotests/sample_images/4k.vhdx.bz2 | Bin 0 -> 37834 bytes | 25 | tests/qemu-iotests/sample_images/4k.vhdx.bz2 | Bin 0 -> 37834 bytes |
17 | 4 files changed, 155 insertions(+), 6 deletions(-) | 26 | 5 files changed, 201 insertions(+), 8 deletions(-) |
18 | create mode 100644 tests/qemu-iotests/315 | 27 | create mode 100644 tests/qemu-iotests/315 |
19 | create mode 100644 tests/qemu-iotests/315.out | 28 | create mode 100644 tests/qemu-iotests/315.out |
20 | create mode 100644 tests/qemu-iotests/sample_images/4k.vhdx.bz2 | 29 | create mode 100644 tests/qemu-iotests/sample_images/4k.vhdx.bz2 |
21 | 30 | ||
22 | -- | 31 | -- |
23 | 2.34.1 | 32 | 2.17.1 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
134 | + sinfo.bytes_avail, | 134 | + sinfo.bytes_avail, |
135 | &hd_qiov, 0); | 135 | &hd_qiov, 0); |
136 | qemu_co_mutex_lock(&s->lock); | 136 | qemu_co_mutex_lock(&s->lock); |
137 | if (ret < 0) { | 137 | if (ret < 0) { |
138 | -- | 138 | -- |
139 | 2.34.1 | 139 | 2.17.1 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
112 | diff --git a/tests/qemu-iotests/sample_images/4k.vhdx.bz2 b/tests/qemu-iotests/sample_images/4k.vhdx.bz2 | 112 | diff --git a/tests/qemu-iotests/sample_images/4k.vhdx.bz2 b/tests/qemu-iotests/sample_images/4k.vhdx.bz2 |
113 | new file mode 100644 | 113 | new file mode 100644 |
114 | index XXXXXXX..XXXXXXX | 114 | index XXXXXXX..XXXXXXX |
115 | Binary files /dev/null and b/tests/qemu-iotests/sample_images/4k.vhdx.bz2 differ | 115 | Binary files /dev/null and b/tests/qemu-iotests/sample_images/4k.vhdx.bz2 differ |
116 | -- | 116 | -- |
117 | 2.34.1 | 117 | 2.17.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Show logical sector size as follows: | ||
1 | 2 | ||
3 | ``` | ||
4 | Format specific information: | ||
5 | logical sector size: 4096 | ||
6 | ``` | ||
7 | |||
8 | Signed-off-by: Takeshi Suzuki <takeshibaconsuzuki@gmail.com> | ||
9 | --- | ||
10 | block/vhdx.c | 21 +++++++++++++++++++++ | ||
11 | qapi/block-core.json | 27 +++++++++++++++++++++++++-- | ||
12 | 2 files changed, 46 insertions(+), 2 deletions(-) | ||
13 | |||
14 | diff --git a/block/vhdx.c b/block/vhdx.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/block/vhdx.c | ||
17 | +++ b/block/vhdx.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static int GRAPH_RDLOCK vhdx_has_zero_init(BlockDriverState *bs) | ||
19 | return 1; | ||
20 | } | ||
21 | |||
22 | +static ImageInfoSpecific * GRAPH_RDLOCK | ||
23 | +vhdx_get_specific_info(BlockDriverState *bs, Error **errp) | ||
24 | +{ | ||
25 | + const BDRVVHDXState *const s = bs->opaque; | ||
26 | + ImageInfoSpecific *const spec_info = g_new0(ImageInfoSpecific, 1); | ||
27 | + | ||
28 | + *spec_info = (ImageInfoSpecific){ | ||
29 | + .type = IMAGE_INFO_SPECIFIC_KIND_VHDX, | ||
30 | + .u = { | ||
31 | + .vhdx.data = g_new0(ImageInfoSpecificVHDX, 1), | ||
32 | + }, | ||
33 | + }; | ||
34 | + | ||
35 | + *spec_info->u.vhdx.data = (ImageInfoSpecificVHDX) { | ||
36 | + .logical_sector_size = s->logical_sector_size, | ||
37 | + }; | ||
38 | + | ||
39 | + return spec_info; | ||
40 | +} | ||
41 | + | ||
42 | static QemuOptsList vhdx_create_opts = { | ||
43 | .name = "vhdx-create-opts", | ||
44 | .head = QTAILQ_HEAD_INITIALIZER(vhdx_create_opts.head), | ||
45 | @@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_vhdx = { | ||
46 | .bdrv_co_writev = vhdx_co_writev, | ||
47 | .bdrv_co_create = vhdx_co_create, | ||
48 | .bdrv_co_create_opts = vhdx_co_create_opts, | ||
49 | + .bdrv_get_specific_info = vhdx_get_specific_info, | ||
50 | .bdrv_co_get_info = vhdx_co_get_info, | ||
51 | .bdrv_co_check = vhdx_co_check, | ||
52 | .bdrv_has_zero_init = vhdx_has_zero_init, | ||
53 | diff --git a/qapi/block-core.json b/qapi/block-core.json | ||
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/qapi/block-core.json | ||
56 | +++ b/qapi/block-core.json | ||
57 | @@ -XXX,XX +XXX,XX @@ | ||
58 | '*extent-size-hint': 'size' | ||
59 | } } | ||
60 | |||
61 | +## | ||
62 | +# @ImageInfoSpecificVHDX: | ||
63 | +# | ||
64 | +# @logical-sector-size: Logical sector size | ||
65 | +# | ||
66 | +# Since: 9.2 | ||
67 | +## | ||
68 | +{ 'struct': 'ImageInfoSpecificVHDX', | ||
69 | + 'data': { | ||
70 | + 'logical-sector-size': 'int' | ||
71 | + } } | ||
72 | + | ||
73 | ## | ||
74 | # @ImageInfoSpecificKind: | ||
75 | # | ||
76 | @@ -XXX,XX +XXX,XX @@ | ||
77 | # Since: 1.7 | ||
78 | ## | ||
79 | { 'enum': 'ImageInfoSpecificKind', | ||
80 | - 'data': [ 'qcow2', 'vmdk', 'luks', 'rbd', 'file' ] } | ||
81 | + 'data': [ 'qcow2', 'vmdk', 'luks', 'rbd', 'file', 'vhdx' ] } | ||
82 | |||
83 | ## | ||
84 | # @ImageInfoSpecificQCow2Wrapper: | ||
85 | @@ -XXX,XX +XXX,XX @@ | ||
86 | { 'struct': 'ImageInfoSpecificFileWrapper', | ||
87 | 'data': { 'data': 'ImageInfoSpecificFile' } } | ||
88 | |||
89 | +## | ||
90 | +# @ImageInfoSpecificVHDXWrapper: | ||
91 | +# | ||
92 | +# @data: image information specific to VHDX | ||
93 | +# | ||
94 | +# Since: 9.2 | ||
95 | +## | ||
96 | +{ 'struct': 'ImageInfoSpecificVHDXWrapper', | ||
97 | + 'data': { 'data': 'ImageInfoSpecificVHDX' } } | ||
98 | + | ||
99 | ## | ||
100 | # @ImageInfoSpecific: | ||
101 | # | ||
102 | @@ -XXX,XX +XXX,XX @@ | ||
103 | 'vmdk': 'ImageInfoSpecificVmdkWrapper', | ||
104 | 'luks': 'ImageInfoSpecificLUKSWrapper', | ||
105 | 'rbd': 'ImageInfoSpecificRbdWrapper', | ||
106 | - 'file': 'ImageInfoSpecificFileWrapper' | ||
107 | + 'file': 'ImageInfoSpecificFileWrapper', | ||
108 | + 'vhdx': 'ImageInfoSpecificVHDXWrapper' | ||
109 | } } | ||
110 | |||
111 | ## | ||
112 | -- | ||
113 | 2.17.1 | diff view generated by jsdifflib |