1. 17 3月, 2016 2 次提交
    • M
      blockdev: Split monitor reference from BB creation · efaa7c4e
      Max Reitz 提交于
      Before this patch, blk_new() automatically assigned a name to the new
      BlockBackend and considered it referenced by the monitor. This patch
      removes the implicit monitor_add_blk() call from blk_new() (and
      consequently the monitor_remove_blk() call from blk_delete(), too) and
      thus blk_new() (and related functions) no longer take a BB name
      argument.
      
      In fact, there is only a single point where blk_new()/blk_new_open() is
      called and the new BB is monitor-owned, and that is in blockdev_init().
      Besides thus relieving us from having to invent names for all of the BBs
      we use in qemu-img, this fixes a bug where qemu cannot create a new
      image if there already is a monitor-owned BB named "image".
      
      If a BB and its BDS tree are created in a single operation, as of this
      patch the BDS tree will be created before the BB is given a name
      (whereas it was the other way around before). This results in minor
      change to the output of iotest 087, whose reference output is amended
      accordingly.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      efaa7c4e
    • J
      block/sheepdog: fix argument passed to qemu_strtoul() · 03c698f0
      Jeff Cody 提交于
      The function qemu_strtoul() reads 'unsigned long' sized data,
      which is larger than uint32_t on 64-bit machines.
      
      Even though the snap_id field in the header is 32-bits, we must
      accommodate the full size in qemu_strtoul().
      
      This patch also adds more meaningful error handling to the
      qemu_strtoul() call, and subsequent results.
      Reported-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NHitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
      Message-id: e56fc50abedd9a112e0683342c8eafda063cd2f9.1456935548.git.jcody@redhat.com
      03c698f0
  2. 14 3月, 2016 2 次提交
  3. 11 3月, 2016 1 次提交
  4. 01 3月, 2016 1 次提交
  5. 03 2月, 2016 2 次提交
  6. 20 1月, 2016 1 次提交
  7. 13 1月, 2016 2 次提交
  8. 24 10月, 2015 1 次提交
  9. 25 9月, 2015 3 次提交
    • H
      sheepdog: refine discard support · e6fd57ea
      Hitoshi Mitake 提交于
      This patch refines discard support of the sheepdog driver. The
      existing discard mechanism was implemented on SD_OP_DISCARD_OBJ, which
      was introduced before fine grained reference counting on newer
      sheepdog. It doesn't care about relations of snapshots and clones and
      discards objects unconditionally.
      
      With this patch, the driver just updates an inode object for updating
      reference. Removing the object is done in sheep process side.
      
      Cc: Teruaki Ishizaki <ishizaki.teruaki@lab.ntt.co.jp>
      Cc: Vasiliy Tolstov <v.tolstov@selfip.ru>
      Cc: Jeff Cody <jcody@redhat.com>
      Signed-off-by: NHitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
      Tested-by: NVasiliy Tolstov <v.tolstov@selfip.ru>
      Message-id: 1441076590-8015-3-git-send-email-mitake.hitoshi@lab.ntt.co.jp
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      e6fd57ea
    • H
      sheepdog: use per AIOCB dirty indexes for non overlapping requests · 498f2140
      Hitoshi Mitake 提交于
      In the commit 96b14ff85acf, requests for overlapping areas are
      serialized. However, it cannot handle a case of non overlapping
      requests. In such a case, min_dirty_data_idx and max_dirty_data_idx
      can be overwritten by the requests and invalid inode update can
      happen e.g. a case like create(1, 2) and create(3, 4) are issued in
      parallel.
      
      This patch lets SheepdogAIOCB have dirty data indexes instead of
      BDRVSheepdogState for avoiding the above situation.
      
      This patch also does trivial renaming for better description:
      overwrapping -> overlapping
      
      Cc: Teruaki Ishizaki <ishizaki.teruaki@lab.ntt.co.jp>
      Cc: Vasiliy Tolstov <v.tolstov@selfip.ru>
      Cc: Jeff Cody <jcody@redhat.com>
      Signed-off-by: NHitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
      Tested-by: NVasiliy Tolstov <v.tolstov@selfip.ru>
      Message-id: 1441076590-8015-2-git-send-email-mitake.hitoshi@lab.ntt.co.jp
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      498f2140
    • L
      sheepdog: add reopen support · 4da65c80
      Liu Yuan 提交于
      With reopen supported, block-commit (and offline commit) is now supported for
      image files whose base image uses the Sheepdog protocol driver.
      
      Cc: qemu-devel@nongnu.org
      Cc: Jeff Cody <jcody@redhat.com>
      Cc: Kevin Wolf <kwolf@redhat.com>
      Cc: Stefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NLiu Yuan <liuyuan@cmss.chinamobile.com>
      Message-id: 1440730438-24676-1-git-send-email-namei.unix@gmail.com
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      4da65c80
  10. 14 9月, 2015 1 次提交
  11. 28 7月, 2015 1 次提交
  12. 08 5月, 2015 1 次提交
  13. 28 4月, 2015 1 次提交
    • S
      Convert (ffs(val) - 1) to ctz32(val) · 786a4ea8
      Stefan Hajnoczi 提交于
      This commit was generated mechanically by coccinelle from the following
      semantic patch:
      
      @@
      expression val;
      @@
      - (ffs(val) - 1)
      + ctz32(val)
      
      The call sites have been audited to ensure the ffs(0) - 1 == -1 case
      never occurs (due to input validation, asserts, etc).  Therefore we
      don't need to worry about the fact that ctz32(0) == 32.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 1427124571-28598-5-git-send-email-stefanha@redhat.com
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      786a4ea8
  14. 10 3月, 2015 2 次提交
  15. 09 3月, 2015 1 次提交
    • T
      sheepdog: selectable object size support · 876eb1b0
      Teruaki Ishizaki 提交于
      Previously, qemu block driver of sheepdog used hard-coded VDI object size.
      This patch enables users to handle VDI object size.
      
      When you start qemu, you don't need to specify additional command option.
      
      But when you create the VDI which doesn't have default object size
      with qemu-img command, you specify object_size option.
      
      If you want to create a VDI of 8MB object size,
      you need to specify following command option.
      
       # qemu-img create -o object_size=8M sheepdog:test1 100M
      
      In addition, when you don't specify qemu-img command option,
      a default value of sheepdog cluster is used for creating VDI.
      
       # qemu-img create sheepdog:test2 100M
      Signed-off-by: NTeruaki Ishizaki <ishizaki.teruaki@lab.ntt.co.jp>
      Acked-by: NHitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      876eb1b0
  16. 18 2月, 2015 1 次提交
  17. 16 2月, 2015 2 次提交
  18. 20 10月, 2014 1 次提交
  19. 22 9月, 2014 2 次提交
  20. 12 9月, 2014 1 次提交
  21. 29 8月, 2014 3 次提交
  22. 20 8月, 2014 2 次提交
    • M
      block: Use g_new() & friends to avoid multiplying sizes · 02c4f26b
      Markus Armbruster 提交于
      g_new(T, n) is safer than g_malloc(sizeof(*v) * n) 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.
      
      Perhaps a conversion to g_malloc_n() would be neater in places, but
      that's merely four years old, and we can't use such newfangled stuff.
      
      This commit only touches allocations with size arguments of the form
      sizeof(T), plus two that use 4 instead of sizeof(uint32_t).  We can
      make the others safe by converting to g_malloc_n() when it becomes
      available to us in a couple of years.
      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>
      02c4f26b
    • 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
  23. 23 6月, 2014 1 次提交
  24. 16 6月, 2014 2 次提交
  25. 06 6月, 2014 2 次提交
    • H
      sheepdog: reload only header in a case of live snapshot · 5d039bab
      Hitoshi Mitake 提交于
      sheepdog driver doesn't need to read data_vdi_id[] when a live snapshot is
      created.
      
      Cc: Kevin Wolf <kwolf@redhat.com>
      Cc: Stefan Hajnoczi <stefanha@redhat.com>
      Cc: Liu Yuan <namei.unix@gmail.com>
      Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
      Signed-off-by: NHitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      5d039bab
    • H
      sheepdog: fix vdi object update after live snapshot · b544c1ab
      Hitoshi Mitake 提交于
      sheepdog driver should decide a write request is COW or not based on inode
      object which is active when the write request is issued.
      
      Example of wrong inode update path in the previous driver:
      1. drier issues an ordinal write request to an existing object
      2. user creates a snapshot of the VDI before the write request is completed
      3. the respones for the request is RDONLY, because the VDI is already a snapshot
      4. the driver reload an inode object of the new active VDI, then issues a write
         request again
      5. the second write request can be completed
      6. driver decide the request is COW or not with the below conditional branch:
         	  if (s->inode.data_vdi_id[idx] != s->inode.vdi_id) {
      7. the ID of the written object and VID of the new active VDI is different, so
         the driver updates data_vdi_id[idx] and writes inode object
      8. the existing object cannot be seen by the new active VDI, it results object
         leaking
      
      Cc: Kevin Wolf <kwolf@redhat.com>
      Cc: Stefan Hajnoczi <stefanha@redhat.com>
      Cc: Liu Yuan <namei.unix@gmail.com>
      Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
      Signed-off-by: NHitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      b544c1ab
  26. 04 6月, 2014 1 次提交