[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] qcow2: Force preallocation with data-file-raw
From: |
Alberto Garcia |
Subject: |
Re: [PATCH 1/2] qcow2: Force preallocation with data-file-raw |
Date: |
Fri, 19 Jun 2020 18:47:56 +0200 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
On Fri 19 Jun 2020 12:40:11 PM CEST, Max Reitz wrote:
> + if (qcow2_opts->data_file_raw &&
> + qcow2_opts->preallocation == PREALLOC_MODE_OFF)
> + {
> + /*
> + * data-file-raw means that "the external data file can be
> + * read as a consistent standalone raw image without looking
> + * at the qcow2 metadata." It does not say that the metadata
> + * must be ignored, though (and the qcow2 driver in fact does
> + * not ignore it), so the L1/L2 tables must be present and
> + * give a 1:1 mapping, so you get the same result regardless
> + * of whether you look at the metadata or whether you ignore
> + * it.
> + */
> + qcow2_opts->preallocation = PREALLOC_MODE_METADATA;
I'm not convinced by this, but your comment made me think of another
possible alternative: in qcow2_get_cluster_offset(), if the cluster is
unallocated and we are using a raw data file then we return _ZERO_PLAIN:
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -654,6 +654,10 @@ out:
assert(bytes_available - offset_in_cluster <= UINT_MAX);
*bytes = bytes_available - offset_in_cluster;
+ if (type == QCOW2_CLUSTER_UNALLOCATED && data_file_is_raw(bs)) {
+ type = QCOW2_CLUSTER_ZERO_PLAIN;
+ }
+
return type;
You could even add a '&& bs->backing' to the condition and emit a
warning to make it more explicit.
Berto
- [PATCH 0/2] qcow2: Force preallocation with data-file-raw, Max Reitz, 2020/06/19
- [PATCH 1/2] qcow2: Force preallocation with data-file-raw, Max Reitz, 2020/06/19
- Re: [PATCH 1/2] qcow2: Force preallocation with data-file-raw,
Alberto Garcia <=
- Re: [PATCH 1/2] qcow2: Force preallocation with data-file-raw, Alberto Garcia, 2020/06/22
- Re: [PATCH 1/2] qcow2: Force preallocation with data-file-raw, Max Reitz, 2020/06/22
- Re: [PATCH 1/2] qcow2: Force preallocation with data-file-raw, Nir Soffer, 2020/06/22
- Re: [PATCH 1/2] qcow2: Force preallocation with data-file-raw, Max Reitz, 2020/06/22
- Re: [PATCH 1/2] qcow2: Force preallocation with data-file-raw, Eric Blake, 2020/06/22
- Re: [PATCH 1/2] qcow2: Force preallocation with data-file-raw, Alberto Garcia, 2020/06/22
- Re: [PATCH 1/2] qcow2: Force preallocation with data-file-raw, Max Reitz, 2020/06/23