1. 04 6月, 2019 1 次提交
    • 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
  2. 19 3月, 2019 1 次提交
  3. 25 2月, 2019 1 次提交
    • M
      block: Add strong_runtime_opts to BlockDriver · 2654267c
      Max Reitz 提交于
      This new field can be set by block drivers to list the runtime options
      they accept that may influence the contents of the respective BDS. As of
      a follow-up patch, this list will be used by the common
      bdrv_refresh_filename() implementation to decide which options to put
      into BDS.full_open_options (and consequently whether a JSON filename has
      to be created), thus freeing the drivers of having to implement that
      logic themselves.
      
      Additionally, this patch adds the field to all of the block drivers that
      need it and sets it accordingly.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NAlberto Garcia <berto@igalia.com>
      Message-id: 20190201192935.18394-22-mreitz@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      2654267c
  4. 12 2月, 2019 1 次提交
  5. 12 12月, 2018 1 次提交
  6. 15 8月, 2018 1 次提交
  7. 05 7月, 2018 1 次提交
  8. 29 6月, 2018 3 次提交
    • M
      block/crypto: Simplify block_crypto_{open,create}_opts_init() · 796d3239
      Markus Armbruster 提交于
      block_crypto_open_opts_init() and block_crypto_create_opts_init()
      contain a virtual visit of QCryptoBlockOptions and
      QCryptoBlockCreateOptions less member "format", respectively.
      
      Change their callers to put member "format" in the QDict, so they can
      use the generated visitors for these types instead.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      796d3239
    • K
      block: Convert .bdrv_truncate callback to coroutine_fn · 061ca8a3
      Kevin Wolf 提交于
      bdrv_truncate() is an operation that can block (even for a quite long
      time, depending on the PreallocMode) in I/O paths that shouldn't block.
      Convert it to a coroutine_fn so that we have the infrastructure for
      drivers to make their .bdrv_co_truncate implementation asynchronous.
      
      This change could potentially introduce new race conditions because
      bdrv_truncate() isn't necessarily executed atomically any more. Whether
      this is a problem needs to be evaluated for each block driver that
      supports truncate:
      
      * file-posix/win32, gluster, iscsi, nfs, rbd, ssh, sheepdog: The
        protocol drivers are trivially safe because they don't actually yield
        yet, so there is no change in behaviour.
      
      * copy-on-read, crypto, raw-format: Essentially just filter drivers that
        pass the request to a child node, no problem.
      
      * qcow2: The implementation modifies metadata, so it needs to hold
        s->lock to be safe with concurrent I/O requests. In order to avoid
        double locking, this requires pulling the locking out into
        preallocate_co() and using qcow2_write_caches() instead of
        bdrv_flush().
      
      * qed: Does a single header update, this is fine without locking.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      061ca8a3
    • M
      block/crypto: Pacify Coverity after commit f853465a · e6af90f3
      Markus Armbruster 提交于
      Coverity can't see that qobject_input_visitor_new_flat_confused()
      returns non-null when it doesn't set @local_err.  Check the return
      value instead, like all the other callers do.
      
      Fixes: CID 1393615
      Fixes: CID 1393616
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      e6af90f3
  9. 15 6月, 2018 1 次提交
    • M
      block: Make remaining uses of qobject input visitor more robust · f853465a
      Markus Armbruster 提交于
      Remaining uses of qobject_input_visitor_new_keyval() in the block
      subsystem:
      
      * block_crypto_open_opts_init()
        Currently doesn't visit any non-string scalars, thus safe.  It's
        called from
        - block_crypto_open_luks()
          Creates the QDict with qemu_opts_to_qdict_filtered(), which
          creates only string scalars, but has a TODO asking for other types.
        - qcow_open()
        - qcow2_open(), qcow2_co_invalidate_cache(), qcow2_reopen_prepare()
      
      * block_crypto_create_opts_init(), called from
        - block_crypto_co_create_opts_luks()
          Also creates the QDict with qemu_opts_to_qdict_filtered().
      
      * vdi_co_create_opts()
        Also creates the QDict with qemu_opts_to_qdict_filtered().
      
      Replace these uses by qobject_input_visitor_new_flat_confused() for
      robustness.  This adds crumpling.  Right now, that's a no-op, but if
      we ever extend these things in non-flat ways, crumpling will be
      needed.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      f853465a
  10. 31 5月, 2018 1 次提交
  11. 04 5月, 2018 1 次提交
  12. 26 3月, 2018 1 次提交
  13. 19 3月, 2018 5 次提交
  14. 09 3月, 2018 1 次提交
  15. 03 3月, 2018 2 次提交
  16. 10 2月, 2018 1 次提交
    • E
      block: Simplify bdrv_can_write_zeroes_with_unmap() · e24d813b
      Eric Blake 提交于
      We don't need the can_write_zeroes_with_unmap field in
      BlockDriverInfo, because it is redundant information with
      supported_zero_flags & BDRV_REQ_MAY_UNMAP.  Note that
      BlockDriverInfo and supported_zero_flags are both per-device
      settings, rather than global state about the driver as a
      whole, which means one or both of these bits of information
      can already be conditional.  Let's audit how they were set:
      
      crypto: always setting can_write_ to false is pointless (the
      struct starts life zero-initialized), no use of supported_
      
      nbd: just recently fixed to set can_write_ if supported_
      includes MAY_UNMAP (thus this commit effectively reverts
      bca80059e and solves the problem mentioned there in a more
      global way)
      
      file-posix, iscsi, qcow2: can_write_ is conditional, while
      supported_ was unconditional; but passing MAY_UNMAP would
      fail with ENOTSUP if the condition wasn't met
      
      qed: can_write_ is unconditional, but pwrite_zeroes lacks
      support for MAY_UNMAP and supported_ is not set. Perhaps
      support can be added later (since it would be similar to
      qcow2), but for now claiming false is no real loss
      
      all other drivers: can_write_ is not set, and supported_ is
      either unset or a passthrough
      
      Simplify the code by moving the conditional into
      supported_zero_flags for all drivers, then dropping the
      now-unused BDI field.  For callers that relied on
      bdrv_can_write_zeroes_with_unmap(), we return the same
      per-device settings for drivers that had conditions (no
      observable change in behavior there); and can now return
      true (instead of false) for drivers that support passthrough
      (for example, the commit driver) which gives those drivers
      the same fix as nbd just got in bca80059e.  For callers that
      relied on supported_zero_flags, we now have a few more places
      that can avoid a wasted call to pwrite_zeroes() that will
      just fail with ENOTSUP.
      Suggested-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20180126193439.20219-1-eblake@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      e24d813b
  17. 09 2月, 2018 2 次提交
  18. 06 10月, 2017 5 次提交
  19. 11 7月, 2017 7 次提交
  20. 09 5月, 2017 1 次提交
  21. 28 4月, 2017 2 次提交