1. 09 3月, 2015 1 次提交
    • D
      block/raw-posix: fix compilation warning on OSX · a6dcf097
      Denis V. Lunev 提交于
      block/raw-posix.c:947:19: warning: unused variable 's' [-Wunused-variable]
          BDRVRawState *s = aiocb->bs->opaque;
      
      This variable is used only when on of the following macros are defined
      CONFIG_XFS, CONFIG_FALLOCATE, CONFIG_FALLOCATE_PUNCH_HOLE or
      CONFIG_FALLOCATE_ZERO_RANGE. Fortunately, CONFIG_FALLOCATE_PUNCH_HOLE
      and CONFIG_FALLOCATE_ZERO_RANGE could be defined only along with
      CONFIG_FALLOCATE. Therefore checking for CONFIG_XFS or CONFIG_FALLOCATE
      would be enough.
      Signed-off-by: NDenis V. Lunev <den@openvz.org>
      CC: Peter Maydell <peter.maydell@linaro.org>
      CC: Kevin Wolf <kwolf@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      a6dcf097
  2. 16 2月, 2015 1 次提交
  3. 07 2月, 2015 7 次提交
  4. 10 12月, 2014 3 次提交
  5. 18 11月, 2014 6 次提交
  6. 03 11月, 2014 2 次提交
    • M
      raw-posix: raw_co_get_block_status() return value · d7f62751
      Max Reitz 提交于
      Instead of generating the full return value thrice in try_fiemap(),
      try_seek_hole() and as a fall-back in raw_co_get_block_status() itself,
      generate the value only in raw_co_get_block_status().
      
      While at it, also remove the pnum parameter from try_fiemap() and
      try_seek_hole().
      Suggested-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Message-id: 1414148280-17949-3-git-send-email-mreitz@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      d7f62751
    • M
      raw-posix: Fix raw_co_get_block_status() after EOF · e6d7ec32
      Max Reitz 提交于
      As its comment states, raw_co_get_block_status() should unconditionally
      return 0 and set *pnum to 0 for after EOF.
      
      An assertion after lseek(..., SEEK_HOLE) tried to catch this case by
      asserting that errno != -ENXIO (which would indicate a position after
      the EOF); but it should be errno != ENXIO instead. Regardless of that,
      there should be no such assertion at all. If bdrv_getlength() returned
      an outdated value and the image has been resized outside of qemu,
      lseek() will return with errno == ENXIO. Just return that value as an
      error then.
      
      Setting *pnum to 0 and returning 0 should not be done here, as in that
      case we should update the device length as well. So, from qemu's
      perspective, the file has not been resized; it's just that there was an
      error querying sectors beyond a certain point (the actual file size).
      
      Additionally, nb_sectors should be clamped against the image end. This
      was probably not an issue if FIEMAP or SEEK_HOLE/SEEK_DATA worked, but
      the fallback did not take this case into account.
      Reported-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Message-id: 1414148280-17949-2-git-send-email-mreitz@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      e6d7ec32
  7. 23 10月, 2014 1 次提交
  8. 20 10月, 2014 4 次提交
  9. 29 9月, 2014 1 次提交
  10. 12 9月, 2014 3 次提交
  11. 22 8月, 2014 1 次提交
  12. 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
  13. 15 8月, 2014 1 次提交
  14. 18 7月, 2014 2 次提交
  15. 14 7月, 2014 1 次提交
  16. 07 7月, 2014 2 次提交
  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. 16 6月, 2014 2 次提交