1. 22 5月, 2015 2 次提交
  2. 28 4月, 2015 2 次提交
  3. 16 2月, 2015 1 次提交
  4. 24 1月, 2015 2 次提交
  5. 13 1月, 2015 1 次提交
  6. 12 12月, 2014 1 次提交
    • M
      vmdk: Fix error for JSON descriptor file names · 5c98415b
      Max Reitz 提交于
      If vmdk blindly tries to use path_combine() using bs->file->filename as
      the base file name, this will result in a bad error message for JSON
      file names when calling bdrv_open(). It is better to only try
      bs->file->exact_filename; if that is empty, bs->file->filename will be
      useless for path_combine() and an error should be emitted (containing
      bs->file->filename because desc_file_path (which is
      bs->file->exact_filename) is empty).
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Message-id: 1417615043-26174-2-git-send-email-mreitz@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      5c98415b
  7. 10 12月, 2014 6 次提交
  8. 14 11月, 2014 1 次提交
  9. 20 10月, 2014 1 次提交
  10. 03 10月, 2014 1 次提交
  11. 12 9月, 2014 1 次提交
  12. 08 9月, 2014 2 次提交
  13. 22 8月, 2014 1 次提交
  14. 20 8月, 2014 1 次提交
    • M
      block: Use g_new() & friends where that makes obvious sense · 5839e53b
      Markus Armbruster 提交于
      g_new(T, n) is neater than g_malloc(sizeof(T) * n).  It's also safer,
      for two reasons.  One, it catches multiplication overflowing size_t.
      Two, it returns T * rather than void *, which lets the compiler catch
      more type errors.
      
      Patch created with Coccinelle, with two manual changes on top:
      
      * Add const to bdrv_iterate_format() to keep the types straight
      
      * Convert the allocation in bdrv_drop_intermediate(), which Coccinelle
        inexplicably misses
      
      Coccinelle semantic patch:
      
          @@
          type T;
          @@
          -g_malloc(sizeof(T))
          +g_new(T, 1)
          @@
          type T;
          @@
          -g_try_malloc(sizeof(T))
          +g_try_new(T, 1)
          @@
          type T;
          @@
          -g_malloc0(sizeof(T))
          +g_new0(T, 1)
          @@
          type T;
          @@
          -g_try_malloc0(sizeof(T))
          +g_try_new0(T, 1)
          @@
          type T;
          expression n;
          @@
          -g_malloc(sizeof(T) * (n))
          +g_new(T, n)
          @@
          type T;
          expression n;
          @@
          -g_try_malloc(sizeof(T) * (n))
          +g_try_new(T, n)
          @@
          type T;
          expression n;
          @@
          -g_malloc0(sizeof(T) * (n))
          +g_new0(T, n)
          @@
          type T;
          expression n;
          @@
          -g_try_malloc0(sizeof(T) * (n))
          +g_try_new0(T, n)
          @@
          type T;
          expression p, n;
          @@
          -g_realloc(p, sizeof(T) * (n))
          +g_renew(T, p, n)
          @@
          type T;
          expression p, n;
          @@
          -g_try_realloc(p, sizeof(T) * (n))
          +g_try_renew(T, p, n)
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      5839e53b
  15. 15 8月, 2014 3 次提交
    • K
      vmdk: Handle failure for potentially large allocations · d6e59931
      Kevin Wolf 提交于
      Some code in the block layer makes potentially huge allocations. Failure
      is not completely unexpected there, so avoid aborting qemu and handle
      out-of-memory situations gracefully.
      
      This patch addresses the allocations in the vmdk block driver.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NBenoit Canet <benoit@irqsave.net>
      d6e59931
    • F
      vmdk: Optimize cluster allocation · c6ac36e1
      Fam Zheng 提交于
      This drops the unnecessary bdrv_truncate() from, and also improves,
      cluster allocation code path.
      
      Before, when we need a new cluster, get_cluster_offset truncates the
      image to bdrv_getlength() + cluster_size, and returns the offset of
      added area, i.e. the image length before truncating.
      
      This is not efficient, so it's now rewritten as:
      
        - Save the extent file length when opening.
      
        - When allocating cluster, use the saved length as cluster offset.
      
        - Don't truncate image, because we'll anyway write data there: just
          write any data at the EOF position, in descending priority:
      
          * New user data (cluster allocation happens in a write request).
      
          * Filling data in the beginning and/or ending of the new cluster, if
            not covered by user data: either backing file content (COW), or
            zero for standalone images.
      
      One major benifit of this change is, on host mounted NFS images, even
      over a fast network, ftruncate is slow (see the example below). This
      change significantly speeds up cluster allocation. Comparing by
      converting a cirros image (296M) to VMDK on an NFS mount point, over
      1Gbe LAN:
      
          $ time qemu-img convert cirros-0.3.1.img /mnt/a.raw -O vmdk
      
          Before:
              real    0m21.796s
              user    0m0.130s
              sys     0m0.483s
      
          After:
              real    0m2.017s
              user    0m0.047s
              sys     0m0.190s
      
      We also get rid of unchecked bdrv_getlength() and bdrv_truncate(), and
      get a little more documentation in function comments.
      
      Tested that this passes qemu-iotests for all VMDK subformats.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      c6ac36e1
    • M
      block: Use bdrv_nb_sectors() where sectors, not bytes are wanted · 57322b78
      Markus Armbruster 提交于
      Instead of bdrv_getlength().
      
      Aside: a few of these callers don't handle errors.  I didn't
      investigate whether they should.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NBenoit Canet <benoit@irqsave.net>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      57322b78
  16. 18 7月, 2014 1 次提交
  17. 01 7月, 2014 1 次提交
    • C
      qemu-img create: add 'nocow' option · 4ab15590
      Chunyan Liu 提交于
      Add 'nocow' option so that users could have a chance to set NOCOW flag to
      newly created files. It's useful on btrfs file system to enhance performance.
      
      Btrfs has low performance when hosting VM images, even more when the guest
      in those VM are also using btrfs as file system. One way to mitigate this bad
      performance is to turn off COW attributes on VM files. Generally, there are
      two ways to turn off NOCOW on btrfs: a) by mounting fs with nodatacow, then
      all newly created files will be NOCOW. b) per file. Add the NOCOW file
      attribute. It could only be done to empty or new files.
      
      This patch tries the second way, according to the option, it could add NOCOW
      per file.
      
      For most block drivers, since the create file step is in raw-posix.c, so we
      can do setting NOCOW flag ioctl in raw-posix.c only.
      
      But there are some exceptions, like block/vpc.c and block/vdi.c, they are
      creating file by calling qemu_open directly. For them, do the same setting
      NOCOW flag ioctl work in them separately.
      
      [Fixed up 082.out due to the new 'nocow' creation option
      --Stefan]
      Signed-off-by: NChunyan Liu <cyliu@suse.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      4ab15590
  18. 26 6月, 2014 1 次提交
  19. 16 6月, 2014 3 次提交
  20. 04 6月, 2014 1 次提交
  21. 30 5月, 2014 1 次提交
  22. 09 5月, 2014 2 次提交
  23. 22 4月, 2014 2 次提交
  24. 01 3月, 2014 1 次提交
  25. 22 2月, 2014 1 次提交