[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
- Re: [PATCH v5 28/31] qcow2: Add the 'extended_l2' option and the QCOW2_INCOMPAT_EXTL2 bit, (continued)
- [PATCH v5 05/31] qcow2: Process QCOW2_CLUSTER_ZERO_ALLOC clusters in handle_copied(), Alberto Garcia, 2020/05/05
- [PATCH v5 26/31] qcow2: Add subcluster support to handle_alloc_space(), Alberto Garcia, 2020/05/05
- [PATCH v5 20/31] qcow2: Add subcluster support to qcow2_get_host_offset(), 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 16/31] qcow2: Add cluster type parameter to qcow2_get_host_offset(), Alberto Garcia, 2020/05/05
- Re: [PATCH v5 00/31] Add subcluster allocation to qcow2, Derek Su, 2020/05/20