qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] e8de7b: block/block-copy: block_copy_dirty_cl


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] e8de7b: block/block-copy: block_copy_dirty_clusters: fix f...
Date: Tue, 07 Jul 2020 13:45:30 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: e8de7ba9ea086c427cd36a10bc3506ac20aa4895
      
https://github.com/qemu/qemu/commit/e8de7ba9ea086c427cd36a10bc3506ac20aa4895
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M block/block-copy.c

  Log Message:
  -----------
  block/block-copy: block_copy_dirty_clusters: fix failure check

ret may be > 0 on success path at this point. Fix assertion, which may
crash currently.

Fixes: 4ce5dd3e9b5ee0fac18625860eb3727399ee965e
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200526181347.489557-1-vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: a5675f390116a927e320984f02f473a6affc9fcd
      
https://github.com/qemu/qemu/commit/a5675f390116a927e320984f02f473a6affc9fcd
  Author: Alberto Garcia <berto@igalia.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

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

  Log Message:
  -----------
  qcow2: Fix preallocation on images with unaligned sizes

When resizing an image with qcow2_co_truncate() using the falloc or
full preallocation modes the code assumes that both the old and new
sizes are cluster-aligned.

There are two problems with this:

  1) The calculation of how many clusters are involved does not always
     get the right result.

     Example: creating a 60KB image and resizing it (with
     preallocation=full) to 80KB won't allocate the second cluster.

  2) No copy-on-write is performed, so in the previous example if
     there is a backing file then the first 60KB of the first cluster
     won't be filled with data from the backing file.

This patch fixes both issues.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-Id: <20200617140036.20311-1-berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: 57ee95ed4ee7b4c039ec5f0705c45734c56706bc
      
https://github.com/qemu/qemu/commit/57ee95ed4ee7b4c039ec5f0705c45734c56706bc
  Author: Max Reitz <mreitz@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M tests/qemu-iotests/112.out
    M tests/qemu-iotests/141
    M tests/qemu-iotests/153
    M tests/qemu-iotests/common.filter

  Log Message:
  -----------
  iotests: Make _filter_img_create more active

Right now, _filter_img_create just filters out everything that looks
format-dependent, and applies some filename filters.  That means that we
have to add another filter line every time some format gets a new
creation option.  This can be avoided by instead discarding everything
and just keeping what we know is format-independent (format, size,
backing file, encryption information[1], preallocation) or just
interesting to have in the reference output (external data file path).

Furthermore, we probably want to sort these options.  Format drivers are
not required to define them in any specific order, so the output is
effectively random (although this has never bothered us until now).  We
need a specific order for our reference outputs, though.  Unfortunately,
just using a plain "sort" would change a lot of existing reference
outputs, so we have to pre-filter the option keys to keep our existing
order (fmt, size, backing*, data, encryption info, preallocation).

Finally, this makes it difficult for _filter_img_create to automagically
work for QMP output.  Thus, this patch adds a separate
_filter_img_create_for_qmp function that echos every line verbatim that
does not start with "Formatting", and pipes those "Formatting" lines to
_filter_img_create.

[1] Actually, the only thing that is really important is whether
    encryption is enabled or not.  A patch by Maxim thus removes all
    other "encrypt.*" options from the output:
    https://lists.nongnu.org/archive/html/qemu-block/2020-06/msg00339.html
    But that patch needs to come later so we can get away with changing
    as few reference outputs in this patch here as possible.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200625125548.870061-2-mreitz@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>


  Commit: cbb32e79dd13cc46137697de2c89d35b2b74a3f6
      
https://github.com/qemu/qemu/commit/cbb32e79dd13cc46137697de2c89d35b2b74a3f6
  Author: Maxim Levitsky <mlevitsk@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M tests/qemu-iotests/087.out
    M tests/qemu-iotests/134.out
    M tests/qemu-iotests/158.out
    M tests/qemu-iotests/188.out
    M tests/qemu-iotests/189.out
    M tests/qemu-iotests/198.out
    M tests/qemu-iotests/263.out
    M tests/qemu-iotests/284.out
    M tests/qemu-iotests/common.filter

  Log Message:
  -----------
  iotests: filter few more luks specific create options

This allows more tests to be able to have same output on both qcow2 luks 
encrypted images
and raw luks images

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20200625125548.870061-3-mreitz@redhat.com>


  Commit: dc4ab0291983d4d0df7c32566e45da42817a343a
      
https://github.com/qemu/qemu/commit/dc4ab0291983d4d0df7c32566e45da42817a343a
  Author: Max Reitz <mreitz@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M tests/qemu-iotests/common.rc

  Log Message:
  -----------
  iotests/common.rc: Add _require_working_luks

That the luks driver is present is little indication on whether it is
actually working.  Without the crypto libraries linked in, it does not
work.  So add this function, which tries to create a luks image to see
whether that actually works.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200625125548.870061-4-mreitz@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>


  Commit: d849acab4196b35339e55735889ed7481be6ff2f
      
https://github.com/qemu/qemu/commit/d849acab4196b35339e55735889ed7481be6ff2f
  Author: Max Reitz <mreitz@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M tests/qemu-iotests/iotests.py

  Log Message:
  -----------
  iotests.py: Add qemu_img_pipe_and_status()

This function will be used by the next patch, which intends to check
both the exit code and qemu-img's output.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200625125548.870061-5-mreitz@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
[mreitz: Rebased on 49438972b8c2e]
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: 6649f4bd2920301e0ef0e8e14d10cf0e00b4071e
      
https://github.com/qemu/qemu/commit/6649f4bd2920301e0ef0e8e14d10cf0e00b4071e
  Author: Max Reitz <mreitz@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M tests/qemu-iotests/iotests.py

  Log Message:
  -----------
  iotests.py: Add (verify|has)_working_luks()

Similar to _require_working_luks for bash tests, these functions can be
used to check whether our luks driver can actually create images.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200625125548.870061-6-mreitz@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>


  Commit: d2a839ede850bbb23493ac03b1c2477026fe6bc7
      
https://github.com/qemu/qemu/commit/d2a839ede850bbb23493ac03b1c2477026fe6bc7
  Author: Max Reitz <mreitz@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M tests/qemu-iotests/087
    M tests/qemu-iotests/178
    M tests/qemu-iotests/188
    M tests/qemu-iotests/189
    M tests/qemu-iotests/198
    M tests/qemu-iotests/206
    M tests/qemu-iotests/263
    M tests/qemu-iotests/284
    M tests/qemu-iotests/common.rc
    M tests/qemu-iotests/iotests.py

  Log Message:
  -----------
  iotests: Check whether luks works

Whenever running an iotest for the luks format, we should check whether
luks actually really works.

Tests that try to create luks-encrypted qcow2 images should do the same.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200625125548.870061-7-mreitz@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>


  Commit: 43cbd06df2dcdfe236e68351bb3c350e0d1d857a
      
https://github.com/qemu/qemu/commit/43cbd06df2dcdfe236e68351bb3c350e0d1d857a
  Author: Maxim Levitsky <mlevitsk@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M block/crypto.c
    M block/crypto.h
    M crypto/block.c
    M crypto/blockpriv.h
    M include/crypto/block.h
    M qapi/crypto.json

  Log Message:
  -----------
  qcrypto/core: add generic infrastructure for crypto options amendment

This will be used first to implement luks keyslot management.

block_crypto_amend_opts_init will be used to convert
qemu-img cmdline to QCryptoBlockAmendOptions

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200608094030.670121-2-mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: 557d2bdcca8fa42e9aa956210e863192ddeb8acf
      
https://github.com/qemu/qemu/commit/557d2bdcca8fa42e9aa956210e863192ddeb8acf
  Author: Maxim Levitsky <mlevitsk@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M crypto/block-luks.c
    M qapi/crypto.json

  Log Message:
  -----------
  qcrypto/luks: implement encryption key management

Next few patches will expose that functionality to the user.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200608094030.670121-3-mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: a3579bfa0a209761c8526ccc96a5d6068f14768f
      
https://github.com/qemu/qemu/commit/a3579bfa0a209761c8526ccc96a5d6068f14768f
  Author: Maxim Levitsky <mlevitsk@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M block.c
    M block/qcow2.c
    M docs/tools/qemu-img.rst
    M include/block/block.h
    M include/block/block_int.h
    M qemu-img-cmds.hx
    M qemu-img.c

  Log Message:
  -----------
  block/amend: add 'force' option

'force' option will be used for some unsafe amend operations.

This includes things like erasing last keyslot in luks based formats
(which destroys the data, unless the master key is backed up
by external means), but that _might_ be desired result.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200608094030.670121-4-mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: df373fb0a3a26c2b1b92d27c91bea22a0f5b598d
      
https://github.com/qemu/qemu/commit/df373fb0a3a26c2b1b92d27c91bea22a0f5b598d
  Author: Maxim Levitsky <mlevitsk@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

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

  Log Message:
  -----------
  block/amend: separate amend and create options for qemu-img

Some options are only useful for creation
(or hard to be amended, like cluster size for qcow2), while some other
options are only useful for amend, like upcoming keyslot management
options for luks

Since currently only qcow2 supports amend, move all its options
to a common macro and then include it in each action option list.

In future it might be useful to remove some options which are
not supported anyway from amend list, which currently
cause an error message if amended.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200608094030.670121-5-mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: 0b6786a9c1539c9bdacee71e09534e0bf972d865
      
https://github.com/qemu/qemu/commit/0b6786a9c1539c9bdacee71e09534e0bf972d865
  Author: Maxim Levitsky <mlevitsk@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M block/qcow2.c
    M qemu-img.c
    M tests/qemu-iotests/049.out
    M tests/qemu-iotests/061.out
    M tests/qemu-iotests/082.out
    M tests/qemu-iotests/085.out
    M tests/qemu-iotests/144.out
    M tests/qemu-iotests/182.out
    M tests/qemu-iotests/185.out
    M tests/qemu-iotests/255.out
    M tests/qemu-iotests/274.out
    M tests/qemu-iotests/280.out

  Log Message:
  -----------
  block/amend: refactor qcow2 amend options

Some qcow2 create options can't be used for amend.
Remove them from the qcow2 create options and add generic logic to detect
such options in qemu-img

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
[mreitz: Dropped some iotests reference output hunks that became
         unnecessary thanks to
         "iotests: Make _filter_img_create more active"]
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200625125548.870061-12-mreitz@redhat.com>


  Commit: e0d0ddc591a079d2a3da6aa913ba7dd9551fb5ef
      
https://github.com/qemu/qemu/commit/e0d0ddc591a079d2a3da6aa913ba7dd9551fb5ef
  Author: Maxim Levitsky <mlevitsk@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M block/crypto.c

  Log Message:
  -----------
  block/crypto: rename two functions

rename the write_func to create_write_func, and init_func to create_init_func.
This is preparation for other write_func that will be used to update the 
encryption keys.

No functional changes

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200608094030.670121-7-mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: bbfdae91fb68783fd54a0f817e3dd9b1c6fe8f8a
      
https://github.com/qemu/qemu/commit/bbfdae91fb68783fd54a0f817e3dd9b1c6fe8f8a
  Author: Maxim Levitsky <mlevitsk@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M block/crypto.c
    M block/crypto.h

  Log Message:
  -----------
  block/crypto: implement the encryption key management

This implements the encryption key management using the generic code in
qcrypto layer and exposes it to the user via qemu-img

This code adds another 'write_func' because the initialization
write_func works directly on the underlying file, and amend
works on instance of luks device.

This commit also adds a 'hack/workaround' I and Kevin Wolf (thanks)
made to make the driver both support write sharing (to avoid breaking the 
users),
and be safe against concurrent  metadata update (the keyslots)

Eventually the write sharing for luks driver will be deprecated
and removed together with this hack.

The hack is that we ask (as a format driver) for BLK_PERM_CONSISTENT_READ
and then when we want to update the keys, we unshare that permission.
So if someone else has the image open, even readonly, encryption
key update will fail gracefully.

Also thanks to Daniel Berrange for the idea of
unsharing read, rather that write permission which allows
to avoid cases when the other user had opened the image read-only.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200608094030.670121-8-mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: 90766d9db987a089ba271f6d30d6856745a7a3ce
      
https://github.com/qemu/qemu/commit/90766d9db987a089ba271f6d30d6856745a7a3ce
  Author: Maxim Levitsky <mlevitsk@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M block/qcow2.c
    M tests/qemu-iotests/082.out

  Log Message:
  -----------
  block/qcow2: extend qemu-img amend interface with crypto options

Now that we have all the infrastructure in place,
wire it in the qcow2 driver and expose this to the user.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200608094030.670121-9-mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: 11d80bfc6da00d8b53bf1cc2da19b4a2e0b23961
      
https://github.com/qemu/qemu/commit/11d80bfc6da00d8b53bf1cc2da19b4a2e0b23961
  Author: Maxim Levitsky <mlevitsk@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

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

  Log Message:
  -----------
  iotests: qemu-img tests for luks key management

This commit adds two tests, which test the new amend interface
of both luks raw images and qcow2 luks encrypted images.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
[mreitz: Let 293 verify that LUKS works; drop $(seq) usage from 293;
         drop 293 and 294 from the auto group]
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200625125548.870061-16-mreitz@redhat.com>


  Commit: ced914d0ab9fb2c900f873f6349a0b8eecd1fdbe
      
https://github.com/qemu/qemu/commit/ced914d0ab9fb2c900f873f6349a0b8eecd1fdbe
  Author: Maxim Levitsky <mlevitsk@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M block/Makefile.objs
    A block/amend.c
    M include/block/block_int.h
    M qapi/block-core.json
    M qapi/job.json

  Log Message:
  -----------
  block/core: add generic infrastructure for x-blockdev-amend qmp command

blockdev-amend will be used similiar to blockdev-create
to allow on the fly changes of the structure of the format based block devices.

Current plan is to first support encryption keyslot management for luks
based formats (raw and embedded in qcow2)

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200608094030.670121-12-mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: 30da9dd88a0315d73320e27dfb69093ee3ce5d1c
      
https://github.com/qemu/qemu/commit/30da9dd88a0315d73320e27dfb69093ee3ce5d1c
  Author: Maxim Levitsky <mlevitsk@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M block/crypto.c
    M qapi/block-core.json

  Log Message:
  -----------
  block/crypto: implement blockdev-amend

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200608094030.670121-13-mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: 8ea1613d91b2f515132f015430efaa35adb8f6d0
      
https://github.com/qemu/qemu/commit/8ea1613d91b2f515132f015430efaa35adb8f6d0
  Author: Maxim Levitsky <mlevitsk@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M block/qcow2.c
    M qapi/block-core.json

  Log Message:
  -----------
  block/qcow2: implement blockdev-amend

Currently the implementation only supports amending the encryption
options, unlike the qemu-img version

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200608094030.670121-14-mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: a2cd85f6acc3c3a6cfc1abd8ac732aa7cfd5e9ef
      
https://github.com/qemu/qemu/commit/a2cd85f6acc3c3a6cfc1abd8ac732aa7cfd5e9ef
  Author: Maxim Levitsky <mlevitsk@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

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

  Log Message:
  -----------
  iotests: add tests for blockdev-amend

This commit adds two tests that cover the
new blockdev-amend functionality of luks and qcow2 driver

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
[mreitz: Let 295 verify that LUKS works; drop 295 and 296 from the auto
         group]
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200625125548.870061-20-mreitz@redhat.com>


  Commit: 2253d86eb45e039dfdeb4bad0f18bd8d5639e1a3
      
https://github.com/qemu/qemu/commit/2253d86eb45e039dfdeb4bad0f18bd8d5639e1a3
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M qemu-img.c

  Log Message:
  -----------
  qemu-img: convert: don't use unallocated_blocks_are_zero

qemu-img convert wants to distinguish ZERO which comes from short
backing files. unallocated_blocks_are_zero field of bdi is unrelated:
space after EOF is always considered to be zero anyway. So, just make
post_backing_zero true in case of short backing file.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200528094405.145708-2-vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: 7b1efe996c5becfbc7c242164a52ec2779bbd431
      
https://github.com/qemu/qemu/commit/7b1efe996c5becfbc7c242164a52ec2779bbd431
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

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

  Log Message:
  -----------
  block: inline bdrv_unallocated_blocks_are_zero()

The function has only one user: bdrv_co_block_status(). Inline it to
simplify reviewing of the following patches, which will finally drop
unallocated_blocks_are_zero field too.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200528094405.145708-3-vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: 2ea0332f427e3c6582a6c82130814c0d4c9ceb40
      
https://github.com/qemu/qemu/commit/2ea0332f427e3c6582a6c82130814c0d4c9ceb40
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M block/vdi.c

  Log Message:
  -----------
  block/vdi: return ZERO block-status when appropriate

In case of !VDI_IS_ALLOCATED[], we do zero out the corresponding chunk
of qiov. So, this should be reported as ZERO.

Note that this changes visible output of "qemu-img map --output=json"
and "qemu-io -c map" commands. For qemu-img map, the change is obvious:
we just mark as zero what is really zero. For qemu-io it's less
obvious: what was unallocated now is allocated.

There is an inconsistency in understanding of unallocated regions in
Qemu: backing-supporting format-drivers return 0 block-status to report
go-to-backing logic for this area. Some protocol-drivers (iscsi) return
0 to report fs-unallocated-non-zero status (i.e., don't occupy space on
disk, read result is undefined).

BDRV_BLOCK_ALLOCATED is defined as something more close to
go-to-backing logic. Still it is calculated as ZERO | DATA, so 0 from
iscsi is treated as unallocated. It doesn't influence backing-chain
behavior, as iscsi can't have backing file. But it does influence
"qemu-io -c map".

We should solve this inconsistency at some future point. Now, let's
just make backing-not-supporting format drivers (vdi at this patch and
vpc with the following) to behave more like backing-supporting drivers
and not report 0 block-status. More over, returning ZERO status is
absolutely valid thing, and again, corresponds to how the other
format-drivers (backing-supporting) work.

After block-status update, it never reports 0, so setting
unallocated_blocks_are_zero doesn't make sense (as the only user of it
is bdrv_co_block_status and it checks unallocated_blocks_are_zero only
for unallocated areas). Drop it.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200528094405.145708-4-vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: 2c060c0f50220bebabacccb8e321df049cca602e
      
https://github.com/qemu/qemu/commit/2c060c0f50220bebabacccb8e321df049cca602e
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M block/vpc.c
    M tests/qemu-iotests/146
    M tests/qemu-iotests/146.out

  Log Message:
  -----------
  block/vpc: return ZERO block-status when appropriate

In case when get_image_offset() returns -1, we do zero out the
corresponding chunk of qiov. So, this should be reported as ZERO.

Note that this changes visible output of "qemu-img map --output=json"
and "qemu-io -c map" commands. For qemu-img map, the change is obvious:
we just mark as zero what is really zero. For qemu-io it's less
obvious: what was unallocated now is allocated.

There is an inconsistency in understanding of unallocated regions in
Qemu: backing-supporting format-drivers return 0 block-status to report
go-to-backing logic for this area. Some protocol-drivers (iscsi) return
0 to report fs-unallocated-non-zero status (i.e., don't occupy space on
disk, read result is undefined).

BDRV_BLOCK_ALLOCATED is defined as something more close to
go-to-backing logic. Still it is calculated as ZERO | DATA, so 0 from
iscsi is treated as unallocated. It doesn't influence backing-chain
behavior, as iscsi can't have backing file. But it does influence
"qemu-io -c map".

We should solve this inconsistency at some future point. Now, let's
just make backing-not-supporting format drivers (vdi in the previous
patch and vpc now) to behave more like backing-supporting drivers
and not report 0 block-status. More over, returning ZERO status is
absolutely valid thing, and again, corresponds to how the other
format-drivers (backing-supporting) work.

After block-status update, it never reports 0, so setting
unallocated_blocks_are_zero doesn't make sense (as the only user of it
is bdrv_co_block_status and it checks unallocated_blocks_are_zero only
for unallocated areas). Drop it.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200528094405.145708-5-vsementsov@virtuozzo.com>
[mreitz: qemu-io -c map as used by iotest 146 now reports everything as
         allocated; in order to make the test do something useful, we
         use qemu-img map --output=json now]
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: 74036395ea4a67a638c0ffc35ee4860ac36bcd16
      
https://github.com/qemu/qemu/commit/74036395ea4a67a638c0ffc35ee4860ac36bcd16
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M block/crypto.c

  Log Message:
  -----------
  block/crypto: drop unallocated_blocks_are_zero

It's false by default, no needs to set it. We are going to drop this
variable at all, so drop it now here, it doesn't hurt.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200528094405.145708-6-vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: 32d293c8c668d4e0d19594d8af359627dd7260f9
      
https://github.com/qemu/qemu/commit/32d293c8c668d4e0d19594d8af359627dd7260f9
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M block/iscsi.c

  Log Message:
  -----------
  block/iscsi: drop unallocated_blocks_are_zero

We set bdi->unallocated_blocks_are_zero = iscsilun->lbprz, but
iscsi_co_block_status doesn't return 0 in case of iscsilun->lbprz, it
returns ZERO when appropriate. So actually unallocated_blocks_are_zero
is useless (it doesn't affect the only user of the field:
bdrv_co_block_status()). Drop it now.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200528094405.145708-7-vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: ac9185603e5baaab6c53e4e98eefce31f047121c
      
https://github.com/qemu/qemu/commit/ac9185603e5baaab6c53e4e98eefce31f047121c
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M block/file-posix.c

  Log Message:
  -----------
  block/file-posix: drop unallocated_blocks_are_zero

raw_co_block_status() in block/file-posix.c never returns 0, so
unallocated_blocks_are_zero is useless (it doesn't affect the only user
of the field: bdrv_co_block_status()). Drop it.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200528094405.145708-8-vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: cdf9ebf18f32f4b29f99af58e154a9afe93bbc92
      
https://github.com/qemu/qemu/commit/cdf9ebf18f32f4b29f99af58e154a9afe93bbc92
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M block/vhdx.c

  Log Message:
  -----------
  block/vhdx: drop unallocated_blocks_are_zero

vhdx doesn't have .bdrv_co_block_status handler, so DATA|ALLOCATED is
always assumed for it in bdrv_co_block_status().
unallocated_blocks_are_zero is useless (it doesn't affect the only user
of the field: bdrv_co_block_status()), drop it.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200528094405.145708-9-vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: a2adbbf603cee443ca923f6e8546267a706567d5
      
https://github.com/qemu/qemu/commit/a2adbbf603cee443ca923f6e8546267a706567d5
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

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

  Log Message:
  -----------
  block: drop unallocated_blocks_are_zero

Currently this field only set by qed and qcow2. But in fact, all
backing-supporting formats (parallels, qcow, qcow2, qed, vmdk) share
these semantics: on unallocated blocks, if there is no backing file they
just memset the buffer with zeroes.

So, document this behavior for .supports_backing and drop
.unallocated_blocks_are_zero

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200528094405.145708-10-vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: 365fed5111b06d31c1632af63c7528dfe49d62a2
      
https://github.com/qemu/qemu/commit/365fed5111b06d31c1632af63c7528dfe49d62a2
  Author: Eric Blake <eblake@redhat.com>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M block/qed.c
    M block/qed.h

  Log Message:
  -----------
  qed: Simplify backing reads

The other four drivers that support backing files (qcow, qcow2,
parallels, vmdk) all rely on the block layer to populate zeroes when
reading beyond EOF of a short backing file.  We can simplify the qed
code by doing likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200528094405.145708-11-vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>


  Commit: eb2c66b10efd2b914b56b20ae90655914310c925
      
https://github.com/qemu/qemu/commit/eb2c66b10efd2b914b56b20ae90655914310c925
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2020-07-07 (Tue, 07 Jul 2020)

  Changed paths:
    M block.c
    M block/Makefile.objs
    A block/amend.c
    M block/block-copy.c
    M block/crypto.c
    M block/crypto.h
    M block/file-posix.c
    M block/io.c
    M block/iscsi.c
    M block/qcow2.c
    M block/qed.c
    M block/qed.h
    M block/vdi.c
    M block/vhdx.c
    M block/vpc.c
    M crypto/block-luks.c
    M crypto/block.c
    M crypto/blockpriv.h
    M docs/tools/qemu-img.rst
    M include/block/block.h
    M include/block/block_int.h
    M include/crypto/block.h
    M qapi/block-core.json
    M qapi/crypto.json
    M qapi/job.json
    M qemu-img-cmds.hx
    M qemu-img.c
    M tests/qemu-iotests/049.out
    M tests/qemu-iotests/061.out
    M tests/qemu-iotests/082.out
    M tests/qemu-iotests/085.out
    M tests/qemu-iotests/087
    M tests/qemu-iotests/087.out
    M tests/qemu-iotests/112.out
    M tests/qemu-iotests/125
    M tests/qemu-iotests/125.out
    M tests/qemu-iotests/134.out
    M tests/qemu-iotests/141
    M tests/qemu-iotests/144.out
    M tests/qemu-iotests/146
    M tests/qemu-iotests/146.out
    M tests/qemu-iotests/153
    M tests/qemu-iotests/158.out
    M tests/qemu-iotests/178
    M tests/qemu-iotests/182.out
    M tests/qemu-iotests/185.out
    M tests/qemu-iotests/188
    M tests/qemu-iotests/188.out
    M tests/qemu-iotests/189
    M tests/qemu-iotests/189.out
    M tests/qemu-iotests/198
    M tests/qemu-iotests/198.out
    M tests/qemu-iotests/206
    M tests/qemu-iotests/255.out
    M tests/qemu-iotests/263
    M tests/qemu-iotests/263.out
    M tests/qemu-iotests/274.out
    M tests/qemu-iotests/280.out
    M tests/qemu-iotests/284
    M tests/qemu-iotests/284.out
    A tests/qemu-iotests/293
    A tests/qemu-iotests/293.out
    A tests/qemu-iotests/294
    A tests/qemu-iotests/294.out
    A tests/qemu-iotests/295
    A tests/qemu-iotests/295.out
    A tests/qemu-iotests/296
    A tests/qemu-iotests/296.out
    M tests/qemu-iotests/common.filter
    M tests/qemu-iotests/common.rc
    M tests/qemu-iotests/group
    M tests/qemu-iotests/iotests.py

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2020-07-06' 
into staging

Block patches for 5.1:
- LUKS keyslot amendment
  (+ patches to make the iotests pass on non-Linux systems, and to keep
     the tests passing for qcow v1, and to skip LUKS tests (including
     qcow2 LUKS) when the built qemu does not support it)
- Refactoring in the block layer: Drop the basically unnecessary
  unallocated_blocks_are_zero field from BlockDriverInfo
- Fix qcow2 preallocation when the image size is not a multiple of the
  cluster size
- Fix in block-copy code

# gpg: Signature made Mon 06 Jul 2020 11:02:53 BST
# gpg:                using RSA key 91BEB60A30DB3E8857D11829F407DB0061D5CF40
# gpg:                issuer "mreitz@redhat.com"
# gpg: Good signature from "Max Reitz <mreitz@redhat.com>" [full]
# Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40

* remotes/maxreitz/tags/pull-block-2020-07-06: (31 commits)
  qed: Simplify backing reads
  block: drop unallocated_blocks_are_zero
  block/vhdx: drop unallocated_blocks_are_zero
  block/file-posix: drop unallocated_blocks_are_zero
  block/iscsi: drop unallocated_blocks_are_zero
  block/crypto: drop unallocated_blocks_are_zero
  block/vpc: return ZERO block-status when appropriate
  block/vdi: return ZERO block-status when appropriate
  block: inline bdrv_unallocated_blocks_are_zero()
  qemu-img: convert: don't use unallocated_blocks_are_zero
  iotests: add tests for blockdev-amend
  block/qcow2: implement blockdev-amend
  block/crypto: implement blockdev-amend
  block/core: add generic infrastructure for x-blockdev-amend qmp command
  iotests: qemu-img tests for luks key management
  block/qcow2: extend qemu-img amend interface with crypto options
  block/crypto: implement the encryption key management
  block/crypto: rename two functions
  block/amend: refactor qcow2 amend options
  block/amend: separate amend and create options for qemu-img
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/c8eaf81fd226...eb2c66b10efd



reply via email to

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