bitmaps patches for 2020-05-18
The following changes since commit f2465433b43fb87766d79f42191607dac4aed5b4:
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2020-05-19 13:42:58 +0100)
are available in the Git repository at:
https://repo.or.cz/qemu/ericb.git tags/pull-bitmaps-2020-05-18-v2
for you to fetch changes up to d4d42c8202261ec770bef614220742af9dfe3d81:
qemu-img: Add bitmap sub-command (2020-05-19 10:41:34 -0500)
v2: resolve semantic conflict with commit 43d589b0, only sending changed patch
----------------------------------------------------------------
bitmaps patches for 2020-05-18
- update bitmaps maintainers
- add 'qemu-img bitmap' subcommand
----------------------------------------------------------------
Eric Blake (7):
bitmaps: Update maintainer
docs: Sort sections on qemu-img subcommand parameters
qemu-img: Fix stale comments on doc location
block: Make it easier to learn which BDS support bitmaps
blockdev: Promote several bitmap functions to non-static
blockdev: Split off basic bitmap operations for qemu-img
qemu-img: Add bitmap sub-command
docs/tools/qemu-img.rst | 72 ++++++--- Makefile.objs | 3 +- block/qcow2.h | 1 + include/block/block_int.h | 13 ++ include/block/dirty-bitmap.h | 1 + block/dirty-bitmap.c | 9 ++ block/monitor/bitmap-qmp-cmds.c | 321 ++++++++++++++++++++++++++++++++++++++++ block/qcow2-bitmap.c | 7 + block/qcow2.c | 2 + blockdev.c | 303 +------------------------------------ qemu-img.c | 251 ++++++++++++++++++++++++++++++- MAINTAINERS | 8 +- block/monitor/Makefile.objs | 1 + qemu-img-cmds.hx | 9 +- 14 files changed, 672 insertions(+), 329 deletions(-) create mode 100644 block/monitor/bitmap-qmp-cmds.c
Signature · 1 line
2.26.2
[PULL v2 7/7] qemu-img: Add bitmap sub-command
Include actions for --add, --remove, --clear, --enable, --disable, and --merge (note that --clear is a bit of fluff, because the same can be accomplished by removing a bitmap and then adding a new one in its place, but it matches what QMP commands exist). Listing is omitted, because it does not require a bitmap name and because it was already possible with 'qemu-img info'. A single command line can play one or more bitmap commands in sequence on the same bitmap name (although all added bitmaps share the same granularity, and and all merged bitmaps come from the same source file). Merge defaults to other bitmaps in the primary image, but can also be told to merge bitmaps from a distinct image.
While this supports --image-opts for the file being modified, I did not think it worth the extra complexity to support that for the source file in a cross-file merges. Likewise, I chose to have --merge only take a single source rather than following the QMP support for multiple merges in one go (although you can still use more than one --merge in the command line); in part because qemu-img is offline and therefore atomicity is not an issue.
Upcoming patches will add iotest coverage of these commands while also testing other features.
Message-Id: <[email protected]>
--- docs/tools/qemu-img.rst | 24 ++++ qemu-img.c | 249 ++++++++++++++++++++++++++++++++++++++++ qemu-img-cmds.hx | 7 ++ 3 files changed, 280 insertions(+)
docs/tools/qemu-img.rst +24 -0
@@ -281,6 +281,30 @@ Command description: For write tests, by default a buffer filled with zeros is written. This can be overridden with a pattern byte specified by *PATTERN*. +.. option:: bitmap (--merge SOURCE | --add | --remove | --clear | --enable | --disable)... [-b SOURCE_FILE [-F SOURCE_FMT]] [-g GRANULARITY] [--object OBJECTDEF] [--image-opts | -f FMT] FILENAME BITMAP + + Perform one or more modifications of the persistent bitmap *BITMAP* + in the disk image *FILENAME*. The various modifications are: + + ``--add`` to create *BITMAP*, enabled to record future edits. + + ``--remove`` to remove *BITMAP*. + + ``--clear`` to clear *BITMAP*. + + ``--enable`` to change *BITMAP* to start recording future edits. + + ``--disable`` to change *BITMAP* to stop recording future edits. + + ``--merge`` to merge the contents of *SOURCE_BITMAP* into *BITMAP*. + + Additional options include ``-g`` which sets a non-default + *GRANULARITY* for ``--add``, and ``-b`` and ``-F`` which select an + alternative source file for all *SOURCE* bitmaps used by + ``--merge``. + + To see what bitmaps are present in an image, use ``qemu-img info``. + .. option:: check [--object OBJECTDEF] [--image-opts] [-q] [-f FMT] [--output=OFMT] [-r [leaks | all]] [-T SRC_CACHE] [-U] FILENAME Perform a consistency check on the disk image *FILENAME*. The command can
qemu-img.c +249 -0
273 lines not on this page · raw message
qemu-img-cmds.hx +7 -0
@@ -20,6 +20,13 @@ DEF("bench", img_bench, SRST .. option:: bench [-c COUNT] [-d DEPTH] [-f FMT] [--flush-interval=FLUSH_INTERVAL] [-i AIO] [-n] [--no-drain] [-o OFFSET] [--pattern=PATTERN] [-q] [-s BUFFER_SIZE] [-S STEP_SIZE] [-t CACHE] [-w] [-U] FILENAME ERST + +DEF("bitmap", img_bitmap, + "bitmap (--merge SOURCE | --add | --remove | --clear | --enable | --disable)... [-b source_file [-F source_fmt]] [-g granularity] [--object objectdef] [--image-opts | -f fmt] filename bitmap") +SRST +.. option:: bitmap (--merge SOURCE | --add | --remove | --clear | --enable | --disable)... [-b SOURCE_FILE [-F SOURCE_FMT]] [-g GRANULARITY] [--object OBJECTDEF] [--image-opts | -f FMT] FILENAME BITMAP +ERST + DEF("check", img_check, "check [--object objectdef] [--image-opts] [-q] [-f fmt] [--output=ofmt] [-r [leaks | all]] [-T src_cache] [-U] filename") SRST
Signature · 1 line
2.26.2
Re: [PULL v2 7/7] qemu-img: Add bitmap sub-command
qemu-img.c out: · line 4597
Quoted 9 lines · Eric Blake
Include actions for --add, --remove, --clear, --enable, --disable, and --merge (note that --clear is a bit of fluff, because the same can be
qemu-img.c +6
-0+case 'g' : + granularity =cvtnum (optarg); +if (granularity <0 ) { +error_report ("Invalid granularity specified" ); +return 1 ; + }
Phooey. I forgot to commit my changes before creating the tag. v3 pull request coming up :(
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PULL v2 7/7] qemu-img: Add bitmap sub-command
Quoted 4 lines · Eric Blake
Quoted 2 lines · Eric Blake
Include actions for --add, --remove, --clear, --enable, --disable, and --merge (note that --clear is a bit of fluff, because the same can be
Quoted 8 lines
Quoted 6 lines
+ case 'g':
+ granularity = cvtnum(optarg);
+ if (granularity < 0) {
+error_report("Invalid granularity specified"); + return 1;
+ }Phooey. I forgot to commit my changes before creating the tag. v3 pull request coming up :(
For the record, I've now made it harder for myself to repeat this mistake, by doing:
$ cat > .git/hooks/sendemail-validate <<\EOF
#!/bin/sh
git diff-files --quiet --ignore-submodules -- ||
{ echo "You have unstaged changes."; exit 1; }
git diff-index --cached --quiet HEAD --ignore-submodules -- ||
{ echo "Your index contains uncommitted changes."; exit 1; }
$ chmod +x .git/hooks/sendemail-validate[thanks to John Snow for advice on IRC]
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org