[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v7 28/32] qcow2: Add subcluster support to qcow2_co_pwrite_ze
From: |
Eric Blake |
Subject: |
Re: [PATCH v7 28/32] qcow2: Add subcluster support to qcow2_co_pwrite_zeroes() |
Date: |
Wed, 27 May 2020 12:58:10 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
On 5/25/20 1:08 PM, Alberto Garcia wrote:
This works now at the subcluster level and pwrite_zeroes_alignment is
updated accordingly.
qcow2_cluster_zeroize() is turned into qcow2_subcluster_zeroize() with
the following changes:
- The request can now be subcluster-aligned.
- The cluster-aligned body of the request is still zeroized using
zero_in_l2_slice() as before.
- The subcluster-aligned head and tail of the request are zeroized
with the new zero_l2_subclusters() function.
There is just one thing to take into account for a possible future
improvement: compressed clusters cannot be partially zeroized so
zero_l2_subclusters() on the head or the tail can return -ENOTSUP.
This makes the caller repeat the *complete* request and write actual
zeroes to disk. This is sub-optimal because
1) if the head area was compressed we would still be able to use
the fast path for the body and possibly the tail.
2) if the tail area was compressed we are writing zeroes to the
head and the body areas, which are already zeroized.
Is this true? The block layer tries hard to break zero requests up so
that any non-cluster-aligned requests do not cross cluster boundaries.
In practice, that means that when you have an unaligned request, the
head and tail cluster will be the same cluster, and there is no body in
play, so that returning -ENOTSUP is correct because there really is no
other work to do and repeating the entire request (which is less than a
cluster in length) is the right approach.
Signed-off-by: Alberto Garcia <address@hidden>
---
block/qcow2.h | 4 +--
block/qcow2-cluster.c | 80 +++++++++++++++++++++++++++++++++++++++----
block/qcow2.c | 27 ++++++++-------
3 files changed, 90 insertions(+), 21 deletions(-)
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
[PATCH v7 15/32] qcow2: Add qcow2_get_subcluster_range_type(), Alberto Garcia, 2020/05/25
[PATCH v7 06/32] qcow2: Add get_l2_entry() and set_l2_entry(), Alberto Garcia, 2020/05/25
[PATCH v7 09/32] qcow2: Add subcluster-related fields to BDRVQcow2State, Alberto Garcia, 2020/05/25
[PATCH v7 23/32] qcow2: Add subcluster support to discard_in_l2_slice(), Alberto Garcia, 2020/05/25
[PATCH v7 01/32] qcow2: Make Qcow2AioTask store the full host offset, Alberto Garcia, 2020/05/25