Commit 1a4828c7 authored by Kevin Wolf's avatar Kevin Wolf
Browse files

qcow2: Write feature table only for v3 images



Version 2 images don't have feature bits, so writing a feature table to
those images is kind of pointless.

Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
parent 80c71a24
Loading
Loading
Loading
Loading
+25 −23
Original line number Diff line number Diff line
@@ -1895,6 +1895,7 @@ int qcow2_update_header(BlockDriverState *bs)
    }

    /* Feature table */
    if (s->qcow_version >= 3) {
        Qcow2Feature features[] = {
            {
                .type = QCOW2_FEAT_TYPE_INCOMPATIBLE,
@@ -1920,6 +1921,7 @@ int qcow2_update_header(BlockDriverState *bs)
        }
        buf += ret;
        buflen -= ret;
    }

    /* Keep unknown header extensions */
    QLIST_FOREACH(uext, &s->unknown_header_ext, next) {
+1 −11
Original line number Diff line number Diff line
@@ -52,11 +52,6 @@ autoclear_features 0x0
refcount_order            4
header_length             72

Header extension:
magic                     0x6803f857
length                    144
data                      <binary>

Header extension:
magic                     0x12345678
length                    31
@@ -68,7 +63,7 @@ No errors were found on the image.

magic                     0x514649fb
version                   2
backing_file_offset       0x128
backing_file_offset       0x90
backing_file_size         0x17
cluster_bits              16
size                      67108864
@@ -90,11 +85,6 @@ magic 0xe2792aca
length                    11
data                      'host_device'

Header extension:
magic                     0x6803f857
length                    144
data                      <binary>

Header extension:
magic                     0x12345678
length                    31
+0 −15
Original line number Diff line number Diff line
@@ -43,11 +43,6 @@ autoclear_features 0x0
refcount_order            4
header_length             72

Header extension:
magic                     0x6803f857
length                    144
data                      <binary>

read 131072/131072 bytes at offset 0
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
No errors were found on the image.
@@ -105,11 +100,6 @@ autoclear_features 0x0
refcount_order            4
header_length             72

Header extension:
magic                     0x6803f857
length                    144
data                      <binary>

read 131072/131072 bytes at offset 0
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
No errors were found on the image.
@@ -155,11 +145,6 @@ autoclear_features 0x0
refcount_order            4
header_length             72

Header extension:
magic                     0x6803f857
length                    144
data                      <binary>

No errors were found on the image.

=== Testing version upgrade and resize ===