Blame SOURCES/kvm-qcow2-Free-preallocated-zero-clusters.patch

eb5a2f
From 0a83451f1962265f2ac2d43c7c1cbbf1ecd77552 Mon Sep 17 00:00:00 2001
eb5a2f
From: Max Reitz <mreitz@redhat.com>
eb5a2f
Date: Fri, 2 May 2014 16:06:20 +0200
eb5a2f
Subject: [PATCH 29/30] 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
eb5a2f
Bugzilla: 1110188
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
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