[libvirt] [PATCH 18/35] qemu: block: Always set discard for storage nodes

John Ferlan jferlan at redhat.com
Wed May 2 19:39:07 UTC 2018



On 04/25/2018 11:15 AM, Peter Krempa wrote:
> Enabling discard for the storage node allows the format drivers to
> discard snapshots and other things, while configuration of the format
> layer actually decides whether to actually discard data on request from
> the host.
> 
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---
>  src/qemu/qemu_block.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 

Isn't this related to the {disk|src}->discard value? Which we copied
from patch 3.

So you'd just be unconditionally setting here regardless of what was
configured?


John

> diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
> index b1f495b731..6e76571796 100644
> --- a/src/qemu/qemu_block.c
> +++ b/src/qemu/qemu_block.c
> @@ -1163,7 +1163,10 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src,
>          if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, fileprops) < 0)
>              goto cleanup;
> 
> -        if (virJSONValueObjectAdd(fileprops, "b:read-only", src->readonly, NULL) < 0)
> +        if (virJSONValueObjectAdd(fileprops,
> +                                  "b:read-only", src->readonly,
> +                                  "s:discard", "unmap",
> +                                  NULL) < 0)
>              goto cleanup;
>      }
> 




More information about the libvir-list mailing list