Skip to content

block: Do not call BlockDriver.bdrv_make_empty() directly

Max Reitz qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 6 repliesIn review
  2. v14 patches 20 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4block: Add bdrv_make_empty()block.c include/block/block.h+24 -01 reply
2/4block: Use bdrv_make_empty() where possibleblock/replication.c block/vvfat.c+3 -70 replies
3/4block: Add blk_make_empty()block/block-backend.c include/sysemu/block-backend.h+12 -01 reply
4/4block: Use blk_make_empty() after commitsblock/commit.c qemu-img.c+23 -122 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchEric BlakeKevin Wolf
1/4R-b
2/4R-b R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/4] block: Do not call BlockDriver.bdrv_make_empty() directly

v1: https://lists.nongnu.org/archive/html/qemu-block/2020-04/msg01245.html

Branch: https://github.com/XanClic/qemu.git fix-bdrv_make_empty-v2
Branch: https://git.xanclic.moe/XanClic/qemu.git fix-bdrv_make_empty-v2

Based-on: <[email protected]>
(“qcow2: Allow resize of images with internal snapshots”)

Hi,

As described in v1’s cover letter (linked above), this series ensures that all calls to BlockDriver.bdrv_make_empty() go through a wrapper bdrv_make_empty() function that ensures the caller does have the necessary permissions.

Changes in v2 (thanks for the quick reviews, I didn’t expect this series to get attention so quickly :)):
- Added Based-on here in the cover letter [Eric]
- Patch 1: WRITE_UNCHANGED is sufficient [Kevin]
- Patch 3: Check whether blk->root is actually present with blk_is_available() [Kevin]
- Patch 4: Let bdrv_commit() only take the WRITE_UNCHANGED permission, and take it from the moment the @src BB is created and @bs is inserted [Kevin];
then drop the drv->bdrv_make_empty check, just call blk_make_empty() and ignore -ENOTSUP [Eric]

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/4:[0002] [FC] 'block: Add bdrv_make_empty()' 002/4:[----] [--] 'block: Use bdrv_make_empty() where possible' 003/4:[0005] [FC] 'block: Add blk_make_empty()' 004/4:[0020] [FC] 'block: Use blk_make_empty() after commits'

Max Reitz (4):
block: Add bdrv_make_empty()
block: Use bdrv_make_empty() where possible
block: Add blk_make_empty()
block: Use blk_make_empty() after commits

 include/block/block.h          |  1 +
 include/sysemu/block-backend.h |  2 ++
 block.c                        | 23 +++++++++++++++++++++++
 block/block-backend.c          | 10 ++++++++++
 block/commit.c                 | 16 +++++++++-------
 block/replication.c            |  6 ++----
 block/vvfat.c                  |  4 +---
 qemu-img.c                     | 19 ++++++++++++++-----
 8 files changed, 62 insertions(+), 19 deletions(-)
Signature · 1 line
2.25.4