]> git.proxmox.com Git - mirror_qemu.git/commitdiff
block: Forward 'discard' to temporary overlay
authorKevin Wolf <kwolf@redhat.com>
Thu, 4 Apr 2019 15:04:43 +0000 (17:04 +0200)
committerKevin Wolf <kwolf@redhat.com>
Mon, 8 Apr 2019 14:48:46 +0000 (16:48 +0200)
When bdrv_temp_snapshot_options() is called for snapshot=on, the
'discard' option in the options QDict hasn't been parsed and merged into
the flags yet. So copy the dict entry to make sure that the temporary
overlay enables discard when it was requested for the drive.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
block.c

diff --git a/block.c b/block.c
index 3050854528838b06ccbdf2ce879cd94bbc5ca03a..16615bc876d0c2695a3de2c851575f0b19467f42 100644 (file)
--- a/block.c
+++ b/block.c
@@ -950,8 +950,9 @@ static void bdrv_temp_snapshot_options(int *child_flags, QDict *child_options,
     qdict_set_default_str(child_options, BDRV_OPT_CACHE_DIRECT, "off");
     qdict_set_default_str(child_options, BDRV_OPT_CACHE_NO_FLUSH, "on");
 
-    /* Copy the read-only option from the parent */
+    /* Copy the read-only and discard options from the parent */
     qdict_copy_default(child_options, parent_options, BDRV_OPT_READ_ONLY);
+    qdict_copy_default(child_options, parent_options, BDRV_OPT_DISCARD);
 
     /* aio=native doesn't work for cache.direct=off, so disable it for the
      * temporary snapshot */