1. 19 5月, 2020 2 次提交
  2. 10 9月, 2019 1 次提交
  3. 16 8月, 2019 4 次提交
    • M
      Include qemu/main-loop.h less · db725815
      Markus Armbruster 提交于
      In my "build everything" tree, changing qemu/main-loop.h triggers a
      recompile of some 5600 out of 6600 objects (not counting tests and
      objects that don't depend on qemu/osdep.h).  It includes block/aio.h,
      which in turn includes qemu/event_notifier.h, qemu/notify.h,
      qemu/processor.h, qemu/qsp.h, qemu/queue.h, qemu/thread-posix.h,
      qemu/thread.h, qemu/timer.h, and a few more.
      
      Include qemu/main-loop.h only where it's needed.  Touching it now
      recompiles only some 1700 objects.  For block/aio.h and
      qemu/event_notifier.h, these numbers drop from 5600 to 2800.  For the
      others, they shrink only slightly.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20190812052359.30071-21-armbru@redhat.com>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Tested-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      db725815
    • K
      block-backend: Queue requests while drained · cf312932
      Kevin Wolf 提交于
      This fixes devices like IDE that can still start new requests from I/O
      handlers in the CPU thread while the block backend is drained.
      
      The basic assumption is that in a drain section, no new requests should
      be allowed through a BlockBackend (blk_drained_begin/end don't exist,
      we get drain sections only on the node level). However, there are two
      special cases where requests should not be queued:
      
      1. Block jobs: We already make sure that block jobs are paused in a
         drain section, so they won't start new requests. However, if the
         drain_begin is called on the job's BlockBackend first, it can happen
         that we deadlock because the job stays busy until it reaches a pause
         point - which it can't if its requests aren't processed any more.
      
         The proper solution here would be to make all requests through the
         job's filter node instead of using a BlockBackend. For now, just
         disabling request queuing on the job BlockBackend is simpler.
      
      2. In test cases where making requests through bdrv_* would be
         cumbersome because we'd need a BdrvChild. As we already got the
         functionality to disable request queuing from 1., use it in tests,
         too, for convenience.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      cf312932
    • M
      tests: Test mid-drain bdrv_replace_child_noperm() · 0513f984
      Max Reitz 提交于
      Add a test for what happens when you call bdrv_replace_child_noperm()
      for various drain situations ({old,new} child {drained,not drained}).
      
      Most importantly, if both the old and the new child are drained, the
      parent must not be undrained at any point.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      0513f984
    • M
      tests: Test polling in bdrv_drop_intermediate() · 9746b35c
      Max Reitz 提交于
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      9746b35c
  4. 19 7月, 2019 2 次提交
  5. 04 6月, 2019 5 次提交
    • K
      test-bdrv-drain: Use bdrv_try_set_aio_context() · 26bf15e4
      Kevin Wolf 提交于
      No reason to use the unchecked version in tests, even more so when these
      are the last callers of bdrv_set_aio_context() outside of block.c.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      26bf15e4
    • K
      block: Move node without parents to main AioContext · ad943dcb
      Kevin Wolf 提交于
      A node should only be in a non-default AioContext if a user is attached
      to it that requires this. When the last parent of a node is gone, it can
      move back to the main AioContext.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      ad943dcb
    • K
      block: Adjust AioContexts when attaching nodes · 132ada80
      Kevin Wolf 提交于
      So far, we only made sure that updating the AioContext of a node
      affected the whole subtree. However, if a node is newly attached to a
      new parent, we also need to make sure that both the subtree of the node
      and the parent are in the same AioContext. This tries to move the new
      child node to the parent AioContext and returns an error if this isn't
      possible.
      
      BlockBackends now actually apply their AioContext to their root node.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      132ada80
    • K
      block: Add BlockBackend.ctx · d861ab3a
      Kevin Wolf 提交于
      This adds a new parameter to blk_new() which requires its callers to
      declare from which AioContext this BlockBackend is going to be used (or
      the locks of which AioContext need to be taken anyway).
      
      The given context is only stored and kept up to date when changing
      AioContexts. Actually applying the stored AioContext to the root node
      is saved for another commit.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      d861ab3a
    • K
      block: Add Error to blk_set_aio_context() · 97896a48
      Kevin Wolf 提交于
      Add an Error parameter to blk_set_aio_context() and use
      bdrv_child_try_set_aio_context() internally to check whether all
      involved nodes can actually support the AioContext switch.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      97896a48
  6. 29 5月, 2019 1 次提交
    • A
      block: Use bdrv_unref_child() for all children in bdrv_close() · dd4118c7
      Alberto Garcia 提交于
      bdrv_unref_child() does the following things:
      
        - Updates the child->bs->inherits_from pointer.
        - Calls bdrv_detach_child() to remove the BdrvChild from bs->children.
        - Calls bdrv_unref() to unref the child BlockDriverState.
      
      When bdrv_unref_child() was introduced in commit 33a60407 it was not
      used in bdrv_close() because the drivers that had additional children
      (like quorum or blkverify) had already called bdrv_unref() on their
      children during their own close functions.
      
      This was changed later (in 0bd6e91a for quorum, in 3e586be0 for
      blkverify) so there's no reason not to use bdrv_unref_child() in
      bdrv_close() anymore.
      
      After this there's also no need to remove bs->backing and bs->file
      separately from the rest of the children, so bdrv_close() can be
      simplified.
      
      Now bdrv_close() unrefs all children (before this patch it was only
      bs->file and bs->backing). As a result, none of the callers of
      brvd_attach_child() should remove their reference to child_bs (because
      this function effectively steals that reference). This patch updates a
      couple of tests that were doing their own bdrv_unref().
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Message-id: 6d1d5feaa53aa1ab127adb73d605dc4503e3abd5.1557754872.git.berto@igalia.com
      [mreitz: s/where/were/]
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      dd4118c7
  7. 25 2月, 2019 1 次提交
  8. 22 2月, 2019 1 次提交
  9. 02 10月, 2018 1 次提交
  10. 25 9月, 2018 6 次提交
  11. 31 8月, 2018 4 次提交
    • J
      jobs: utilize job_exit shim · eb23654d
      John Snow 提交于
      Utilize the job_exit shim by not calling job_defer_to_main_loop, and
      where applicable, converting the deferred callback into the job_exit
      callback.
      
      This converts backup, stream, create, and the unit tests all at once.
      Most of these jobs do not see any changes to the order in which they
      clean up their resources, except the test-blockjob-txn test, which
      now puts down its bs before job_completed is called.
      
      This is safe for the same reason the reordering in the mirror job is
      safe, because job_completed no longer runs under two locks, making
      the unref safe even if it causes a flush.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20180830015734.19765-7-jsnow@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      eb23654d
    • J
      jobs: canonize Error object · 3d1f8b07
      John Snow 提交于
      Jobs presently use both an Error object in the case of the create job,
      and char strings in the case of generic errors elsewhere.
      
      Unify the two paths as just j->err, and remove the extra argument from
      job_completed. The integer error code for job_completed is kept for now,
      to be removed shortly in a separate patch.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Message-id: 20180830015734.19765-3-jsnow@redhat.com
      [mreitz: Dropped a superfluous g_strdup()]
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      3d1f8b07
    • J
      jobs: change start callback to run callback · f67432a2
      John Snow 提交于
      Presently we codify the entry point for a job as the "start" callback,
      but a more apt name would be "run" to clarify the idea that when this
      function returns we consider the job to have "finished," except for
      any cleanup which occurs in separate callbacks later.
      
      As part of this clarification, change the signature to include an error
      object and a return code. The error ptr is not yet used, and the return
      code while captured, will be overwritten by actions in the job_completed
      function.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20180830015734.19765-2-jsnow@redhat.com
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      f67432a2
    • M
      tests: fix bdrv-drain leak · 7b43db3c
      Marc-André Lureau 提交于
      Spotted by ASAN:
      
      =================================================================
      ==5378==ERROR: LeakSanitizer: detected memory leaks
      
      Direct leak of 65536 byte(s) in 1 object(s) allocated from:
          #0 0x7f788f83bc48 in malloc (/lib64/libasan.so.5+0xeec48)
          #1 0x7f788c9923c5 in g_malloc (/lib64/libglib-2.0.so.0+0x523c5)
          #2 0x5622a1fe37bc in coroutine_trampoline /home/elmarco/src/qq/util/coroutine-ucontext.c:116
          #3 0x7f788a15d75f in __correctly_grouped_prefixwc (/lib64/libc.so.6+0x4c75f)
      
      (Broken in commit 4c8158e3.)
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-id: 20180809114417.28718-3-marcandre.lureau@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      7b43db3c
  12. 10 7月, 2018 1 次提交
  13. 18 6月, 2018 9 次提交
  14. 30 5月, 2018 1 次提交
    • K
      job: Add error message for failing jobs · 1266c9b9
      Kevin Wolf 提交于
      So far we relied on job->ret and strerror() to produce an error message
      for failed jobs. Not surprisingly, this tends to result in completely
      useless messages.
      
      This adds a Job.error field that can contain an error string for a
      failing job, and a parameter to job_completed() that sets the field. As
      a default, if NULL is passed, we continue to use strerror(job->ret).
      
      All existing callers are changed to pass NULL. They can be improved in
      separate patches.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      1266c9b9
  15. 23 5月, 2018 1 次提交
    • K
      job: Add job_transition_to_ready() · 2e1795b5
      Kevin Wolf 提交于
      The transition to the READY state was still performed in the BlockJob
      layer, in the same function that sent the BLOCK_JOB_READY QMP event.
      
      This patch brings the state transition to the Job layer and implements
      the QMP event using a notifier called from the Job layer, like we
      already do for other events related to state transitions.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      2e1795b5