[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 16/23] qcow2: Add subcluster support to discard_in_l2_slice()
From: |
Alberto Garcia |
Subject: |
[RFC PATCH 16/23] qcow2: Add subcluster support to discard_in_l2_slice() |
Date: |
Tue, 15 Oct 2019 18:23:27 +0300 |
Setting the QCOW_OFLAG_ZERO bit of the L2 entry is forbidden if an
image has subclusters. Instead, the individual 'all zeroes' bits must
be used.
Signed-off-by: Alberto Garcia <address@hidden>
---
block/qcow2-cluster.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index c554b1a88c..bf32447d18 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -1769,7 +1769,11 @@ static int discard_in_l2_slice(BlockDriverState *bs,
uint64_t offset,
/* First remove L2 entries */
qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_slice);
- if (!full_discard && s->qcow_version >= 3) {
+ if (has_subclusters(s)) {
+ set_l2_entry(s, l2_slice, l2_index + i, 0);
+ set_l2_bitmap(s, l2_slice, l2_index + i,
+ full_discard ? 0 : QCOW_L2_BITMAP_ALL_ZEROES);
+ } else if (!full_discard && s->qcow_version >= 3) {
set_l2_entry(s, l2_slice, l2_index + i, QCOW_OFLAG_ZERO);
} else {
set_l2_entry(s, l2_slice, l2_index + i, 0);
--
2.20.1
- [RFC PATCH 00/23] Add subcluster allocation to qcow2, Alberto Garcia, 2019/10/15
- [RFC PATCH 10/23] qcow2: Update get/set_l2_entry() and add get/set_l2_bitmap(), Alberto Garcia, 2019/10/15
- [RFC PATCH 06/23] qcow2: Add dummy has_subclusters() function, Alberto Garcia, 2019/10/15
- [RFC PATCH 12/23] qcow2: Handle QCOW2_CLUSTER_UNALLOCATED_SUBCLUSTER, Alberto Garcia, 2019/10/15
- [RFC PATCH 16/23] qcow2: Add subcluster support to discard_in_l2_slice(),
Alberto Garcia <=
- [RFC PATCH 09/23] qcow2: Add l2_entry_size(), Alberto Garcia, 2019/10/15
- [RFC PATCH 01/23] qcow2: Add calculate_l2_meta(), Alberto Garcia, 2019/10/15
- [RFC PATCH 03/23] qcow2: Process QCOW2_CLUSTER_ZERO_ALLOC clusters in handle_copied(), Alberto Garcia, 2019/10/15
- [RFC PATCH 05/23] qcow2: Document the Extended L2 Entries feature, Alberto Garcia, 2019/10/15
- [RFC PATCH 04/23] qcow2: Add get_l2_entry() and set_l2_entry(), Alberto Garcia, 2019/10/15
- [RFC PATCH 08/23] qcow2: Add offset_to_sc_index(), Alberto Garcia, 2019/10/15
- [RFC PATCH 11/23] qcow2: Add qcow2_get_subcluster_type(), Alberto Garcia, 2019/10/15
- [RFC PATCH 15/23] qcow2: Add subcluster support to zero_in_l2_slice(), Alberto Garcia, 2019/10/15
- [RFC PATCH 22/23] qcow2: Restrict qcow2_co_pwrite_zeroes() to full clusters only, Alberto Garcia, 2019/10/15
- [RFC PATCH 07/23] qcow2: Add subcluster-related fields to BDRVQcow2State, Alberto Garcia, 2019/10/15