[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 13/31] qcow2: Update get/set_l2_entry() and add get/set_l2
From: |
Alberto Garcia |
Subject: |
Re: [PATCH v5 13/31] qcow2: Update get/set_l2_entry() and add get/set_l2_bitmap() |
Date: |
Wed, 06 May 2020 14:06:39 +0200 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
On Tue 05 May 2020 10:04:32 PM CEST, Eric Blake wrote:
> What happens for an image whose size is not cluster-aligned? Must the
> bits corresponding to subclusters not present in the final cluster
> always be zero, or are they instead ignored regardless of value?
Attempting to read or write beyond the end of the image returns an error
(see blk_check_byte_request()).
But let's say we have a 32k image (only 1/2 of the first cluster is
used) and we manipulate the bitmap to mark all subclusters as allocated.
In this case if you try 'read 0 32k' then count_contiguous_subclusters()
would indeed say that there are 64k of data available. However the
caller knows that we only want 32k and
if (bytes_available > bytes_needed) {
bytes_available = bytes_needed;
}
so in the end it doesn't really matter.
I think in practice it's the same as with traditional qcow2 images: once
we reach qcow2_get_host_offset() the code does not really know or care
about the size of the image or how much of the last cluster contains
actual data. It only cares about how much data the caller needs. The
limits have already been checked before.
But we could document it: "if the image size is not a multiple of the
cluster size then the bits corresponding to the subclusters beyond the
end of the image are ignored and should be set to zero", or something
like that.
Berto
- [PATCH v5 06/31] qcow2: Add get_l2_entry() and set_l2_entry(), (continued)
- [PATCH v5 06/31] qcow2: Add get_l2_entry() and set_l2_entry(), Alberto Garcia, 2020/05/05
- [PATCH v5 21/31] qcow2: Add subcluster support to zero_in_l2_slice(), Alberto Garcia, 2020/05/05
- [PATCH v5 15/31] qcow2: Add qcow2_cluster_is_allocated(), Alberto Garcia, 2020/05/05
- [PATCH v5 17/31] qcow2: Replace QCOW2_CLUSTER_* with QCOW2_SUBCLUSTER_*, Alberto Garcia, 2020/05/05
- [PATCH v5 30/31] qcow2: Add subcluster support to qcow2_measure(), Alberto Garcia, 2020/05/05
- [PATCH v5 13/31] qcow2: Update get/set_l2_entry() and add get/set_l2_bitmap(), Alberto Garcia, 2020/05/05
- [PATCH v5 14/31] qcow2: Add QCow2SubclusterType and qcow2_get_subcluster_type(), Alberto Garcia, 2020/05/05
- [PATCH v5 29/31] qcow2: Assert that expand_zero_clusters_in_l1() does not support subclusters, Alberto Garcia, 2020/05/05
- [PATCH v5 28/31] qcow2: Add the 'extended_l2' option and the QCOW2_INCOMPAT_EXTL2 bit, Alberto Garcia, 2020/05/05
- [PATCH v5 27/31] qcow2: Add subcluster support to qcow2_co_pwrite_zeroes(), Alberto Garcia, 2020/05/05
- [PATCH v5 20/31] qcow2: Add subcluster support to qcow2_get_host_offset(), Alberto Garcia, 2020/05/05