1. 24 3月, 2018 2 次提交
  2. 14 3月, 2018 1 次提交
  3. 10 3月, 2018 2 次提交
  4. 22 1月, 2018 1 次提交
  5. 18 12月, 2017 1 次提交
  6. 18 11月, 2017 1 次提交
    • M
      block: Make bdrv_next() keep strong references · 5e003f17
      Max Reitz 提交于
      On one hand, it is a good idea for bdrv_next() to return a strong
      reference because ideally nearly every pointer should be refcounted.
      This fixes intermittent failure of iotest 194.
      
      On the other, it is absolutely necessary for bdrv_next() itself to keep
      a strong reference to both the BB (in its first phase) and the BDS (at
      least in the second phase) because when called the next time, it will
      dereference those objects to get a link to the next one.  Therefore, it
      needs these objects to stay around until then.  Just storing the pointer
      to the next in the iterator is not really viable because that pointer
      might become invalid as well.
      
      Both arguments taken together means we should probably just invoke
      bdrv_ref() and blk_ref() in bdrv_next().  This means we have to assert
      that bdrv_next() is always called from the main loop, but that was
      probably necessary already before this patch and judging from the
      callers, it also looks to actually be the case.
      
      Keeping these strong references means however that callers need to give
      them up if they decide to abort the iteration early.  They can do so
      through the new bdrv_next_cleanup() function.
      Suggested-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20171110172545.32609-1-mreitz@redhat.com
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      5e003f17
  7. 06 10月, 2017 3 次提交
  8. 27 9月, 2017 1 次提交
  9. 11 7月, 2017 2 次提交
  10. 10 7月, 2017 1 次提交
    • E
      block: Make bdrv_is_allocated() byte-based · d6a644bb
      Eric Blake 提交于
      We are gradually moving away from sector-based interfaces, towards
      byte-based.  In the common case, allocation is unlikely to ever use
      values that are not naturally sector-aligned, but it is possible
      that byte-based values will let us be more precise about allocation
      at the end of an unaligned file that can do byte-based access.
      
      Changing the signature of the function to use int64_t *pnum ensures
      that the compiler enforces that all callers are updated.  For now,
      the io.c layer still assert()s that all callers are sector-aligned
      on input and that *pnum is sector-aligned on return to the caller,
      but that can be relaxed when a later patch implements byte-based
      block status.  Therefore, this code adds usages like
      DIV_ROUND_UP(,BDRV_SECTOR_SIZE) to callers that still want aligned
      values, where the call might reasonbly give non-aligned results
      in the future; on the other hand, no rounding is needed for callers
      that should just continue to work with byte alignment.
      
      For the most part this patch is just the addition of scaling at the
      callers followed by inverse scaling at bdrv_is_allocated().  But
      some code, particularly bdrv_commit(), gets a lot simpler because it
      no longer has to mess with sectors; also, it is now possible to pass
      NULL if the caller does not care how much of the image is allocated
      beyond the initial offset.  Leave comments where we can further
      simplify once a later patch eliminates the need for sector-aligned
      requests through bdrv_is_allocated().
      
      For ease of review, bdrv_is_allocated_above() will be tackled
      separately.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      d6a644bb
  11. 16 6月, 2017 3 次提交
  12. 14 6月, 2017 1 次提交
  13. 13 6月, 2017 2 次提交
  14. 09 6月, 2017 1 次提交
  15. 02 6月, 2017 2 次提交
  16. 19 5月, 2017 3 次提交
  17. 21 4月, 2017 1 次提交
  18. 16 3月, 2017 1 次提交
  19. 13 3月, 2017 1 次提交
  20. 01 3月, 2017 3 次提交
  21. 08 6月, 2016 3 次提交
  22. 26 5月, 2016 1 次提交
    • K
      block: Fix bdrv_next() memory leak · 88be7b4b
      Kevin Wolf 提交于
      The bdrv_next() users all leaked the BdrvNextIterator after completing
      the iteration. Simply changing bdrv_next() to free the iterator before
      returning NULL at the end of list doesn't work because some callers exit
      the loop before looking at all BDSes.
      
      This patch moves the BdrvNextIterator from the heap to the stack of
      the caller and switches to a bdrv_first()/bdrv_next() interface for
      initialising the iterator.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      88be7b4b
  23. 19 5月, 2016 1 次提交
  24. 23 3月, 2016 2 次提交
    • V
      util: move declarations out of qemu-common.h · f348b6d1
      Veronia Bahaa 提交于
      Move declarations out of qemu-common.h for functions declared in
      utils/ files: e.g. include/qemu/path.h for utils/path.c.
      Move inline functions out of qemu-common.h and into new files (e.g.
      include/qemu/bcd.h)
      Signed-off-by: NVeronia Bahaa <veroniabahaa@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f348b6d1
    • M
      include/qemu/osdep.h: Don't include qapi/error.h · da34e65c
      Markus Armbruster 提交于
      Commit 57cb38b3 included qapi/error.h into qemu/osdep.h to get the
      Error typedef.  Since then, we've moved to include qemu/osdep.h
      everywhere.  Its file comment explains: "To avoid getting into
      possible circular include dependencies, this file should not include
      any other QEMU headers, with the exceptions of config-host.h,
      compiler.h, os-posix.h and os-win32.h, all of which are doing a
      similar job to this file and are under similar constraints."
      qapi/error.h doesn't do a similar job, and it doesn't adhere to
      similar constraints: it includes qapi-types.h.  That's in excess of
      100KiB of crap most .c files don't actually need.
      
      Add the typedef to qemu/typedefs.h, and include that instead of
      qapi/error.h.  Include qapi/error.h in .c files that need it and don't
      get it now.  Include qapi-types.h in qom/object.h for uint16List.
      
      Update scripts/clean-includes accordingly.  Update it further to match
      reality: replace config.h by config-target.h, add sysemu/os-posix.h,
      sysemu/os-win32.h.  Update the list of includes in the qemu/osdep.h
      comment quoted above similarly.
      
      This reduces the number of objects depending on qapi/error.h from "all
      of them" to less than a third.  Unfortunately, the number depending on
      qapi-types.h shrinks only a little.  More work is needed for that one.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      [Fix compilation without the spice devel packages. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      da34e65c