[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-block] [PULL 26/58] qcow2: Discard preallocated zero clusters

From: Kevin Wolf
Subject: [Qemu-block] [PULL 26/58] qcow2: Discard preallocated zero clusters
Date: Thu, 11 May 2017 16:32:29 +0200

From: Max Reitz <address@hidden>

In discard_single_l2(), we completely discard normal clusters instead of
simply turning them into preallocated zero clusters. That means we
should probably do the same with such preallocated zero clusters:
Discard them instead of keeping them allocated.

Reported-by: Eric Blake <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
 block/qcow2-cluster.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index fb91fd8..31077d8 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -1511,7 +1511,8 @@ static int discard_single_l2(BlockDriverState *bs, 
uint64_t offset,
             case QCOW2_CLUSTER_ZERO:
-                if (!full_discard) {
+                /* Preallocated zero clusters should be discarded in any case 
+                if (!full_discard && (old_l2_entry & L2E_OFFSET_MASK) == 0) {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]