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: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
80c71a241a
commit
1a4828c793
@ -1895,31 +1895,33 @@ int qcow2_update_header(BlockDriverState *bs)
|
||||
}
|
||||
|
||||
/* Feature table */
|
||||
Qcow2Feature features[] = {
|
||||
{
|
||||
.type = QCOW2_FEAT_TYPE_INCOMPATIBLE,
|
||||
.bit = QCOW2_INCOMPAT_DIRTY_BITNR,
|
||||
.name = "dirty bit",
|
||||
},
|
||||
{
|
||||
.type = QCOW2_FEAT_TYPE_INCOMPATIBLE,
|
||||
.bit = QCOW2_INCOMPAT_CORRUPT_BITNR,
|
||||
.name = "corrupt bit",
|
||||
},
|
||||
{
|
||||
.type = QCOW2_FEAT_TYPE_COMPATIBLE,
|
||||
.bit = QCOW2_COMPAT_LAZY_REFCOUNTS_BITNR,
|
||||
.name = "lazy refcounts",
|
||||
},
|
||||
};
|
||||
if (s->qcow_version >= 3) {
|
||||
Qcow2Feature features[] = {
|
||||
{
|
||||
.type = QCOW2_FEAT_TYPE_INCOMPATIBLE,
|
||||
.bit = QCOW2_INCOMPAT_DIRTY_BITNR,
|
||||
.name = "dirty bit",
|
||||
},
|
||||
{
|
||||
.type = QCOW2_FEAT_TYPE_INCOMPATIBLE,
|
||||
.bit = QCOW2_INCOMPAT_CORRUPT_BITNR,
|
||||
.name = "corrupt bit",
|
||||
},
|
||||
{
|
||||
.type = QCOW2_FEAT_TYPE_COMPATIBLE,
|
||||
.bit = QCOW2_COMPAT_LAZY_REFCOUNTS_BITNR,
|
||||
.name = "lazy refcounts",
|
||||
},
|
||||
};
|
||||
|
||||
ret = header_ext_add(buf, QCOW2_EXT_MAGIC_FEATURE_TABLE,
|
||||
features, sizeof(features), buflen);
|
||||
if (ret < 0) {
|
||||
goto fail;
|
||||
ret = header_ext_add(buf, QCOW2_EXT_MAGIC_FEATURE_TABLE,
|
||||
features, sizeof(features), buflen);
|
||||
if (ret < 0) {
|
||||
goto fail;
|
||||
}
|
||||
buf += ret;
|
||||
buflen -= ret;
|
||||
}
|
||||
buf += ret;
|
||||
buflen -= ret;
|
||||
|
||||
/* Keep unknown header extensions */
|
||||
QLIST_FOREACH(uext, &s->unknown_header_ext, next) {
|
||||
|
@ -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
|
||||
|
@ -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 ===
|
||||
|
Loading…
Reference in New Issue
Block a user