[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 22/30] qcow2: Fix offset calculation in handle_dependencies()
From: |
Alberto Garcia |
Subject: |
[PATCH v4 22/30] qcow2: Fix offset calculation in handle_dependencies() |
Date: |
Tue, 17 Mar 2020 19:16:19 +0100 |
l2meta_cow_start() and l2meta_cow_end() are not necessarily
cluster-aligned if the image has subclusters, so update the
calculation of old_start and old_end to guarantee that no two requests
try to write on the same cluster.
Signed-off-by: Alberto Garcia <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
---
block/qcow2-cluster.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 824c710760..ceacd91ea3 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -1306,8 +1306,8 @@ static int handle_dependencies(BlockDriverState *bs,
uint64_t guest_offset,
uint64_t start = guest_offset;
uint64_t end = start + bytes;
- uint64_t old_start = l2meta_cow_start(old_alloc);
- uint64_t old_end = l2meta_cow_end(old_alloc);
+ uint64_t old_start = start_of_cluster(s, l2meta_cow_start(old_alloc));
+ uint64_t old_end = ROUND_UP(l2meta_cow_end(old_alloc),
s->cluster_size);
if (end <= old_start || start >= old_end) {
/* No intersection */
--
2.20.1
- [PATCH v4 00/30] Add subcluster allocation to qcow2, Alberto Garcia, 2020/03/17
- [PATCH v4 12/30] qcow2: Update get/set_l2_entry() and add get/set_l2_bitmap(), Alberto Garcia, 2020/03/17
- [PATCH v4 22/30] qcow2: Fix offset calculation in handle_dependencies(),
Alberto Garcia <=
- [PATCH v4 10/30] qcow2: Add offset_to_sc_index(), Alberto Garcia, 2020/03/17
- [PATCH v4 16/30] qcow2: Handle QCOW2_SUBCLUSTER_UNALLOCATED_ALLOC, Alberto Garcia, 2020/03/17
- [PATCH v4 29/30] qcow2: Add subcluster support to qcow2_measure(), Alberto Garcia, 2020/03/17
- [PATCH v4 18/30] qcow2: Add subcluster support to qcow2_get_host_offset(), Alberto Garcia, 2020/03/17
- [PATCH v4 06/30] qcow2: Add get_l2_entry() and set_l2_entry(), Alberto Garcia, 2020/03/17
- [PATCH v4 05/30] qcow2: Process QCOW2_CLUSTER_ZERO_ALLOC clusters in handle_copied(), Alberto Garcia, 2020/03/17
- [PATCH v4 11/30] qcow2: Add l2_entry_size(), Alberto Garcia, 2020/03/17
- [PATCH v4 02/30] qcow2: Convert qcow2_get_cluster_offset() into qcow2_get_host_offset(), Alberto Garcia, 2020/03/17
- [PATCH v4 15/30] qcow2: Replace QCOW2_CLUSTER_* with QCOW2_SUBCLUSTER_*, Alberto Garcia, 2020/03/17