Re: [PATCH v2 2/3] storage: allow metadata preallocation for qcow2 images

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]