[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: |
Eric Blake |
Subject: |
Re: [PATCH v5 13/31] qcow2: Update get/set_l2_entry() and add get/set_l2_bitmap() |
Date: |
Tue, 5 May 2020 15:04:32 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
On 5/5/20 12:38 PM, Alberto Garcia wrote:
Extended L2 entries are 128-bit wide: 64 bits for the entry itself and
64 bits for the subcluster allocation bitmap.
In order to support them correctly get/set_l2_entry() need to be
updated so they take the entry width into account in order to
calculate the correct offset.
This patch also adds the get/set_l2_bitmap() functions that are
used to access the bitmaps. For convenience we allow calling
get_l2_bitmap() on images without subclusters. In this case the
returned value is always 0 and has no meaning.
Signed-off-by: Alberto Garcia <address@hidden>
---
block/qcow2.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
+static inline void set_l2_bitmap(BDRVQcow2State *s, uint64_t *l2_slice,
+ int idx, uint64_t bitmap)
+{
+ assert(has_subclusters(s));
+ idx *= l2_entry_size(s) / sizeof(uint64_t);
+ l2_slice[idx + 1] = cpu_to_be64(bitmap);
+}
Unrelated to this patch, but I just thought of it:
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?
But for this patch:
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
- [PATCH v5 28/31] qcow2: Add the 'extended_l2' option and the QCOW2_INCOMPAT_EXTL2 bit, (continued)
- [PATCH v5 28/31] qcow2: Add the 'extended_l2' option and the QCOW2_INCOMPAT_EXTL2 bit, Alberto Garcia, 2020/05/05
- [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
- Re: [PATCH v5 13/31] qcow2: Update get/set_l2_entry() and add get/set_l2_bitmap(),
Eric Blake <=
- [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