From: Sanne Raymaekers <sraymaek@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, fam@euphon.net, kwolf@redhat.com,
hreitz@redhat.com, Sanne Raymaekers <sraymaek@redhat.com>
Subject: [PATCH v3 1/3] block/vmdk: align stream optimized data grains on 512 byte chunks
Date: Fri, 16 Oct 2026 14:37:48 +0200 [thread overview]
Message-ID: <20261016123750.94769-2-sraymaek@redhat.com> (raw)
In-Reply-To: <20261016123750.94769-1-sraymaek@redhat.com>
For stream optimized disks the spec notes: "Each marker and its
associated block begin on a sector or 512‐byte boundary... There are
five types of markers: compressed grain markers,..." [^1]
This means that instead of aligning grains on their typical size (64K),
in stream optimized disks, grains should be aligned on 512 byte chunks.
[^1] Virtual Disk Format 5.0 Technical Note.
Signed-off-by: Sanne Raymaekers <sraymaek@redhat.com>
---
block/vmdk.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index cd8b4ec7c8..7ca030c5fe 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1730,16 +1730,25 @@ get_cluster_offset(BlockDriverState *bs, VmdkExtent *extent,
cluster_sector = extent->next_cluster_sector;
extent->next_cluster_sector += extent->cluster_sectors;
- /* First of all we write grain itself, to avoid race condition
- * that may to corrupt the image.
- * This problem may occur because of insufficient space on host disk
- * or inappropriate VM shutdown.
+ /*
+ * Stream optimized (compressed) extents do not have to be
+ * pre-allocated, as compressed writes always cover the whole
+ * cluster, and will align on 512 byte chunks.
*/
- ret = get_whole_cluster(bs, extent, cluster_sector * BDRV_SECTOR_SIZE,
- offset, skip_start_bytes, skip_end_bytes,
- zeroed);
- if (ret) {
- return ret;
+ if (!extent->compressed) {
+ /*
+ * First of all we write grain itself, to avoid race condition
+ * that may to corrupt the image.
+ * This problem may occur because of insufficient space on host disk
+ * or inappropriate VM shutdown.
+ */
+ ret = get_whole_cluster(bs, extent,
+ cluster_sector * BDRV_SECTOR_SIZE,
+ offset, skip_start_bytes, skip_end_bytes,
+ zeroed);
+ if (ret) {
+ return ret;
+ }
}
if (m_data) {
m_data->new_allocation = true;
--
2.55.0
next prev parent reply other threads:[~2026-10-16 12:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 12:37 [PATCH v3 0/3] block/vmdk: fixes for stream optimized disks Sanne Raymaekers
2026-10-16 12:37 ` Sanne Raymaekers [this message]
2026-10-16 12:37 ` [PATCH v3 2/3] block/vmdk: skip RGD " Sanne Raymaekers
2026-10-16 12:37 ` [PATCH v3 3/3] block/vmdk: add eos marker " Sanne Raymaekers
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=20261016123750.94769-2-sraymaek@redhat.com \
--to=sraymaek@redhat.com \
--cc=fam@euphon.net \
--cc=hreitz@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.