aboutsummaryrefslogtreecommitdiff
path: root/block/qcow2.h
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2012-12-07 18:08:43 +0100
committerKevin Wolf <kwolf@redhat.com>2012-12-13 15:37:59 +0100
commit593fb83cacf3818a5623f31a6c04c24d87519ad0 (patch)
treed514857a9d33adb5973dc509323ea7ef803bca0c /block/qcow2.h
parent1d3afd649bc77aa14bc2741e2da6475822d41c5f (diff)
qcow2: Introduce Qcow2COWRegion
This makes it easier to address the areas for which a COW must be performed. As a nice side effect, the COW code in qcow2_alloc_cluster_link_l2 becomes really trivial. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qcow2.h')
-rw-r--r--block/qcow2.h29
1 files changed, 23 insertions, 6 deletions
diff --git a/block/qcow2.h b/block/qcow2.h
index 2a406a7e83..1106b33206 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -196,6 +196,17 @@ typedef struct QCowCreateState {
struct QCowAIOCB;
+typedef struct Qcow2COWRegion {
+ /**
+ * Offset of the COW region in bytes from the start of the first cluster
+ * touched by the request.
+ */
+ uint64_t offset;
+
+ /** Number of sectors to copy */
+ int nb_sectors;
+} Qcow2COWRegion;
+
/* XXX This could be private for qcow2-cluster.c */
typedef struct QCowL2Meta
{
@@ -209,12 +220,6 @@ typedef struct QCowL2Meta
uint64_t alloc_offset;
/**
- * Number of sectors between the start of the first allocated cluster and
- * the area that the guest actually writes to.
- */
- int n_start;
-
- /**
* Number of sectors from the start of the first allocated cluster to
* the end of the (possibly shortened) request
*/
@@ -229,6 +234,18 @@ typedef struct QCowL2Meta
*/
CoQueue dependent_requests;
+ /**
+ * The COW Region between the start of the first allocated cluster and the
+ * area the guest actually writes to.
+ */
+ Qcow2COWRegion cow_start;
+
+ /**
+ * The COW Region between the area the guest actually writes to and the
+ * end of the last allocated cluster.
+ */
+ Qcow2COWRegion cow_end;
+
QLIST_ENTRY(QCowL2Meta) next_in_flight;
} QCowL2Meta;