All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] block/vmdk: align stream optimized data grains on 512 byte chunks
@ 2026-10-05 13:33 Sanne Raymaekers
  2026-10-05 13:33 ` [PATCH 2/3] block/vmdk: skip RGD for stream optimized disks Sanne Raymaekers
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Sanne Raymaekers @ 2026-10-05 13:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, hreitz, fam, Sanne Raymaekers

According to the spec: "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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/block/vmdk.c b/block/vmdk.c
index cd8b4ec7c8..3cdca06fff 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1460,9 +1460,11 @@ get_whole_cluster(BlockDriverState *bs, VmdkExtent *extent,
     int64_t cluster_bytes;
     uint8_t *whole_grain;
     bool copy_from_backing;
+    BDRVVmdkState *s = bs->opaque;
 
     /* For COW, align request sector_num to cluster start */
-    cluster_bytes = extent->cluster_sectors << BDRV_SECTOR_BITS;
+    cluster_bytes = strcmp(s->create_type, "streamOptimized") == 0 ? SECTOR_SIZE
+      : extent->cluster_sectors << BDRV_SECTOR_BITS;
     offset = QEMU_ALIGN_DOWN(offset, cluster_bytes);
     whole_grain = qemu_blockalign(bs, cluster_bytes);
     copy_from_backing = bs->backing && !zeroed;
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-10-08 12:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-05 13:33 [PATCH 1/3] block/vmdk: align stream optimized data grains on 512 byte chunks Sanne Raymaekers
2026-10-05 13:33 ` [PATCH 2/3] block/vmdk: skip RGD for stream optimized disks Sanne Raymaekers
2026-10-07 14:40   ` Kevin Wolf
2026-10-05 13:33 ` [PATCH 3/3] block/vmdk: add eos marker " Sanne Raymaekers
2026-10-07 15:19   ` Kevin Wolf
2026-10-07 14:28 ` [PATCH 1/3] block/vmdk: align stream optimized data grains on 512 byte chunks Kevin Wolf
2026-10-08 12:14   ` Sanne Raymaekers

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.