qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 6bff59: block: don't add 'driver' to options


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 6bff59: block: don't add 'driver' to options when referrin...
Date: Fri, 27 Oct 2017 03:12:55 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 6bff597bf6580ecc691258e849f652911dbdda7c
      
https://github.com/qemu/qemu/commit/6bff597bf6580ecc691258e849f652911dbdda7c
  Author: Peter Krempa <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block.c

  Log Message:
  -----------
  block: don't add 'driver' to options when referring to backing via node name

When referring to a backing file of an image via node name
bdrv_open_backing_file would add the 'driver' option to the option list
filling it with the backing format driver. This breaks construction of
the backing chain via -blockdev, as bdrv_open_inherit reports an error
if both 'reference' and 'options' are provided.

$ qemu-img create -f raw /tmp/backing.raw 64M
$ qemu-img create -f qcow2 -F raw -b /tmp/backing.raw /tmp/test.qcow2
$ qemu-system-x86_64 \
  -blockdev driver=file,filename=/tmp/backing.raw,node-name=backing \
  -blockdev 
driver=qcow2,file.driver=file,file.filename=/tmp/test.qcow2,node-name=root,backing=backing
qemu-system-x86_64: -blockdev 
driver=qcow2,file.driver=file,file.filename=/tmp/test.qcow2,node-name=root,backing=backing:
 Could not open backing file: Cannot reference an existing block device with 
additional options or a new filename

Signed-off-by: Peter Krempa <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 760c4d43ae43f5d4b5eec450a53f056c3c91fab1
      
https://github.com/qemu/qemu/commit/760c4d43ae43f5d4b5eec450a53f056c3c91fab1
  Author: Kevin Wolf <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M tests/qemu-iotests/191
    M tests/qemu-iotests/191.out

  Log Message:
  -----------
  qemu-iotests: Test backing_fmt with backing node reference

This changes test case 191 to include a backing image that has
backing_fmt set in the image file, but is referenced by node name in the
qemu command line.

Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 298a1665a2800f7264e483c2dd1f551574243a2f
      
https://github.com/qemu/qemu/commit/298a1665a2800f7264e483c2dd1f551574243a2f
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/io.c
    M block/mirror.c
    M block/qcow2.c
    M include/block/block_int.h
    M qemu-img.c

  Log Message:
  -----------
  block: Allow NULL file for bdrv_get_block_status()

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: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: c9ce8c4da65b0c2b1dc82cbf2328ff3e23d76943
      
https://github.com/qemu/qemu/commit/c9ce8c4da65b0c2b1dc82cbf2328ff3e23d76943
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/io.c

  Log Message:
  -----------
  block: Add flag to avoid wasted work in bdrv_is_allocated()

Not all callers care about which BDS owns the mapping for a given
range of the file, or where the zeroes lie within that mapping.  In
particular, bdrv_is_allocated() cares more about finding the
largest run of allocated data from the guest perspective, whether
or not that data is consecutive from the host perspective, and
whether or not the data reads as zero.  Therefore, doing subsequent
refinements such as checking how much of the format-layer
allocation also satisfies BDRV_BLOCK_ZERO at the protocol layer is
wasted work - in the best case, it just costs extra CPU cycles
during a single bdrv_is_allocated(), but in the worst case, it
results in a smaller *pnum, and forces callers to iterate through
more status probes when visiting the entire file for even more
extra CPU cycles.

This patch only optimizes the block layer (no behavior change when
want_zero is true, but skip unnecessary effort when it is false).
Then when subsequent patches tweak the driver callback to be
byte-based, we can also pass this hint through to the driver.

Tweak BdrvCoGetBlockStatusData to declare arguments in parameter
order, rather than mixing things up (minimizing padding is not
necessary here).

Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 7cfd527525a7d6b1c904890a6b84c1227846415e
      
https://github.com/qemu/qemu/commit/7cfd527525a7d6b1c904890a6b84c1227846415e
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/io.c
    M block/mirror.c
    M block/trace-events
    M include/block/block.h

  Log Message:
  -----------
  block: Make bdrv_round_to_clusters() signature more useful

In the process of converting sector-based interfaces to bytes,
I'm finding it easier to represent a byte count as a 64-bit
integer at the block layer (even if we are internally capped
by SIZE_MAX or even INT_MAX for individual transactions, it's
still nicer to not have to worry about truncation/overflow
issues on as many variables).  Update the signature of
bdrv_round_to_clusters() to uniformly use int64_t, matching
the signature already chosen for bdrv_is_allocated and the
fact that off_t is also a signed type, then adjust clients
according to the required fallout (even where the result could
now exceed 32 bits, no client is directly assigning the result
into a 32-bit value without breaking things into a loop first).

Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: f06f6b66c789c41165b46f98c88141b955cd594d
      
https://github.com/qemu/qemu/commit/f06f6b66c789c41165b46f98c88141b955cd594d
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/qcow2.c

  Log Message:
  -----------
  qcow2: Switch is_zero_sectors() to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Convert another internal
function (no semantic change), and rename it to is_zero() in the
process.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 7286d6106fd2c8f2646415c8e02438db3c21a46f
      
https://github.com/qemu/qemu/commit/7286d6106fd2c8f2646415c8e02438db3c21a46f
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/io.c

  Log Message:
  -----------
  block: Switch bdrv_make_zero() to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Change the internal
loop iteration of zeroing a device to track by bytes instead of
sectors (although we are still guaranteed that we iterate by steps
that are sector-aligned).

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 5e344dd8c2e4214f6515385de879ca7eb896902f
      
https://github.com/qemu/qemu/commit/5e344dd8c2e4214f6515385de879ca7eb896902f
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M qemu-img.c

  Log Message:
  -----------
  qemu-img: Switch get_block_status() to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Continue by converting
an internal function (no semantic change), and simplifying its
caller accordingly.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 237d78f8fc62e62f62246883ecf62e44ed35fb80
      
https://github.com/qemu/qemu/commit/237d78f8fc62e62f62246883ecf62e44ed35fb80
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/io.c
    M block/qcow2-cluster.c
    M include/block/block.h
    M qemu-img.c

  Log Message:
  -----------
  block: Convert bdrv_get_block_status() to bytes

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 name of the function from bdrv_get_block_status() to
bdrv_block_status() 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 in the drivers.

There was an inherent limitation in returning the offset via the
return value: we only have room for BDRV_BLOCK_OFFSET_MASK bits, which
means an offset can only be mapped for sector-aligned queries (or,
if we declare that non-aligned input is at the same relative position
modulo 512 of the answer), so the new interface also changes things to
return the offset via output through a parameter by reference rather
than mashed into the return value.  We'll have some glue code that
munges between the two styles until we finish converting all uses.

For the most part this patch is just the addition of scaling at the
callers followed by inverse scaling at bdrv_block_status(), coupled
with the tweak in calling convention.  But some code, particularly
bdrv_is_allocated(), gets a lot simpler because it no longer has to
mess with sectors.

For ease of review, bdrv_get_block_status_above() will be tackled
separately.

Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 2e8bc7874bb674b7d6837706b1249bf871941637
      
https://github.com/qemu/qemu/commit/2e8bc7874bb674b7d6837706b1249bf871941637
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/io.c

  Log Message:
  -----------
  block: Switch bdrv_co_get_block_status() to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Convert another internal
function (no semantic change); and as with its public counterpart,
rename to bdrv_co_block_status() and split the offset return, to
make the compiler enforce that we catch all uses.  For now, we
assert that callers and the return value still use aligned data,
but ultimately, this will be the function where we hand off to a
byte-based driver callback, and will eventually need to add logic
to ensure we round calls according to the driver's
request_alignment then touch up the result handed back to the
caller, to start permitting a caller to pass unaligned offsets.

Note that we are now prepared to accepts 'bytes' larger than INT_MAX;
this is okay as long as we clamp things internally before violating
any 32-bit limits, and makes no difference to how a client will
use the information (clients looping over the entire file must
already be prepared for consecutive calls to return the same status,
as drivers are already free to return shorter-than-maximal status
due to any other convenient split points, such as when the L2 table
crosses cluster boundaries in qcow2).

Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 4bcd936e47c45ebf7236b0414982dd625a957410
      
https://github.com/qemu/qemu/commit/4bcd936e47c45ebf7236b0414982dd625a957410
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/io.c

  Log Message:
  -----------
  block: Switch BdrvCoGetBlockStatusData to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Convert another internal
type (no semantic change), and rename it to match the corresponding
public function rename.

Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 7ddb99b9dc454a5ed9821c97d3066f358a7a73ae
      
https://github.com/qemu/qemu/commit/7ddb99b9dc454a5ed9821c97d3066f358a7a73ae
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/io.c

  Log Message:
  -----------
  block: Switch bdrv_common_block_status_above() to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Convert another internal
function (no semantic change).

Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 5b648c67e3acea3e0136d0bb1bd47341996e0e4e
      
https://github.com/qemu/qemu/commit/5b648c67e3acea3e0136d0bb1bd47341996e0e4e
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/io.c

  Log Message:
  -----------
  block: Switch bdrv_co_get_block_status_above() to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Convert another internal
type (no semantic change), and rename it to match the corresponding
public function rename.

Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 3182664220571d11d4fe03ecdc10fcc1e842ed32
      
https://github.com/qemu/qemu/commit/3182664220571d11d4fe03ecdc10fcc1e842ed32
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/io.c
    M block/mirror.c
    M block/qcow2.c
    M include/block/block.h
    M qemu-img.c

  Log Message:
  -----------
  block: Convert bdrv_get_block_status_above() to bytes

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 name of the function from bdrv_get_block_status_above()
to bdrv_block_status_above() ensures that the compiler enforces that
all callers are updated.  Likewise, since it a byte interface allows
an offset mapping that might not be sector aligned, split the mapping
out of the return value and into a pass-by-reference parameter.  For
now, the io.c layer still assert()s that all uses are sector-aligned,
but that can be relaxed when a later patch implements byte-based
block status in the drivers.

For the most part this patch is just the addition of scaling at the
callers followed by inverse scaling at bdrv_block_status(), plus
updates for the new split return interface.  But some code,
particularly bdrv_block_status(), gets a lot simpler because it no
longer has to mess with sectors.  Likewise, mirror code no longer
computes s->granularity >> BDRV_SECTOR_BITS, and can therefore drop
an assertion about alignment because the loop no longer depends on
alignment (never mind that we don't really have a driver that
reports sub-sector alignments, so it's not really possible to test
the effect of sub-sector mirroring).  Fix a neighboring assertion to
use is_power_of_2 while there.

For ease of review, bdrv_get_block_status() was tackled separately.

Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 7daddc615e694ede5dd75366e8a0407f2404ccd8
      
https://github.com/qemu/qemu/commit/7daddc615e694ede5dd75366e8a0407f2404ccd8
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M qemu-img.c

  Log Message:
  -----------
  qemu-img: Simplify logic in img_compare()

As long as we are querying the status for a chunk smaller than
the known image size, we are guaranteed that a successful return
will have set pnum to a non-zero size (pnum is zero only for
queries beyond the end of the file).  Use that to slightly
simplify the calculation of the current chunk size being compared.
Likewise, we don't have to shrink the amount of data operated on
until we know we have to read the file, and therefore have to fit
in the bounds of our buffer.  Also, note that 'total_sectors_over'
is equivalent to 'progress_base'.

With these changes in place, sectors_to_process() is now dead code,
and can be removed.

Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 391cb1aacad155bea4270b863710bba9adabe311
      
https://github.com/qemu/qemu/commit/391cb1aacad155bea4270b863710bba9adabe311
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M qemu-img.c

  Log Message:
  -----------
  qemu-img: Speed up compare on pre-allocated larger file

Compare the following images with all-zero contents:
$ truncate --size 1M A
$ qemu-img create -f qcow2 -o preallocation=off B 1G
$ qemu-img create -f qcow2 -o preallocation=metadata C 1G

On my machine, the difference is noticeable for pre-patch speeds,
with more than an order of magnitude in difference caused by the
choice of preallocation in the qcow2 file:

$ time ./qemu-img compare -f raw -F qcow2 A B
Warning: Image size mismatch!
Images are identical.

real    0m0.014s
user    0m0.007s
sys     0m0.007s

$ time ./qemu-img compare -f raw -F qcow2 A C
Warning: Image size mismatch!
Images are identical.

real    0m0.341s
user    0m0.144s
sys     0m0.188s

Why? Because bdrv_is_allocated() returns false for image B but
true for image C, throwing away the fact that both images know
via lseek(SEEK_HOLE) that the entire image still reads as zero.
>From there, qemu-img ends up calling bdrv_pread() for every byte
of the tail, instead of quickly looking for the next allocation.
The solution: use block_status instead of is_allocated, giving:

$ time ./qemu-img compare -f raw -F qcow2 A C
Warning: Image size mismatch!
Images are identical.

real    0m0.014s
user    0m0.011s
sys     0m0.003s

which is on par with the speeds for no pre-allocation.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: debb38a4cec34709604a00e23368e6cd8932fe3d
      
https://github.com/qemu/qemu/commit/debb38a4cec34709604a00e23368e6cd8932fe3d
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M qemu-img.c

  Log Message:
  -----------
  qemu-img: Add find_nonzero()

During 'qemu-img compare', when we are checking that an allocated
portion of one file is all zeros, we don't need to waste time
computing how many additional sectors after the first non-zero
byte are also non-zero.  Create a new helper find_nonzero() to do
the check for a first non-zero sector, and rebase
check_empty_sectors() to use it.

The new interface intentionally uses bytes in its interface, even
though it still crawls the buffer a sector at a time; it is robust
to a partial sector at the end of the buffer.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 0608e40e8e1934b22a3d218cf04abc4eb108c493
      
https://github.com/qemu/qemu/commit/0608e40e8e1934b22a3d218cf04abc4eb108c493
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M qemu-img.c
    M tests/qemu-iotests/074.out

  Log Message:
  -----------
  qemu-img: Drop redundant error message in compare

If a read error is encountered during 'qemu-img compare', we
were printing the "Error while reading offset ..." message twice;
this was because our helper function was awkward, printing output
on some but not all paths.  Fix it to consistently report errors
on all paths, so that the callers do not risk a redundant message,
and update the testsuite for the improved output.

Further simplify the code by hoisting the conversion from an error
message to an exit code into the helper function, rather than
repeating that logic at all callers (yes, the helper function is
now less generic, but it's a net win in lines of code).

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: c41508edc68aefb784c3b750bbbff472eca1a3c5
      
https://github.com/qemu/qemu/commit/c41508edc68aefb784c3b750bbbff472eca1a3c5
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M qemu-img.c

  Log Message:
  -----------
  qemu-img: Change check_empty_sectors() to byte-based

Continue on the quest to make more things byte-based instead of
sector-based.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: dc61cd3b144151024a247a109f360d2e2cab0f81
      
https://github.com/qemu/qemu/commit/dc61cd3b144151024a247a109f360d2e2cab0f81
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M qemu-img.c

  Log Message:
  -----------
  qemu-img: Change compare_sectors() to be byte-based

In the continuing quest to make more things byte-based, change
compare_sectors(), renaming it to compare_buffers() in the
process.  Note that one caller (qemu-img compare) only cares
about the first difference, while the other (qemu-img rebase)
cares about how many consecutive sectors have the same
equal/different status; however, this patch does not bother to
micro-optimize the compare case to avoid the comparisons of
sectors beyond the first mismatch.  Both callers are always
passing valid buffers in, so the initial check for buffer size
can be turned into an assertion.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 415362873fd3bfba4605ec44b6ae2da91bbb28d3
      
https://github.com/qemu/qemu/commit/415362873fd3bfba4605ec44b6ae2da91bbb28d3
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M qemu-img.c

  Log Message:
  -----------
  qemu-img: Change img_rebase() to be byte-based

In the continuing quest to make more things byte-based, change
the internal iteration of img_rebase().  We can finally drop the
TODO assertion added earlier, now that the entire algorithm is
byte-based and no longer has to shift from bytes to sectors.

Most of the change is mechanical ('num_sectors' becomes 'size',
'sector' becomes 'offset', 'n' goes from sectors to bytes); some
of it is also a cleanup (use of MIN() instead of open-coding,
loss of variable 'count' added earlier in commit d6a644bb).

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 033d9fc203a90f567b16119906cd06f7e65a397c
      
https://github.com/qemu/qemu/commit/033d9fc203a90f567b16119906cd06f7e65a397c
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M qemu-img.c

  Log Message:
  -----------
  qemu-img: Change img_compare() to be byte-based

In the continuing quest to make more things byte-based, change
the internal iteration of img_compare().  We can finally drop the
TODO assertions added earlier, now that the entire algorithm is
byte-based and no longer has to shift from bytes to sectors.

Most of the change is mechanical ('total_sectors' becomes
'total_size', 'sector_num' becomes 'offset', 'nb_sectors' becomes
'chunk', 'progress_base' goes from sectors to bytes); some of it
is also a cleanup (sectors_to_bytes() is now unused, loss of
variable 'count' added earlier in commit 51b0a488).

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: efa6e2ed643c770153eeacace410c06f15360cd9
      
https://github.com/qemu/qemu/commit/efa6e2ed643c770153eeacace410c06f15360cd9
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/blkdebug.c
    M block/io.c
    M include/block/block_int.h

  Log Message:
  -----------
  block: Align block status requests

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: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 88e63df21490a43f430820c66b043018db96b1d4
      
https://github.com/qemu/qemu/commit/88e63df21490a43f430820c66b043018db96b1d4
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/io.c

  Log Message:
  -----------
  block: Reduce bdrv_aligned_preadv() rounding

Now that bdrv_is_allocated accepts non-aligned inputs, we can
remove the TODO added in commit d6a644bb.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 8cbf74b23cafd1bcee5fdef769f8e94ace43935f
      
https://github.com/qemu/qemu/commit/8cbf74b23cafd1bcee5fdef769f8e94ace43935f
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/qcow2.c

  Log Message:
  -----------
  qcow2: Reduce is_zero() rounding

Now that bdrv_is_allocated accepts non-aligned inputs, we can
remove the TODO added in earlier refactoring.

Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: f0a9c18f9e72ab66d3c57c5c3a43137deb534076
      
https://github.com/qemu/qemu/commit/f0a9c18f9e72ab66d3c57c5c3a43137deb534076
  Author: Eric Blake <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M qemu-io-cmds.c
    M tests/qemu-iotests/177
    M tests/qemu-iotests/177.out

  Log Message:
  -----------
  qemu-io: Relax 'alloc' now that block-status doesn't assert

Previously, the alloc command required that input parameters be
sector-aligned and clamped to 32 bits, because the underlying
bdrv_is_allocated used a 32-bit parameter and asserted aligned
inputs.  But now that we have fixed block status to report a
64-bit bytes value, and to properly round requests on behalf of
guests, we can pass any values, and can use qemu-io to add
coverage that our rounding is correct regardless of the guest
alignment constraints.

Update iotest 177 to intentionally probe block status at
unaligned boundaries as well as with a bytes value that does not
map to 32-bit sectors, which also required tweaking the image
prep to leave an unallocated portion to the image under test.

Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 67e56472a503f94a3950bad85a57fb99706cf1d8
      
https://github.com/qemu/qemu/commit/67e56472a503f94a3950bad85a57fb99706cf1d8
  Author: Max Reitz <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M qemu-img.texi

  Log Message:
  -----------
  qemu-img.1: Image invalidation on qemu-img commit

qemu-img commit invalidates all images between base and top.  This
should be mentioned in the man page.

Suggested-by: Ping Li <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: a35f87f50d4bb5d7255b30e5bb9dddb6f3a6938f
      
https://github.com/qemu/qemu/commit/a35f87f50d4bb5d7255b30e5bb9dddb6f3a6938f
  Author: Alberto Garcia <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/qcow2.c

  Log Message:
  -----------
  qcow2: Use BDRV_SECTOR_BITS instead of its literal value

BDRV_SECTOR_BITS is defined to be 9 in block.h (and BDRV_SECTOR_SIZE
is calculated from that), but there are still a couple of places where
we are using the literal value instead of the macro.

Signed-off-by: Alberto Garcia <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>


  Commit: f700ceae8ab57a5c8973932c14f9abba1f99e5a8
      
https://github.com/qemu/qemu/commit/f700ceae8ab57a5c8973932c14f9abba1f99e5a8
  Author: Max Reitz <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    A tests/qemu-iotests/127
    A tests/qemu-iotests/127.out
    M tests/qemu-iotests/group

  Log Message:
  -----------
  iotests: Add test for dataplane mirroring

Signed-off-by: Max Reitz <address@hidden>
Message-id: address@hidden
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Max Reitz <address@hidden>


  Commit: 44673a0b59d1fafd1abfdf35a1ac924b856c6ad5
      
https://github.com/qemu/qemu/commit/44673a0b59d1fafd1abfdf35a1ac924b856c6ad5
  Author: Max Reitz <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M tests/qemu-iotests/067
    M tests/qemu-iotests/087
    M tests/qemu-iotests/common.filter

  Log Message:
  -----------
  iotests: Pull _filter_actual_image_size from 67/87

Tests 067 and 087 filter the actual image size because it depends on the
host filesystem (and is not part of the respective test).  Since this is
generally true, we should have a common filter function for this, so
let's pull out the sed line from both tests into such a function.

Signed-off-by: Max Reitz <address@hidden>
Message-id: address@hidden
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Signed-off-by: Max Reitz <address@hidden>


  Commit: b66df843b442924745d196bd0a05f0639b808164
      
https://github.com/qemu/qemu/commit/b66df843b442924745d196bd0a05f0639b808164
  Author: Max Reitz <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M tests/qemu-iotests/184
    M tests/qemu-iotests/184.out
    M tests/qemu-iotests/191
    M tests/qemu-iotests/191.out

  Log Message:
  -----------
  iotests: Filter actual image size in 184 and 191

Whenever the actual image size is not part of the test, it should be
filtered as it depends on the host filesystem.

Signed-off-by: Max Reitz <address@hidden>
Message-id: address@hidden
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Signed-off-by: Max Reitz <address@hidden>


  Commit: 233521b1999810036f63d060ce021d30a8ce0504
      
https://github.com/qemu/qemu/commit/233521b1999810036f63d060ce021d30a8ce0504
  Author: Max Reitz <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/qcow2.c

  Log Message:
  -----------
  qcow2: Emit errp when truncating the image tail

bdrv_truncate() has an errp parameter which is always set when an error
occurs.  Let's use that instead of a plain strerror().

Signed-off-by: Max Reitz <address@hidden>
Message-id: address@hidden
Reviewed-by: Pavel Butsykin <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Signed-off-by: Max Reitz <address@hidden>


  Commit: e400ad1e1f0127b4fdabcb1c8de1e99be91788df
      
https://github.com/qemu/qemu/commit/e400ad1e1f0127b4fdabcb1c8de1e99be91788df
  Author: Max Reitz <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/qcow2.c

  Log Message:
  -----------
  qcow2: Fix unaligned preallocated truncation

A qcow2 image file's length is not required to have a length that is a
multiple of the cluster size.  However, qcow2_refcount_area() expects an
aligned value for its @start_offset parameter, so we need to round
@old_file_size up to the next cluster boundary.

Reported-by: Ping Li <address@hidden>
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1414049
Signed-off-by: Max Reitz <address@hidden>
Message-id: address@hidden
Cc: address@hidden
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Max Reitz <address@hidden>


  Commit: 572b07bea1d1a0f7726fd95c2613c76002a379bc
      
https://github.com/qemu/qemu/commit/572b07bea1d1a0f7726fd95c2613c76002a379bc
  Author: Max Reitz <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/qcow2.c

  Log Message:
  -----------
  qcow2: Always execute preallocate() in a coroutine

Some qcow2 functions (at least perform_cow()) expect s->lock to be
taken.  Therefore, if we want to make use of them, we should execute
preallocate() (as "preallocate_co") in a coroutine so that we can use
the qemu_co_mutex_* functions.

Signed-off-by: Max Reitz <address@hidden>
Message-id: address@hidden
Cc: address@hidden
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Max Reitz <address@hidden>


  Commit: 4c112a397c2f61038914fa315a7896ce6d645d18
      
https://github.com/qemu/qemu/commit/4c112a397c2f61038914fa315a7896ce6d645d18
  Author: Max Reitz <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M tests/qemu-iotests/125
    M tests/qemu-iotests/125.out

  Log Message:
  -----------
  iotests: Add cluster_size=64k to 125

Apparently it would be a good idea to test that, too.

Signed-off-by: Max Reitz <address@hidden>
Message-id: address@hidden
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Max Reitz <address@hidden>


  Commit: 4254d01ce4eec9a3ccf320d14e2da132b8ad4a51
      
https://github.com/qemu/qemu/commit/4254d01ce4eec9a3ccf320d14e2da132b8ad4a51
  Author: Kevin Wolf <address@hidden>
  Date:   2017-10-26 (Thu, 26 Oct 2017)

  Changed paths:
    M block/qcow2.c
    M tests/qemu-iotests/067
    M tests/qemu-iotests/087
    M tests/qemu-iotests/125
    M tests/qemu-iotests/125.out
    A tests/qemu-iotests/127
    A tests/qemu-iotests/127.out
    M tests/qemu-iotests/184
    M tests/qemu-iotests/184.out
    M tests/qemu-iotests/191
    M tests/qemu-iotests/191.out
    M tests/qemu-iotests/common.filter
    M tests/qemu-iotests/group

  Log Message:
  -----------
  Merge remote-tracking branch 'mreitz/tags/pull-block-2017-10-26' into 
queue-block

Block patches

# gpg: Signature made Thu Oct 26 15:01:20 2017 CEST
# gpg:                using RSA key F407DB0061D5CF40
# gpg: Good signature from "Max Reitz <address@hidden>"
# Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40

* mreitz/tags/pull-block-2017-10-26:
  iotests: Add cluster_size=64k to 125
  qcow2: Always execute preallocate() in a coroutine
  qcow2: Fix unaligned preallocated truncation
  qcow2: Emit errp when truncating the image tail
  iotests: Filter actual image size in 184 and 191
  iotests: Pull _filter_actual_image_size from 67/87
  iotests: Add test for dataplane mirroring
  qcow2: Use BDRV_SECTOR_BITS instead of its literal value

Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 46f63e5b8899e1639d93025a8f2d5f1239b7dcdd
      
https://github.com/qemu/qemu/commit/46f63e5b8899e1639d93025a8f2d5f1239b7dcdd
  Author: Peter Maydell <address@hidden>
  Date:   2017-10-27 (Fri, 27 Oct 2017)

  Changed paths:
    M block.c
    M block/blkdebug.c
    M block/io.c
    M block/mirror.c
    M block/qcow2-cluster.c
    M block/qcow2.c
    M block/trace-events
    M include/block/block.h
    M include/block/block_int.h
    M qemu-img.c
    M qemu-img.texi
    M qemu-io-cmds.c
    M tests/qemu-iotests/067
    M tests/qemu-iotests/074.out
    M tests/qemu-iotests/087
    M tests/qemu-iotests/125
    M tests/qemu-iotests/125.out
    A tests/qemu-iotests/127
    A tests/qemu-iotests/127.out
    M tests/qemu-iotests/177
    M tests/qemu-iotests/177.out
    M tests/qemu-iotests/184
    M tests/qemu-iotests/184.out
    M tests/qemu-iotests/191
    M tests/qemu-iotests/191.out
    M tests/qemu-iotests/common.filter
    M tests/qemu-iotests/group

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches

# gpg: Signature made Thu 26 Oct 2017 14:02:54 BST
# gpg:                using RSA key 0x7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <address@hidden>"
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream: (35 commits)
  iotests: Add cluster_size=64k to 125
  qcow2: Always execute preallocate() in a coroutine
  qcow2: Fix unaligned preallocated truncation
  qcow2: Emit errp when truncating the image tail
  iotests: Filter actual image size in 184 and 191
  iotests: Pull _filter_actual_image_size from 67/87
  iotests: Add test for dataplane mirroring
  qcow2: Use BDRV_SECTOR_BITS instead of its literal value
  qemu-img.1: Image invalidation on qemu-img commit
  qemu-io: Relax 'alloc' now that block-status doesn't assert
  qcow2: Reduce is_zero() rounding
  block: Reduce bdrv_aligned_preadv() rounding
  block: Align block status requests
  qemu-img: Change img_compare() to be byte-based
  qemu-img: Change img_rebase() to be byte-based
  qemu-img: Change compare_sectors() to be byte-based
  qemu-img: Change check_empty_sectors() to byte-based
  qemu-img: Drop redundant error message in compare
  qemu-img: Add find_nonzero()
  qemu-img: Speed up compare on pre-allocated larger file
  ...

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/6e6430a821a1...46f63e5b8899

reply via email to

[Prev in Thread] Current Thread [Next in Thread]