[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/17] qcow2: Write feature table only for v3 images
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 06/17] qcow2: Write feature table only for v3 images |
Date: |
Wed, 20 Jan 2016 17:24:55 +0100 |
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 <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
block/qcow2.c | 48 ++++++++++++++++++++++++----------------------
tests/qemu-iotests/031.out | 12 +-----------
tests/qemu-iotests/061.out | 15 ---------------
3 files changed, 26 insertions(+), 49 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index e4e2754..20e4057 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -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) {
diff --git a/tests/qemu-iotests/031.out b/tests/qemu-iotests/031.out
index fce3ce0..f065404 100644
--- a/tests/qemu-iotests/031.out
+++ b/tests/qemu-iotests/031.out
@@ -53,11 +53,6 @@ refcount_order 4
header_length 72
Header extension:
-magic 0x6803f857
-length 144
-data <binary>
-
-Header extension:
magic 0x12345678
length 31
data 'This is a test header extension'
@@ -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
@@ -91,11 +86,6 @@ length 11
data 'host_device'
Header extension:
-magic 0x6803f857
-length 144
-data <binary>
-
-Header extension:
magic 0x12345678
length 31
data 'This is a test header extension'
diff --git a/tests/qemu-iotests/061.out b/tests/qemu-iotests/061.out
index 57aae28..d604682 100644
--- a/tests/qemu-iotests/061.out
+++ b/tests/qemu-iotests/061.out
@@ -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 ===
--
1.8.3.1
- [Qemu-devel] [PULL 00/17] Block patches, Kevin Wolf, 2016/01/20
- [Qemu-devel] [PULL 03/17] qemu-img: Speed up comparing empty/zero images, Kevin Wolf, 2016/01/20
- [Qemu-devel] [PULL 02/17] block/raw-posix: avoid bogus fixup for cylinders on DASD disks, Kevin Wolf, 2016/01/20
- [Qemu-devel] [PULL 01/17] block: Fix .bdrv_open flags, Kevin Wolf, 2016/01/20
- [Qemu-devel] [PULL 07/17] qcow2: Write full header on image creation, Kevin Wolf, 2016/01/20
- [Qemu-devel] [PULL 08/17] block: Assert no write requests under BDRV_O_INCOMING, Kevin Wolf, 2016/01/20
- [Qemu-devel] [PULL 04/17] qemu-iotests: Reduce racy output in 028, Kevin Wolf, 2016/01/20
- [Qemu-devel] [PULL 09/17] block: Fix error path in bdrv_invalidate_cache(), Kevin Wolf, 2016/01/20
- [Qemu-devel] [PULL 06/17] qcow2: Write feature table only for v3 images,
Kevin Wolf <=
- [Qemu-devel] [PULL 10/17] block: Rename BDRV_O_INCOMING to BDRV_O_INACTIVE, Kevin Wolf, 2016/01/20
- [Qemu-devel] [PULL 13/17] qcow2: Fix BDRV_O_INACTIVE handling in qcow2_invalidate_cache(), Kevin Wolf, 2016/01/20
- [Qemu-devel] [PULL 12/17] qcow2: Implement .bdrv_inactivate, Kevin Wolf, 2016/01/20
- [Qemu-devel] [PULL 15/17] vmdk: Create streamOptimized as version 3, Kevin Wolf, 2016/01/20
- [Qemu-devel] [PULL 14/17] qcow2: Make image inaccessible after failed qcow2_invalidate_cache(), Kevin Wolf, 2016/01/20
- [Qemu-devel] [PULL 17/17] iotests: Test that throttle values ranges, Kevin Wolf, 2016/01/20
- [Qemu-devel] [PULL 16/17] blockdev: Error out on negative throttling option values, Kevin Wolf, 2016/01/20
- [Qemu-devel] [PULL 05/17] block: Clean up includes, Kevin Wolf, 2016/01/20
- [Qemu-devel] [PULL 11/17] block: Inactivate BDS when migration completes, Kevin Wolf, 2016/01/20