yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
958e1b
From 2d939b5a9f5717aba21727f635c6da898123ad5b Mon Sep 17 00:00:00 2001
eb5a2f
From: Max Reitz <mreitz@redhat.com>
eb5a2f
Date: Fri, 2 May 2014 16:06:20 +0200
958e1b
Subject: [PATCH 02/31] qcow2: Free preallocated zero clusters
eb5a2f
eb5a2f
RH-Author: Max Reitz <mreitz@redhat.com>
eb5a2f
Message-id: <1399046781-16359-2-git-send-email-mreitz@redhat.com>
eb5a2f
Patchwork-id: 58644
eb5a2f
O-Subject: [RHEL-7.0 qemu-kvm PATCH 1/2] qcow2: Free preallocated zero clusters
958e1b
Bugzilla: 1052093
eb5a2f
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
eb5a2f
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
eb5a2f
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
eb5a2f
958e1b
BZ: 1052093
958e1b
eb5a2f
In qcow2_free_any_clusters, preallocated zero clusters should be freed
eb5a2f
just as normal clusters are.
eb5a2f
eb5a2f
Signed-off-by: Max Reitz <mreitz@redhat.com>
eb5a2f
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
eb5a2f
(cherry picked from commit 8f730dd24edd2576ecbd596de7ea4361296b129c)
eb5a2f
eb5a2f
Signed-off-by: Max Reitz <mreitz@redhat.com>
eb5a2f
---
eb5a2f
 block/qcow2-refcount.c | 8 +++++---
eb5a2f
 1 file changed, 5 insertions(+), 3 deletions(-)
eb5a2f
eb5a2f
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
eb5a2f
---
eb5a2f
 block/qcow2-refcount.c |    8 +++++---
eb5a2f
 1 files changed, 5 insertions(+), 3 deletions(-)
eb5a2f
eb5a2f
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
eb5a2f
index 73ae4e3..429b01c 100644
eb5a2f
--- a/block/qcow2-refcount.c
eb5a2f
+++ b/block/qcow2-refcount.c
eb5a2f
@@ -811,11 +811,13 @@ void qcow2_free_any_clusters(BlockDriverState *bs, uint64_t l2_entry,
eb5a2f
         }
eb5a2f
         break;
eb5a2f
     case QCOW2_CLUSTER_NORMAL:
eb5a2f
-        qcow2_free_clusters(bs, l2_entry & L2E_OFFSET_MASK,
eb5a2f
-                            nb_clusters << s->cluster_bits, type);
eb5a2f
+    case QCOW2_CLUSTER_ZERO:
eb5a2f
+        if (l2_entry & L2E_OFFSET_MASK) {
eb5a2f
+            qcow2_free_clusters(bs, l2_entry & L2E_OFFSET_MASK,
eb5a2f
+                                nb_clusters << s->cluster_bits, type);
eb5a2f
+        }
eb5a2f
         break;
eb5a2f
     case QCOW2_CLUSTER_UNALLOCATED:
eb5a2f
-    case QCOW2_CLUSTER_ZERO:
eb5a2f
         break;
eb5a2f
     default:
eb5a2f
         abort();
eb5a2f
-- 
eb5a2f
1.7.1
eb5a2f