diff options
author | Alberto Garcia <berto@igalia.com> | 2020-07-10 18:13:10 +0200 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2020-08-25 08:33:20 +0200 |
commit | a6841a2de66fa44fe52ed996b70f9fb9f7bd6ca7 (patch) | |
tree | e8491a57771b690e9613224f4c128a7f84605aaa /block/qcow2.h | |
parent | bf4a66eed423694cfa0b3b5692211264022e2b98 (diff) |
qcow2: Add subcluster support to qcow2_co_pwrite_zeroes()
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.
Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <17e05e2ee7e12f10dcf012da81e83ebe27eb3bef.1594396418.git.berto@igalia.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/qcow2.h')
-rw-r--r-- | block/qcow2.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/block/qcow2.h b/block/qcow2.h index 4fad40b96b..4ef4ae4ab0 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -898,8 +898,8 @@ void qcow2_alloc_cluster_abort(BlockDriverState *bs, QCowL2Meta *m); int qcow2_cluster_discard(BlockDriverState *bs, uint64_t offset, uint64_t bytes, enum qcow2_discard_type type, bool full_discard); -int qcow2_cluster_zeroize(BlockDriverState *bs, uint64_t offset, - uint64_t bytes, int flags); +int qcow2_subcluster_zeroize(BlockDriverState *bs, uint64_t offset, + uint64_t bytes, int flags); int qcow2_expand_zero_clusters(BlockDriverState *bs, BlockDriverAmendStatusCB *status_cb, |