summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2014-03-11 17:42:41 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2014-03-13 14:42:24 +0100
commitd475e5acd2f4679d6ce458369ee658dbd60227e9 (patch)
tree42526d3074546b05125afe76f03f45d8f641eb33
parentdc3dd0d2bed6edf3b60041f31200c674348168e9 (diff)
downloadqemu-d475e5acd2f4679d6ce458369ee658dbd60227e9.tar.gz
qemu-d475e5acd2f4679d6ce458369ee658dbd60227e9.tar.bz2
qemu-d475e5acd2f4679d6ce458369ee658dbd60227e9.zip
qcow2: Keep option in qcow2_invalidate_cache()
Instead of manually building a list of all options from BDRVQcowState values just reuse the options that were used to open the image. qcow2_open() won't fully use all of the options in the QDict, but that's okay. This fixes all of the driver-specific options in qcow2, except for lazy-refcounts, which was special cased before. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r--block/qcow2.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/block/qcow2.c b/block/qcow2.c
index b5b1e8c1b9..ec23cc47e4 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1178,11 +1178,8 @@ static void qcow2_invalidate_cache(BlockDriverState *bs)
bdrv_invalidate_cache(bs->file);
- options = qdict_new();
- qdict_put(options, QCOW2_OPT_LAZY_REFCOUNTS,
- qbool_from_int(s->use_lazy_refcounts));
-
memset(s, 0, sizeof(BDRVQcowState));
+ options = qdict_clone_shallow(bs->options);
qcow2_open(bs, options, flags, NULL);
QDECREF(options);