1. 15 8月, 2014 1 次提交
    • M
      block: New bdrv_nb_sectors() · 65a9bb25
      Markus Armbruster 提交于
      A call to retrieve the image size converts between bytes and sectors
      several times:
      
      * BlockDriver method bdrv_getlength() returns bytes.
      
      * refresh_total_sectors() converts to sectors, rounding up, and stores
        in total_sectors.
      
      * bdrv_getlength() converts total_sectors back to bytes (now rounded
        up to a multiple of the sector size).
      
      * Callers wanting sectors rather bytes convert it right back.
        Example: bdrv_get_geometry().
      
      bdrv_nb_sectors() provides a way to omit the last two conversions.
      It's exactly bdrv_getlength() with the conversion to bytes omitted.
      It's functionally like bdrv_get_geometry() without its odd error
      handling.
      
      Reimplement bdrv_getlength() and bdrv_get_geometry() on top of
      bdrv_nb_sectors().
      
      The next patches will convert some users of bdrv_getlength() to
      bdrv_nb_sectors().
      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>
      65a9bb25
  2. 18 7月, 2014 1 次提交
  3. 14 7月, 2014 2 次提交
  4. 09 7月, 2014 2 次提交
  5. 07 7月, 2014 1 次提交
  6. 01 7月, 2014 3 次提交
  7. 28 6月, 2014 2 次提交
  8. 27 6月, 2014 1 次提交
  9. 26 6月, 2014 9 次提交
  10. 25 6月, 2014 1 次提交
  11. 23 6月, 2014 4 次提交
  12. 16 6月, 2014 2 次提交
  13. 04 6月, 2014 5 次提交
    • S
      throttle: add throttle_detach/attach_aio_context() · 13af91eb
      Stefan Hajnoczi 提交于
      Block I/O throttling uses timers and currently always adds them to the
      main loop.  Throttling will break if bdrv_set_aio_context() is used to
      move a BlockDriverState to a different AioContext.
      
      This patch adds throttle_detach/attach_aio_context() interfaces so the
      throttling timers and uses them to move timers to the new AioContext.
      Note that bdrv_set_aio_context() already drains all requests so we're
      sure no throttled requests are pending.
      
      The test cases need to be updated since the throttle_init() interface
      has changed.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NBenoit Canet <benoit@irqsave.net>
      13af91eb
    • S
      block: add bdrv_set_aio_context() · dcd04228
      Stefan Hajnoczi 提交于
      Up until now all BlockDriverState instances have used the QEMU main loop
      for fd handlers, timers, and BHs.  This is not scalable on SMP guests
      and hosts so we need to move to a model with multiple event loops on
      different host CPUs.
      
      bdrv_set_aio_context() assigns the AioContext event loop to use for a
      particular BlockDriverState.  It first detaches the entire
      BlockDriverState graph from the current AioContext and then attaches to
      the new AioContext.
      
      This function will be used by virtio-blk data-plane to assign a
      BlockDriverState to its IOThread AioContext.  Make
      bdrv_aio_set_context() public since data-plane should not include
      block_int.h.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      dcd04228
    • S
      block: acquire AioContext in bdrv_drain_all() · 9b536adc
      Stefan Hajnoczi 提交于
      Modify bdrv_drain_all() to take into account that BlockDriverState
      instances may be running in different AioContexts.
      
      This patch changes the implementation of bdrv_drain_all() while
      preserving the semantics.  Previously kicking throttled requests and
      checking for pending requests were done across all BlockDriverState
      instances in sequence.  Now we process each BlockDriverState in turn,
      making sure to acquire and release its AioContext.
      
      This prevents race conditions between the thread executing
      bdrv_drain_all() and the thread running the AioContext.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      9b536adc
    • S
      block: acquire AioContext in bdrv_*_all() · ed78cda3
      Stefan Hajnoczi 提交于
      bdrv_close_all(), bdrv_commit_all(), bdrv_flush_all(),
      bdrv_invalidate_cache_all(), and bdrv_clear_incoming_migration_all() are
      called by main loop code and touch all BlockDriverState instances.
      
      Some BlockDriverState instances may be running in another AioContext.
      Make sure to acquire the AioContext before closing the BlockDriverState.
      
      This will protect against race conditions once virtio-blk data-plane is
      using the BlockDriverState from another AioContext event loop.
      
      Note that this patch does not convert bdrv_drain_all() yet since that
      conversion is non-trivial.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      ed78cda3
    • S
      block: use BlockDriverState AioContext · 2572b37a
      Stefan Hajnoczi 提交于
      Drop the assumption that we're using the main AioContext.  Convert
      qemu_aio_wait() to aio_poll() and qemu_bh_new() to aio_bh_new() so the
      BlockDriverState AioContext is used.
      
      Note there is still one qemu_aio_wait() left in bdrv_create() but we do
      not have a BlockDriverState there and only main loop code invokes this
      function.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      2572b37a
  14. 30 5月, 2014 1 次提交
  15. 28 5月, 2014 5 次提交