[libvirt] [PATCH v2 2/3] storage: allow metadata preallocation for qcow2 images
Peter Krempa
pkrempa at redhat.com
Wed Nov 28 14:34:54 UTC 2012
On 11/12/12 17:08, Ján Tomko wrote:
> Metadata preallocation is supported both for creating new images or
> converting existing ones.
>
> Bug: https://bugzilla.redhat.com/show_bug.cgi?id=684793
> ---
> src/storage/storage_backend.c | 46 ++++++++++++++++++++++++++++------------
> 1 files changed, 32 insertions(+), 14 deletions(-)
>
> diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
> index 41a19a1..bb20f88 100644
> --- a/src/storage/storage_backend.c
> +++ b/src/storage/storage_backend.c
> @@ -670,8 +670,11 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
> virCommandPtr cmd = NULL;
> bool do_encryption = (vol->target.encryption != NULL);
> unsigned long long int size_arg;
> + bool preallocate = false;
>
> - virCheckFlags(0, -1);
> + virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, -1);
> +
> + preallocate = flags & VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA;
This will work in most of the cases, but as preallocate is a bool,
please use !! to typecast it to bool:
preallocate = !!(flags & VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA);
>
> const char *type = virStorageFileFormatTypeToString(vol->target.format);
> const char *backingType = vol->backingStore.path ?
Otherwise looks good.
Peter
More information about the libvir-list
mailing list