block: Forward 'discard' to temporary overlay
PATCH 1/1 block: Forward 'discard' to temporary overlay
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.
--- block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block.c +2 -1
@@ -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 */
Signature · 1 line
2.20.1
Quoted 9 lines · Kevin Wolf
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 <[email protected]>--- block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 17 lines
block.c +2
-1@@ -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 */
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 10 lines · Kevin Wolf
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 <[email protected]>--- block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 6 lines · Kevin Wolf
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 <[email protected]>
Berto