1. 22 12月, 2017 1 次提交
  2. 26 10月, 2017 2 次提交
    • E
      block: Align block status requests · efa6e2ed
      Eric Blake 提交于
      Any device that has request_alignment greater than 512 should be
      unable to report status at a finer granularity; it may also be
      simpler for such devices to be guaranteed that the block layer
      has rounded things out to the granularity boundary (the way the
      block layer already rounds all other I/O out).  Besides, getting
      the code correct for super-sector alignment also benefits us
      for the fact that our public interface now has byte granularity,
      even though none of our drivers have byte-level callbacks.
      
      Add an assertion in blkdebug that proves that the block layer
      never requests status of unaligned sections, similar to what it
      does on other requests (while still keeping the generic helper
      in place for when future patches add a throttle driver).  Note
      that iotest 177 already covers this (it would fail if you use
      just the blkdebug.c hunk without the io.c changes).  Meanwhile,
      we can drop assertions in callers that no longer have to pass
      in sector-aligned addresses.
      
      There is a mid-function scope added for 'count' and 'longret',
      for a couple of reasons: first, an upcoming patch will add an
      'if' statement that checks whether a driver has an old- or
      new-style callback, and can conveniently use the same scope for
      less indentation churn at that time.  Second, since we are
      trying to get rid of sector-based computations, wrapping things
      in a scope makes it easier to group and see what will be
      deleted in a final cleanup patch once all drivers have been
      converted to the new-style callback.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      efa6e2ed
    • E
      block: Allow NULL file for bdrv_get_block_status() · 298a1665
      Eric Blake 提交于
      Not all callers care about which BDS owns the mapping for a given
      range of the file.  This patch merely simplifies the callers by
      consolidating the logic in the common call point, while guaranteeing
      a non-NULL file to all the driver callbacks, for no semantic change.
      The only caller that does not care about pnum is bdrv_is_allocated,
      as invoked by vvfat; we can likewise add assertions that the rest
      of the stack does not have to worry about a NULL pnum.
      
      Furthermore, this will also set the stage for a future cleanup: when
      a caller does not care about which BDS owns an offset, it would be
      nice to allow the driver to optimize things to not have to return
      BDRV_BLOCK_OFFSET_VALID in the first place.  In the case of fragmented
      allocation (for example, it's fairly easy to create a qcow2 image
      where consecutive guest addresses are not at consecutive host
      addresses), the current contract requires bdrv_get_block_status()
      to clamp *pnum to the limit where host addresses are no longer
      consecutive, but allowing a NULL file means that *pnum could be
      set to the full length of known-allocated data.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      298a1665
  3. 13 10月, 2017 2 次提交
  4. 06 10月, 2017 2 次提交
  5. 26 9月, 2017 1 次提交
  6. 05 9月, 2017 5 次提交
  7. 08 8月, 2017 1 次提交
  8. 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
  9. 17 7月, 2017 1 次提交
  10. 11 7月, 2017 7 次提交
  11. 26 6月, 2017 1 次提交
  12. 16 6月, 2017 10 次提交
  13. 02 6月, 2017 1 次提交
  14. 29 5月, 2017 1 次提交
    • M
      block/file-*: *_parse_filename() and colons · 03c320d8
      Max Reitz 提交于
      The file drivers' *_parse_filename() implementations just strip the
      optional protocol prefix off the filename. However, for e.g.
      "file:foo:bar", this would lead to "foo:bar" being stored as the BDS's
      filename which looks like it should be managed using the "foo" protocol.
      This is especially troublesome if you then try to resolve a backing
      filename based on "foo:bar".
      
      This issue can only occur if the stripped part is a relative filename
      ("file:/foo:bar" will be shortened to "/foo:bar" and having a slash
      before the first colon means that "/foo" is not recognized as a protocol
      part). Therefore, we can easily fix it by prepending "./" to such
      filenames.
      
      Before this patch:
      $ ./qemu-img create -f qcow2 backing.qcow2 64M
      Formatting 'backing.qcow2', fmt=qcow2 size=67108864 encryption=off
          cluster_size=65536 lazy_refcounts=off refcount_bits=16
      $ ./qemu-img create -f qcow2 -b backing.qcow2 file:top:image.qcow2
      Formatting 'file:top:image.qcow2', fmt=qcow2 size=67108864
          backing_file=backing.qcow2 encryption=off cluster_size=65536
          lazy_refcounts=off refcount_bits=16
      $ ./qemu-io file:top:image.qcow2
      can't open device file:top:image.qcow2: Could not open backing file:
          Unknown protocol 'top'
      
      After this patch:
      $ ./qemu-io file:top:image.qcow2
      [no error]
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20170522195217.12991-3-mreitz@redhat.com
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      03c320d8
  15. 11 5月, 2017 4 次提交