Skip to contentSkip to conversation

qcow2: Keep option in qcow2_invalidate_cache()

PATCH Applied Kevin Wolf 3 participants 3 messages Mar 11, 2014 Block layer

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 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.

---
 block/qcow2.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
block/qcow2.c +1 -4
index da82646..945c9d6 100644
@@ -1180,11 +1180,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);
Signature · 1 line
1.8.1.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Kevin Wolf

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.

Quoted 7 lines

This fixes all of the driver-specific options in qcow2, except for lazy-refcounts, which was special cased before.

---
  block/qcow2.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
#2 lore raw
In reply to Kevin Wolf
Quoted 5 lines · Kevin Wolf

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.

Quoted 7 lines

This fixes all of the driver-specific options in qcow2, except for lazy-refcounts, which was special cased before.

---
 block/qcow2.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan