From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,
Eric Blake <eblake@redhat.com>, Kevin Wolf <kwolf@redhat.com>
Subject: [Qemu-devel] [PATCH 3/4] qcow2: Discard preallocated zero clusters
Date: Thu, 4 May 2017 01:11:19 +0200 [thread overview]
Message-ID: <20170503231120.23507-4-mreitz@redhat.com> (raw)
In-Reply-To: <20170503231120.23507-1-mreitz@redhat.com>
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 <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
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 fb91fd8979..31077d8102 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,
break;
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) {
continue;
}
break;
--
2.12.2
next prev parent reply other threads:[~2017-05-03 23:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-03 23:11 [Qemu-devel] [PATCH 0/4] qcow2: Some fixes Max Reitz
2017-05-03 23:11 ` [Qemu-devel] [PATCH 1/4] qcow2: Fix preallocation size formula Max Reitz
2017-05-04 0:54 ` Eric Blake
2017-05-03 23:11 ` [Qemu-devel] [PATCH 2/4] qcow2: Reuse preallocated zero clusters Max Reitz
2017-05-04 0:58 ` Eric Blake
2017-05-03 23:11 ` Max Reitz [this message]
2017-05-04 0:58 ` [Qemu-devel] [PATCH 3/4] qcow2: Discard " Eric Blake
2017-05-03 23:11 ` [Qemu-devel] [PATCH 4/4] iotests: Extend test 066 Max Reitz
2017-05-04 1:05 ` Eric Blake
2017-05-04 15:21 ` Kevin Wolf
2017-05-04 15:23 ` [Qemu-devel] [PATCH 0/4] qcow2: Some fixes Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170503231120.23507-4-mreitz@redhat.com \
--to=mreitz@redhat.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).