1. 28 4月, 2015 2 次提交
    • A
      block: use bdrv_get_device_or_node_name() in error messages · 81e5f78a
      Alberto Garcia 提交于
      There are several error messages that identify a BlockDriverState by
      its device name. However those errors can be produced in nodes that
      don't have a device name associated.
      
      In those cases we should use bdrv_get_device_or_node_name() to fall
      back to the node name and produce a more meaningful message. The
      messages are also updated to use the more generic term 'node' instead
      of 'device'.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-id: 9823a1f0514fdb0692e92868661c38a9e00a12d6.1428485266.git.berto@igalia.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      81e5f78a
    • F
      blockjob: Allow nested pause · 751ebd76
      Fam Zheng 提交于
      This patch changes block_job_pause to increase the pause counter and
      block_job_resume to decrease it.
      
      The counter will allow calling block_job_pause/block_job_resume
      unconditionally on a job when we need to suspend the IO temporarily.
      
      From now on, each block_job_resume must be paired with a block_job_pause
      to keep the counter balanced.
      
      The user pause from QMP or HMP will only trigger block_job_pause once
      until it's resumed, this is achieved by adding a user_paused flag in
      BlockJob.
      
      One occurrence of block_job_resume in mirror_complete is replaced with
      block_job_enter which does what is necessary.
      
      In block_job_cancel, the cancel flag is good enough to instruct
      coroutines to quit loop, so use block_job_enter to replace the unpaired
      block_job_resume.
      
      Upon block job IO error, user is notified about the entering to the
      pause state, so this pause belongs to user pause, set the flag
      accordingly and expect a matching QMP resume.
      
      [Extended doc comments as suggested by Paolo Bonzini
      <pbonzini@redhat.com>.
      --Stefan]
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NAlberto Garcia <berto@igalia.com>
      Message-id: 1428069921-2957-2-git-send-email-famz@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      751ebd76
  2. 19 3月, 2015 1 次提交
  3. 17 3月, 2015 1 次提交
  4. 26 2月, 2015 3 次提交
  5. 18 2月, 2015 2 次提交
    • M
      hmp: Name HMP command handler functions hmp_COMMAND() · 3e5a50d6
      Markus Armbruster 提交于
      Some are called do_COMMAND() (old ones, usually), some hmp_COMMAND(),
      and sometimes COMMAND pointlessly differs in spelling.
      
      Normalize to hmp_COMMAND(), where COMMAND is exactly the command name
      with '-' replaced by '_'.
      
      Exceptions:
      
      * do_device_add() and client_migrate_info() *not* renamed to
        hmp_device_add(), hmp_client_migrate_info(), because they're also
        QMP handlers.  They still need to be converted to QAPI.
      
      * do_memory_dump(), do_physical_memory_dump(), do_ioport_read(),
        do_ioport_write() renamed do hmp_* instead of hmp_x(), hmp_xp(),
        hmp_i(), hmp_o(), because those names are too cryptic for my taste.
      
      * do_info_help() renamed to hmp_info_help() instead of hmp_info(),
        because it only covers help.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      3e5a50d6
    • M
      error: Use error_report_err() where appropriate · 565f65d2
      Markus Armbruster 提交于
      Coccinelle semantic patch:
      
          @@
          expression E;
          @@
          -    error_report("%s", error_get_pretty(E));
          -    error_free(E);
          +    error_report_err(E);
          @@
          expression E, S;
          @@
          -    error_report("%s", error_get_pretty(E));
          +    error_report_err(E);
          (
               exit(S);
          |
               abort();
          )
      
      Trivial manual touch-ups in block/sheepdog.c.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      565f65d2
  6. 16 2月, 2015 1 次提交
  7. 07 2月, 2015 3 次提交
  8. 13 1月, 2015 3 次提交
  9. 10 12月, 2014 8 次提交
  10. 03 11月, 2014 8 次提交
    • S
      block: let commit blockjob run in BDS AioContext · 9e85cd5c
      Stefan Hajnoczi 提交于
      The commit block job must run in the BlockDriverState AioContext so that
      it works with dataplane.
      
      Acquire the AioContext in blockdev.c so starting the block job is safe.
      One detail here is that the bdrv_drain_all() must be moved inside the
      aio_context_acquire() region so requests cannot sneak in between the
      drain and acquire.
      
      The completion code in block/commit.c must perform backing chain
      manipulation and bdrv_reopen() from the main loop.  Use
      block_job_defer_to_main_loop() to achieve that.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 1413889440-32577-11-git-send-email-stefanha@redhat.com
      9e85cd5c
    • S
      block: let mirror blockjob run in BDS AioContext · 5a7e7a0b
      Stefan Hajnoczi 提交于
      The mirror block job must run in the BlockDriverState AioContext so that
      it works with dataplane.
      
      Acquire the AioContext in blockdev.c so starting the block job is safe.
      
      Note that to_replace is treated separately from other BlockDriverStates
      in that it does not need to be in the same AioContext.  Explicitly
      acquire/release to_replace's AioContext when accessing it.
      
      The completion code in block/mirror.c must perform BDS graph
      manipulation and bdrv_reopen() from the main loop.  Use
      block_job_defer_to_main_loop() to achieve that.
      
      The bdrv_drain_all() call is not allowed outside the main loop since it
      could lead to lock ordering problems.  Use bdrv_drain(bs) instead
      because we have acquired the AioContext so nothing else can sneak in
      I/O.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 1413889440-32577-10-git-send-email-stefanha@redhat.com
      5a7e7a0b
    • S
      block: let stream blockjob run in BDS AioContext · f3e69beb
      Stefan Hajnoczi 提交于
      The stream block job must run in the BlockDriverState AioContext so that
      it works with dataplane.
      
      The basics of acquiring the AioContext are easy in blockdev.c.
      
      The tricky part is the completion code which drops part of the backing
      file chain.  This must be done in the main loop where bdrv_unref() and
      bdrv_close() are safe to call.  Use block_job_defer_to_main_loop() to
      achieve that.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 1413889440-32577-9-git-send-email-stefanha@redhat.com
      f3e69beb
    • S
      block: let backup blockjob run in BDS AioContext · 761731b1
      Stefan Hajnoczi 提交于
      The backup block job must run in the BlockDriverState AioContext so that
      it works with dataplane.
      
      The basics of acquiring the AioContext are easy in blockdev.c.
      
      The completion code in block/backup.c must call bdrv_unref() from the
      main loop.  Use block_job_defer_to_main_loop() to achieve that.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 1413889440-32577-8-git-send-email-stefanha@redhat.com
      761731b1
    • S
      blockdev: add note that block_job_cb() must be thread-safe · 723c5d93
      Stefan Hajnoczi 提交于
      This function is correct but we should document the constraint that
      everything must be thread-safe.
      
      Emitting QMP events and scheduling BHs are both thread-safe so nothing
      needs to be done here.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 1413889440-32577-5-git-send-email-stefanha@redhat.com
      723c5d93
    • S
      blockdev: acquire AioContext in blockdev_mark_auto_del() · 91fddb0d
      Stefan Hajnoczi 提交于
      When an emulated storage controller is unrealized it will call
      blockdev_mark_auto_del().  This will cancel any running block job (and
      that eventually releases its reference to the BDS so it can be freed).
      
      Since the block job may be executing in another AioContext we must
      acquire/release to ensure thread safety.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 1413889440-32577-4-git-send-email-stefanha@redhat.com
      91fddb0d
    • S
      blockdev: acquire AioContext in do_qmp_query_block_jobs_one() · 69691e72
      Stefan Hajnoczi 提交于
      Make sure that query-block-jobs acquires the BlockDriverState
      AioContext so that the blockjob isn't running in another thread while we
      access its state.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 1413889440-32577-3-git-send-email-stefanha@redhat.com
      69691e72
    • S
      block: acquire AioContext in generic blockjob QMP commands · 3d948cdf
      Stefan Hajnoczi 提交于
      block-job-set-speed, block-job-cancel, block-job-pause,
      block-job-resume, and block-job-complete must acquire the
      BlockDriverState AioContext so that it is safe to access bs.
      
      At the moment bs->job is always NULL when dataplane is active because op
      blockers prevent blockjobs from starting.  Once the rest of the blockjob
      API has been made aware of AioContext we can drop the op blocker.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 1413889440-32577-2-git-send-email-stefanha@redhat.com
      3d948cdf
  11. 20 10月, 2014 8 次提交