diff options
author | Max Reitz <mreitz@redhat.com> | 2013-09-03 10:09:53 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2013-09-12 10:12:46 +0200 |
commit | b6481f376bc65894910dd98db3f299d698817106 (patch) | |
tree | b5c9a01533dac47f1ae3ecd569cc6f41227a719e /block | |
parent | 32b6444d23d0ff618d73e5b766600cd258066169 (diff) |
qcow2: Save refcount order in BDRVQcowState
Save the image refcount order in BDRVQcowState. This will be relevant
for future code supporting different refcount orders than four and also
for code that needs to verify a certain refcount order for an opened
image.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/qcow2.c | 3 | ||||
-rw-r--r-- | block/qcow2.h | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/block/qcow2.c b/block/qcow2.c index c9e266e22e..27203f8f07 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -455,6 +455,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags) ret = -ENOTSUP; goto fail; } + s->refcount_order = header.refcount_order; if (header.cluster_bits < MIN_CLUSTER_BITS || header.cluster_bits > MAX_CLUSTER_BITS) { @@ -1143,7 +1144,7 @@ int qcow2_update_header(BlockDriverState *bs) .incompatible_features = cpu_to_be64(s->incompatible_features), .compatible_features = cpu_to_be64(s->compatible_features), .autoclear_features = cpu_to_be64(s->autoclear_features), - .refcount_order = cpu_to_be32(3 + REFCOUNT_SHIFT), + .refcount_order = cpu_to_be32(s->refcount_order), .header_length = cpu_to_be32(header_length), }; diff --git a/block/qcow2.h b/block/qcow2.h index 48080fdc03..bea6ddb43a 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -199,6 +199,7 @@ typedef struct BDRVQcowState { int flags; int qcow_version; bool use_lazy_refcounts; + int refcount_order; bool discard_passthrough[QCOW2_DISCARD_MAX]; |