thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From a6f84b8fefe3225f3fb6969c5f763bb7151f740e Mon Sep 17 00:00:00 2001
9ae3a8
From: Max Reitz <mreitz@redhat.com>
9ae3a8
Date: Tue, 7 Jan 2014 21:57:12 +0100
9ae3a8
Subject: [PATCH 07/14] qcow2: Save refcount order in BDRVQcowState
9ae3a8
9ae3a8
RH-Author: Max Reitz <mreitz@redhat.com>
9ae3a8
Message-id: <1389131839-12920-8-git-send-email-mreitz@redhat.com>
9ae3a8
Patchwork-id: 56543
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 07/14] qcow2: Save refcount order in BDRVQcowState
9ae3a8
Bugzilla: 1033490
9ae3a8
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
9ae3a8
BZ: 1033490
9ae3a8
9ae3a8
Save the image refcount order in BDRVQcowState. This will be relevant
9ae3a8
for future code supporting different refcount orders than four and also
9ae3a8
for code that needs to verify a certain refcount order for an opened
9ae3a8
image.
9ae3a8
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
(cherry picked from commit b6481f376bc65894910dd98db3f299d698817106)
9ae3a8
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
---
9ae3a8
 block/qcow2.c | 3 ++-
9ae3a8
 block/qcow2.h | 1 +
9ae3a8
 2 files changed, 3 insertions(+), 1 deletion(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 block/qcow2.c |    3 ++-
9ae3a8
 block/qcow2.h |    1 +
9ae3a8
 2 files changed, 3 insertions(+), 1 deletions(-)
9ae3a8
9ae3a8
diff --git a/block/qcow2.c b/block/qcow2.c
9ae3a8
index f5f68f8..0a53a3c 100644
9ae3a8
--- a/block/qcow2.c
9ae3a8
+++ b/block/qcow2.c
9ae3a8
@@ -527,6 +527,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
9ae3a8
         ret = -ENOTSUP;
9ae3a8
         goto fail;
9ae3a8
     }
9ae3a8
+    s->refcount_order = header.refcount_order;
9ae3a8
 
9ae3a8
     if (header.cluster_bits < MIN_CLUSTER_BITS ||
9ae3a8
         header.cluster_bits > MAX_CLUSTER_BITS) {
9ae3a8
@@ -1255,7 +1256,7 @@ int qcow2_update_header(BlockDriverState *bs)
9ae3a8
         .incompatible_features  = cpu_to_be64(s->incompatible_features),
9ae3a8
         .compatible_features    = cpu_to_be64(s->compatible_features),
9ae3a8
         .autoclear_features     = cpu_to_be64(s->autoclear_features),
9ae3a8
-        .refcount_order         = cpu_to_be32(3 + REFCOUNT_SHIFT),
9ae3a8
+        .refcount_order         = cpu_to_be32(s->refcount_order),
9ae3a8
         .header_length          = cpu_to_be32(header_length),
9ae3a8
     };
9ae3a8
 
9ae3a8
diff --git a/block/qcow2.h b/block/qcow2.h
9ae3a8
index 2660483..9749f03 100644
9ae3a8
--- a/block/qcow2.h
9ae3a8
+++ b/block/qcow2.h
9ae3a8
@@ -208,6 +208,7 @@ typedef struct BDRVQcowState {
9ae3a8
     int flags;
9ae3a8
     int qcow_version;
9ae3a8
     bool use_lazy_refcounts;
9ae3a8
+    int refcount_order;
9ae3a8
 
9ae3a8
     bool discard_passthrough[QCOW2_DISCARD_MAX];
9ae3a8
 
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8