[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 32/34] qcow2: Allow preallocation and backing files if extended_l2
From: |
Max Reitz |
Subject: |
[PULL 32/34] qcow2: Allow preallocation and backing files if extended_l2 is set |
Date: |
Tue, 25 Aug 2020 10:33:09 +0200 |
From: Alberto Garcia <berto@igalia.com>
Traditional qcow2 images don't allow preallocation if a backing file
is set. This is because once a cluster is allocated there is no way to
tell that its data should be read from the backing file.
Extended L2 entries have individual allocation bits for each
subcluster, and therefore it is perfectly possible to have an
allocated cluster with all its subclusters unallocated.
Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id:
<6d5b0f38e7dc5f2f31d8cab1cb92044e9909aece.1594396418.git.berto@igalia.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
block/qcow2.c | 7 ++++---
tests/qemu-iotests/206.out | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index 00cda5696b..da56b1a4df 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -3449,10 +3449,11 @@ qcow2_co_create(BlockdevCreateOptions *create_options,
Error **errp)
qcow2_opts->preallocation = PREALLOC_MODE_OFF;
}
if (qcow2_opts->has_backing_file &&
- qcow2_opts->preallocation != PREALLOC_MODE_OFF)
+ qcow2_opts->preallocation != PREALLOC_MODE_OFF &&
+ !qcow2_opts->extended_l2)
{
- error_setg(errp, "Backing file and preallocation cannot be used at "
- "the same time");
+ error_setg(errp, "Backing file and preallocation can only be used at "
+ "the same time if extended_l2 is on");
ret = -EINVAL;
goto out;
}
diff --git a/tests/qemu-iotests/206.out b/tests/qemu-iotests/206.out
index 363c5abe35..a100849fcb 100644
--- a/tests/qemu-iotests/206.out
+++ b/tests/qemu-iotests/206.out
@@ -203,7 +203,7 @@ Job failed: Different refcount widths than 16 bits require
compatibility level 1
=== Invalid backing file options ===
{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options":
{"backing-file": "/dev/null", "driver": "qcow2", "file": "node0",
"preallocation": "full", "size": 67108864}}}
{"return": {}}
-Job failed: Backing file and preallocation cannot be used at the same time
+Job failed: Backing file and preallocation can only be used at the same time
if extended_l2 is on
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
{"return": {}}
--
2.26.2
- [PULL 22/34] qcow2: Add subcluster support to zero_in_l2_slice(), (continued)
- [PULL 22/34] qcow2: Add subcluster support to zero_in_l2_slice(), Max Reitz, 2020/08/25
- [PULL 21/34] qcow2: Add subcluster support to qcow2_get_host_offset(), Max Reitz, 2020/08/25
- [PULL 23/34] qcow2: Add subcluster support to discard_in_l2_slice(), Max Reitz, 2020/08/25
- [PULL 25/34] qcow2: Update L2 bitmap in qcow2_alloc_cluster_link_l2(), Max Reitz, 2020/08/25
- [PULL 24/34] qcow2: Add subcluster support to check_refcounts_l2(), Max Reitz, 2020/08/25
- [PULL 27/34] qcow2: Add subcluster support to handle_alloc_space(), Max Reitz, 2020/08/25
- [PULL 28/34] qcow2: Add subcluster support to qcow2_co_pwrite_zeroes(), Max Reitz, 2020/08/25
- [PULL 30/34] qcow2: Add prealloc field to QCowL2Meta, Max Reitz, 2020/08/25
- [PULL 29/34] qcow2: Add subcluster support to qcow2_measure(), Max Reitz, 2020/08/25
- [PULL 31/34] qcow2: Add the 'extended_l2' option and the QCOW2_INCOMPAT_EXTL2 bit, Max Reitz, 2020/08/25
- [PULL 32/34] qcow2: Allow preallocation and backing files if extended_l2 is set,
Max Reitz <=
- [PULL 33/34] qcow2: Assert that expand_zero_clusters_in_l1() does not support subclusters, Max Reitz, 2020/08/25
- [PULL 34/34] iotests: Add tests for qcow2 images with extended L2 entries, Max Reitz, 2020/08/25
- [PULL 26/34] qcow2: Clear the L2 bitmap when allocating a compressed cluster, Max Reitz, 2020/08/25
- Re: [PULL 00/34] Block patches, Peter Maydell, 2020/08/25