1. 10 4月, 2018 1 次提交
    • K
      commit/stream: Reset delay_ns · 2fe4bba1
      Kevin Wolf 提交于
      Streaming and the commit block job only want to apply throttling when
      they actually copied data instead of skipping it, so they made the
      calculation of delay_ns conditional. However, delay_ns isn't reset when
      skipping some sectors, so instead of not waiting, the old delay is
      applied again.
      
      Properly reset delay_ns where needed.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      2fe4bba1
  2. 19 3月, 2018 1 次提交
  3. 03 3月, 2018 1 次提交
  4. 22 12月, 2017 1 次提交
  5. 29 11月, 2017 1 次提交
  6. 06 10月, 2017 2 次提交
    • K
      commit: Remove overlay_bs · bde70715
      Kevin Wolf 提交于
      We don't need to make any assumptions about the graph layout above the
      top node of the commit operation any more. Remove the use of
      bdrv_find_overlay() and related variables from the commit job code.
      
      bdrv_drop_intermediate() doesn't use the 'active' parameter any more, so
      we can just drop it.
      
      The overlay node was previously added to the block job to get a
      BLK_PERM_GRAPH_MOD. We really need to respect those permissions in
      bdrv_drop_intermediate() now, but as long as we haven't figured out yet
      how BLK_PERM_GRAPH_MOD is actually supposed to work, just leave a TODO
      comment there.
      
      With this change, it is now possible to perform another block job on an
      overlay node without conflicts. qemu-iotests 030 is changed accordingly.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      bde70715
    • K
      commit: Support multiple roots above top node · 61f09cea
      Kevin Wolf 提交于
      This changes the commit block job to support operation in a graph where
      there is more than a single active layer that references the top node.
      
      This involves inserting the commit filter node not only on the path
      between the given active node and the top node, but between the top node
      and all of its parents.
      
      On completion, bdrv_drop_intermediate() must consider all parents for
      updating the backing file link. These parents may be backing files
      themselves and as such read-only; reopen them temporarily if necessary.
      Previously this was achieved by the bdrv_reopen() calls in the commit
      block job that made overlay_bs read-write for the whole duration of the
      block job, even though write access is only needed on completion.
      
      Now that we consider all parents, overlay_bs is meaningless. It is left
      in place in this commit, but we'll remove it soon.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      61f09cea
  7. 26 9月, 2017 1 次提交
  8. 05 9月, 2017 1 次提交
  9. 24 7月, 2017 1 次提交
    • K
      block: Skip implicit nodes in query-block/blockstats · d3c8c674
      Kevin Wolf 提交于
      Commits 0db832f4 and 6cdbceb1 introduced the automatic insertion of filter
      nodes above the top layer of mirror and commit block jobs. The
      assumption made there was that since libvirt doesn't do node-level
      management of the block layer yet, it shouldn't be affected by added
      nodes.
      
      This is true as far as commands issued by libvirt are concerned. It only
      uses BlockBackend names to address nodes, so any operations it performs
      still operate on the root of the tree as intended.
      
      However, the assumption breaks down when you consider query commands,
      which return data for the wrong node now. These commands also return
      information on some child nodes (bs->file and/or bs->backing), which
      libvirt does make use of, and which refer to the wrong nodes, too.
      
      One of the consequences is that oVirt gets wrong information about the
      image size and stops the VM in response as long as a mirror or commit
      job is running:
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1470634
      
      This patch fixes the problem by hiding the implicit nodes created
      automatically by the mirror and commit block jobs in the output of
      query-block and BlockBackend-based query-blockstats as long as the user
      doesn't indicate that they are aware of those nodes by providing a node
      name for them in the QMP command to start the block job.
      
      The node-based commands query-named-block-nodes and query-blockstats
      with query-nodes=true still show all nodes, including implicit ones.
      This ensures that users that are capable of node-level management can
      still access the full information; users that only know BlockBackends
      won't use these commands.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NPeter Krempa <pkrempa@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Tested-by: NEric Blake <eblake@redhat.com>
      d3c8c674
  10. 18 7月, 2017 1 次提交
  11. 11 7月, 2017 1 次提交
  12. 10 7月, 2017 7 次提交
    • E
      block: Make bdrv_is_allocated_above() byte-based · 51b0a488
      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,
      but that can be relaxed when a later patch implements byte-based
      block status.  Therefore, 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 stream_run(),
      gets a lot simpler because it no longer has to mess with sectors.
      Leave comments where we can further simplify by switching to
      byte-based iterations, once later patches eliminate the need for
      sector-aligned operations.
      
      For ease of review, bdrv_is_allocated() was tackled separately.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      51b0a488
    • 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
    • E
      commit: Switch commit_run() to byte-based · 317a6676
      Eric Blake 提交于
      We are gradually converting to byte-based interfaces, as they are
      easier to reason about than sector-based.  Change the internal
      loop iteration of committing to track by bytes instead of sectors
      (although we are still guaranteed that we iterate by steps that
      are sector-aligned).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      317a6676
    • E
      commit: Switch commit_populate() to byte-based · d8a98584
      Eric Blake 提交于
      We are gradually converting to byte-based interfaces, as they are
      easier to reason about than sector-based.  Start by converting an
      internal function (no semantic change).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      d8a98584
    • E
      trace: Show blockjob actions via bytes, not sectors · 5cb1a49e
      Eric Blake 提交于
      Upcoming patches are going to switch to byte-based interfaces
      instead of sector-based.  Even worse, trace_backup_do_cow_enter()
      had a weird mix of cluster and sector indices.
      
      The trace interface is low enough that there are no stability
      guarantees, and therefore nothing wrong with changing our units,
      even in cases like trace_backup_do_cow_skip() where we are not
      changing the trace output.  So make the tracing uniformly use
      bytes.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      5cb1a49e
    • E
      blockjob: Track job ratelimits via bytes, not sectors · f3e4ce4a
      Eric Blake 提交于
      The user interface specifies job rate limits in bytes/second.
      It's pointless to have our internal representation track things
      in sectors/second, particularly since we want to move away from
      sector-based interfaces.
      
      Fix up a doc typo found while verifying that the ratelimit
      code handles the scaling difference.
      
      Repetition of expressions like 'n * BDRV_SECTOR_SIZE' will be
      cleaned up later when functions are converted to iterate over
      images by bytes rather than by sectors.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      f3e4ce4a
    • E
      block: Simplify use of BDRV_BLOCK_RAW · d5254033
      Eric Blake 提交于
      The lone caller that cares about a return of BDRV_BLOCK_RAW
      (namely, io.c:bdrv_co_get_block_status) completely replaces the
      return value, so there is no point in passing BDRV_BLOCK_DATA.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      d5254033
  13. 26 6月, 2017 1 次提交
  14. 09 6月, 2017 1 次提交
    • K
      commit: Fix use after free in completion · 19ebd13e
      Kevin Wolf 提交于
      The final bdrv_set_backing_hd() could be working on already freed nodes
      because the commit job drops its references (through BlockBackends) to
      both overlay_bs and top already a bit earlier.
      
      One way to trigger the bug is hot unplugging a disk for which
      blockdev_mark_auto_del() cancels the block job.
      
      Fix this by taking BDS-level references while we're still using the
      nodes.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      19ebd13e
  15. 25 5月, 2017 1 次提交
  16. 28 4月, 2017 1 次提交
  17. 07 4月, 2017 2 次提交
  18. 13 3月, 2017 2 次提交
  19. 07 3月, 2017 2 次提交
  20. 01 3月, 2017 8 次提交
  21. 15 11月, 2016 2 次提交
    • J
      blockjob: add block_job_start · 5ccac6f1
      John Snow 提交于
      Instead of automatically starting jobs at creation time via backup_start
      et al, we'd like to return a job object pointer that can be started
      manually at later point in time.
      
      For now, add the block_job_start mechanism and start the jobs
      automatically as we have been doing, with conversions job-by-job coming
      in later patches.
      
      Of note: cancellation of unstarted jobs will perform all the normal
      cleanup as if the job had started, particularly abort and clean. The
      only difference is that we will not emit any events, because the job
      never actually started.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Message-id: 1478587839-9834-5-git-send-email-jsnow@redhat.com
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      5ccac6f1
    • J
      blockjob: add .start field · a7815a76
      John Snow 提交于
      Add an explicit start field to specify the entrypoint. We already have
      ownership of the coroutine itself AND managing the lifetime of the
      coroutine, let's take control of creation of the coroutine, too.
      
      This will allow us to delay creation of the actual coroutine until we
      know we'll actually start a BlockJob in block_job_start. This avoids
      the sticky question of how to "un-create" a Coroutine that hasn't been
      started yet.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Message-id: 1478587839-9834-4-git-send-email-jsnow@redhat.com
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      a7815a76
  22. 01 11月, 2016 1 次提交
    • J
      blockjobs: split interface into public/private, Part 1 · c87621ea
      John Snow 提交于
      To make it a little more obvious which functions are intended to be
      public interface and which are intended to be for use only by jobs
      themselves, split the interface into "public" and "private" files.
      
      Convert blockjobs (e.g. block/backup) to using the private interface.
      Leave blockdev and others on the public interface.
      
      There are remaining uses of private state by qemu-img, and several
      cases in blockdev.c and block/io.c where we grab job->blk for the
      purposes of acquiring an AIOContext.
      
      These will be corrected in future patches.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Message-id: 1477584421-1399-7-git-send-email-jsnow@redhat.com
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      c87621ea