* [Qemu-devel] [PATCH] qcow2: Free preallocated zero clusters
@ 2013-10-09 8:44 Max Reitz
2013-10-09 9:44 ` Kevin Wolf
0 siblings, 1 reply; 3+ messages in thread
From: Max Reitz @ 2013-10-09 8:44 UTC (permalink / raw)
To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi, Max Reitz
In qcow2_free_any_clusters, preallocated zero clusters should be freed
just as normal clusters are.
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
block/qcow2-refcount.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 2d67885..9dd5e44 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -796,11 +796,13 @@ void qcow2_free_any_clusters(BlockDriverState *bs, uint64_t l2_entry,
}
break;
case QCOW2_CLUSTER_NORMAL:
- qcow2_free_clusters(bs, l2_entry & L2E_OFFSET_MASK,
- nb_clusters << s->cluster_bits, type);
+ case QCOW2_CLUSTER_ZERO:
+ if (l2_entry & L2E_OFFSET_MASK) {
+ qcow2_free_clusters(bs, l2_entry & L2E_OFFSET_MASK,
+ nb_clusters << s->cluster_bits, type);
+ }
break;
case QCOW2_CLUSTER_UNALLOCATED:
- case QCOW2_CLUSTER_ZERO:
break;
default:
abort();
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] qcow2: Free preallocated zero clusters
2013-10-09 8:44 [Qemu-devel] [PATCH] qcow2: Free preallocated zero clusters Max Reitz
@ 2013-10-09 9:44 ` Kevin Wolf
2013-10-09 9:50 ` Max Reitz
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Wolf @ 2013-10-09 9:44 UTC (permalink / raw)
To: Max Reitz; +Cc: qemu-devel, Stefan Hajnoczi
Am 09.10.2013 um 10:44 hat Max Reitz geschrieben:
> In qcow2_free_any_clusters, preallocated zero clusters should be freed
> just as normal clusters are.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
Thanks, applied to the block branch.
Do you have a test case that would cause a leak previously?
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] qcow2: Free preallocated zero clusters
2013-10-09 9:44 ` Kevin Wolf
@ 2013-10-09 9:50 ` Max Reitz
0 siblings, 0 replies; 3+ messages in thread
From: Max Reitz @ 2013-10-09 9:50 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel, Stefan Hajnoczi
On 2013-10-09 11:44, Kevin Wolf wrote:
> Am 09.10.2013 um 10:44 hat Max Reitz geschrieben:
>> In qcow2_free_any_clusters, preallocated zero clusters should be freed
>> just as normal clusters are.
>>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
> Thanks, applied to the block branch.
>
> Do you have a test case that would cause a leak previously?
>
> Kevin
Oh, right.
qemu-img create -f qcow2 f.qcow2 64M
qemu-io -c 'write 0 64M' -c 'write -z 0 64M' -c 'discard 0 64M' f.qcow2
qemu-img check f.qcow2
seems enough, I'll send that test case as a follow-up.
Max
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-09 9:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-09 8:44 [Qemu-devel] [PATCH] qcow2: Free preallocated zero clusters Max Reitz
2013-10-09 9:44 ` Kevin Wolf
2013-10-09 9:50 ` Max Reitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).