Skip to contentSkip to conversation

block/vhdx: Support vhdx image only with 512 bytes logical sector size

PATCH Superseded Swapnil Ingle 2 participants 2 messages Aug 5, 2020 – Aug 6, 2020 Block layer

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block/vhdx: Support vhdx image only with 512 bytes logical sector size

block/vhdx uses qemu block layer where sector size is always 512 byte. This may have issues with 4K logical sector sized vhdx image.

For e.g qemu-img convert on such images fails with following assert:

$qemu-img convert -f vhdx -O raw 4KTest1.vhdx test.raw
qemu-img: util/iov.c:388: qiov_slice: Assertion `offset + len <= qiov->size' failed.
Aborted

This patch adds an check to return ENOTSUP for vhdx images which has logical sector size other than 512 bytes.

---
 block/vhdx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
block/vhdx.c +3 -3
index 791eb90..356ec4c 100644
@@ -816,9 +816,9 @@ static int vhdx_parse_metadata(BlockDriverState *bs, BDRVVHDXState *s)
         goto exit;
     }
 
-    /* only 2 supported sector sizes */
-    if (s->logical_sector_size != 512 && s->logical_sector_size != 4096) {
-        ret = -EINVAL;
+    /* Currently we only support 512 */
+    if (s->logical_sector_size != 512) {
+        ret = -ENOTSUP;
         goto exit;
     }
 
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 1 line · Swapnil Ingle

block/vhdx uses qemu block layer where sector size is always 512 byte.

"bytes".

Quoted 11 lines

This may have issues with 4K logical sector sized vhdx image.

For e.g qemu-img convert on such images fails with following assert:

$qemu-img convert -f vhdx -O raw 4KTest1.vhdx test.raw
qemu-img: util/iov.c:388: qiov_slice: Assertion `offset + len <= qiov->size' failed.
Aborted

This patch adds an check to return ENOTSUP for vhdx images which has logical sector size other than 512 bytes.

Probably "which have".

Quoted 24 lines
---
 block/vhdx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
block/vhdx.c +3 -3
index 791eb90..356ec4c 100644
@@ -816,9 +816,9 @@ static int vhdx_parse_metadata(BlockDriverState *bs, BDRVVHDXState *s)
         goto exit;
     }
 
-    /* only 2 supported sector sizes */
-    if (s->logical_sector_size != 512 && s->logical_sector_size != 4096) {
-        ret = -EINVAL;
+    /* Currently we only support 512 */
+    if (s->logical_sector_size != 512) {
+        ret = -ENOTSUP;
         goto exit;
     }