]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qcow2: Save refcount order in BDRVQcowState
authorMax Reitz <mreitz@redhat.com>
Tue, 3 Sep 2013 08:09:53 +0000 (10:09 +0200)
committerKevin Wolf <kwolf@redhat.com>
Thu, 12 Sep 2013 08:12:46 +0000 (10:12 +0200)
Save the image refcount order in BDRVQcowState. This will be relevant
for future code supporting different refcount orders than four and also
for code that needs to verify a certain refcount order for an opened
image.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow2.c
block/qcow2.h

index c9e266e22e6ee32f8dc8a64bc8fa1486b339067b..27203f8f0768e89004bd2b774d55aebc69b321dd 100644 (file)
@@ -455,6 +455,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags)
         ret = -ENOTSUP;
         goto fail;
     }
+    s->refcount_order = header.refcount_order;
 
     if (header.cluster_bits < MIN_CLUSTER_BITS ||
         header.cluster_bits > MAX_CLUSTER_BITS) {
@@ -1143,7 +1144,7 @@ int qcow2_update_header(BlockDriverState *bs)
         .incompatible_features  = cpu_to_be64(s->incompatible_features),
         .compatible_features    = cpu_to_be64(s->compatible_features),
         .autoclear_features     = cpu_to_be64(s->autoclear_features),
-        .refcount_order         = cpu_to_be32(3 + REFCOUNT_SHIFT),
+        .refcount_order         = cpu_to_be32(s->refcount_order),
         .header_length          = cpu_to_be32(header_length),
     };
 
index 48080fdc03fe0896407d8e550b294bcc5ca2c00e..bea6ddb43a442bc1a18b91808e3b3e5ce2b59637 100644 (file)
@@ -199,6 +199,7 @@ typedef struct BDRVQcowState {
     int flags;
     int qcow_version;
     bool use_lazy_refcounts;
+    int refcount_order;
 
     bool discard_passthrough[QCOW2_DISCARD_MAX];