diff options
author | Alberto Garcia <berto@igalia.com> | 2020-07-10 18:13:14 +0200 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2020-08-25 09:20:04 +0200 |
commit | 2118771ddf27dbfd6fb0b1e611423aa6cd72e160 (patch) | |
tree | d67179a64345f0d819c5f3d19e1c1bbe6d49a428 /block/qcow2.c | |
parent | 7be20252588422ab92464250d60063997ad29d59 (diff) |
qcow2: Allow preallocation and backing files if extended_l2 is set
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>
Diffstat (limited to 'block/qcow2.c')
-rw-r--r-- | block/qcow2.c | 7 |
1 files changed, 4 insertions, 3 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; } |