Skip to content

block: Fix some things about bdrv_has_zero_init()

Max Reitz qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest11 patches 22 repliesIn review

Changes in v2 from the cover letter

- Simplified preallocation checks in qcow2 and vhdx [Kevin]
- Added patches 1 – 5, 10, 11

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11qemu-img: Fix bdrv_has_zero_init() use in convertqemu-img.c+8 -32 replies
2/11mirror: Fix bdrv_has_zero_init() useblock/mirror.c blockdev.c include/block/block_int.h +1 more+24 -73 replies
3/11block: Add bdrv_has_zero_init_truncate()block.c include/block/block.h include/block/block_int.h+29 -04 replies
4/11block: Implement .bdrv_has_zero_init_truncate()block/file-posix.c block/file-win32.c block/gluster.c +7 more+18 -02 replies
5/11block: Use bdrv_has_zero_init_truncate()block/parallels.c block/vhdx.c+2 -23 replies
6/11qcow2: Fix .bdrv_has_zero_init()block/qcow2.c+28 -11 reply
7/11vdi: Fix .bdrv_has_zero_init()block/vdi.c+12 -11 reply
8/11vhdx: Fix .bdrv_has_zero_init()block/vhdx.c+25 -11 reply
9/11iotests: Convert to preallocated encrypted qcow2tests/qemu-iotests/188 tests/qemu-iotests/188.out+23 -13 replies
10/11iotests: Test convert -n to pre-filled imagetests/qemu-iotests/122 tests/qemu-iotests/122.out+25 -01 reply
11/11iotests: Full mirror to existing non-zero imagetests/qemu-iotests/041 tests/qemu-iotests/041.out+60 -60 replies

Reviews trailers per patch

10 of 11 patches have a Reviewed-by or Acked-by.

PatchStefano GarzarellaStefan WeilMaxim Levitsky
1/11R-b R-b
2/11R-b
3/11R-b R-b
4/11R-b R-b
5/11R-b R-b
6/11R-b
7/11A-b T-b R-b R-b
8/11R-b
9/11A-b T-b R-b
10/11R-b
11/11

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [Qemu-devel] [PATCH v2 00/11] block: Fix some things about bdrv_has_zero_init()

Hi,

See the previous cover letter for the reason for patches 6 through 9:
https://lists.nongnu.org/archive/html/qemu-block/2019-07/msg00563.html

But no only some bdrv_has_zero_init() implementations are wrong, some callers also use it the wrong way.

First, qemu-img and mirror use it for pre-existing images, where it doesn’t have any meaning. Both should consider pre-existing images to always be non-zero and not look at bdrv_has-zero_init() (patches 1, 2, and the tests in 10 and 11).

Second, vhdx and parallels call bdrv_has_zero_init() when they do not really care about an image’s post-create state but only about what happens when you grow an image. That is a bit ugly, and also overly safe when growing preallocated images without preallocating the new areas. So this series adds a new function bdrv_has_zero_init_truncate() that is more suited to vhdx's and parallel's needs (patches 3 through 5).

v2:
- Simplified preallocation checks in qcow2 and vhdx [Kevin]
- Added patches 1 – 5, 10, 11

git-backport-diff against v1:

Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch [down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/11:[down] 'qemu-img: Fix bdrv_has_zero_init() use in convert' 002/11:[down] 'mirror: Fix bdrv_has_zero_init() use' 003/11:[down] 'block: Add bdrv_has_zero_init_truncate()' 004/11:[down] 'block: Implement .bdrv_has_zero_init_truncate()' 005/11:[down] 'block: Use bdrv_has_zero_init_truncate()' 006/11:[0077] [FC] 'qcow2: Fix .bdrv_has_zero_init()' 007/11:[----] [--] 'vdi: Fix .bdrv_has_zero_init()' 008/11:[0021] [FC] 'vhdx: Fix .bdrv_has_zero_init()' 009/11:[----] [--] 'iotests: Convert to preallocated encrypted qcow2' 010/11:[down] 'iotests: Test convert -n to pre-filled image' 011/11:[down] 'iotests: Full mirror to existing non-zero image'

Max Reitz (11):
qemu-img: Fix bdrv_has_zero_init() use in convert
mirror: Fix bdrv_has_zero_init() use
block: Add bdrv_has_zero_init_truncate()
block: Implement .bdrv_has_zero_init_truncate()
block: Use bdrv_has_zero_init_truncate()
qcow2: Fix .bdrv_has_zero_init()
vdi: Fix .bdrv_has_zero_init()
vhdx: Fix .bdrv_has_zero_init()
iotests: Convert to preallocated encrypted qcow2
iotests: Test convert -n to pre-filled image
iotests: Full mirror to existing non-zero image

 include/block/block.h       |  1 +
 include/block/block_int.h   |  9 ++++++
 block.c                     | 21 +++++++++++++
 block/file-posix.c          |  1 +
 block/file-win32.c          |  1 +
 block/gluster.c             |  4 +++
 block/mirror.c              | 11 +++++--
 block/nfs.c                 |  1 +
 block/parallels.c           |  2 +-
 block/qcow2.c               | 30 +++++++++++++++++-
 block/qed.c                 |  1 +
 block/raw-format.c          |  6 ++++
 block/rbd.c                 |  1 +
 block/sheepdog.c            |  1 +
 block/ssh.c                 |  1 +
 block/vdi.c                 | 13 +++++++-
 block/vhdx.c                | 28 +++++++++++++++--
 blockdev.c                  | 16 ++++++++--
 qemu-img.c                  | 11 +++++--
 tests/test-block-iothread.c |  2 +-
 tests/qemu-iotests/041      | 62 ++++++++++++++++++++++++++++++++++---
 tests/qemu-iotests/041.out  |  4 +--
 tests/qemu-iotests/122      | 17 ++++++++++
 tests/qemu-iotests/122.out  |  8 +++++
 tests/qemu-iotests/188      | 20 +++++++++++-
 tests/qemu-iotests/188.out  |  4 +++
 26 files changed, 254 insertions(+), 22 deletions(-)
Signature · 1 line
2.21.0