aboutsummaryrefslogtreecommitdiff
path: root/block/qcow2.h
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2017-05-04 01:11:18 +0200
committerKevin Wolf <kwolf@redhat.com>2017-05-11 12:08:24 +0200
commit564a6b693828ac38f3f562eed9e8b1dc62f45253 (patch)
tree466aa3bfb92a455ccb0648dea25659b3563e22df /block/qcow2.h
parent92413c16be8eee53a3b60739f2a28a1463651f47 (diff)
qcow2: Reuse preallocated zero clusters
Instead of just freeing preallocated zero clusters and completely allocating them from scratch, reuse them. We cannot do this in handle_copied(), however, since this is a COW operation. Therefore, we have to add the new logic to handle_alloc() and simply return the existing offset if it exists. The only catch is that we have to convince qcow2_alloc_cluster_link_l2() not to free the old clusters (because we have reused them). Reported-by: Eric Blake <eblake@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qcow2.h')
-rw-r--r--block/qcow2.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/block/qcow2.h b/block/qcow2.h
index f8aeb08794..8731f24b82 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -322,6 +322,9 @@ typedef struct QCowL2Meta
/** Number of newly allocated clusters */
int nb_clusters;
+ /** Do not free the old clusters */
+ bool keep_old_clusters;
+
/**
* Requests that overlap with this allocation and wait to be restarted
* when the allocating request has completed.