aboutsummaryrefslogtreecommitdiff
path: root/block/qed.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/qed.c')
-rw-r--r--block/qed.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/block/qed.c b/block/qed.c
index 7c2a65a..d8c4e5f 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -673,8 +673,11 @@ static int coroutine_fn bdrv_qed_co_create(BlockdevCreateOptions *opts,
l1_size = header.cluster_size * header.table_size;
- /* File must start empty and grow, check truncate is supported */
- ret = blk_truncate(blk, 0, false, PREALLOC_MODE_OFF, errp);
+ /*
+ * The QED format associates file length with allocation status,
+ * so a new file (which is empty) must have a length of 0.
+ */
+ ret = blk_truncate(blk, 0, true, PREALLOC_MODE_OFF, errp);
if (ret < 0) {
goto out;
}