Message ID | 655e0ce198903682430272f6cfecb08afee6667c.1577014346.git.berto@igalia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add subcluster allocation to qcow2 | expand |
On 22.12.19 12:37, Alberto Garcia wrote: > 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 <berto@igalia.com> > --- > block/qcow2-cluster.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Max Reitz <mreitz@redhat.com>
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index ede75138d2..0a40944667 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -1279,8 +1279,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 */
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 <berto@igalia.com> --- block/qcow2-cluster.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)