mbox series

[RFC,00/12] qemu-img: add bitmap queries

Message ID 20180512012537.22478-1-jsnow@redhat.com
Headers show
Series qemu-img: add bitmap queries | expand

Message

John Snow May 12, 2018, 1:25 a.m. UTC
Allow qemu-img to show information about bitmaps stored in qcow2 images.
Add a 'bitmap' meta-command with 'dump' sub-command to retrieve a list of
dirty regions in bitmaps stored in a qcow2 image.

RFC:
- I am not 1000% convinced the bm_list caching is perfectly safe,
  especially with respect to migration and inactivation. There are
  more efficiencies and tweaks I can make, but I think this is the
  minimal set.

- I decided not to gate bitmap info in the "info" command behind
  extra flags.

- Bitmap data-gathering in "bitmap dump" could be made more
  space-efficient by just reporting one segment at a time,
  probably.

- `bitmap rm` and `bitmap mk` need extra work, so I am not submitting
  them just yet: rm needs more work around the remove persistence API,
  and make needs more work around the "can add" API.

- None of these commands will work with "in use" bitmaps; we need
  qemu-img check -r bitmaps support for this. I'm not sure what the
  right behavior to "fix" in-use bitmaps should be:
        - Cleared: This might be dangerous.
        - Fully Set: This is safer, but stupid.
        - Deleted: This might be the best option.
        - Un-set in-use: VERY dangerous; would rather not.

John Snow (12):
  qcow2-bitmap: cache bm_list
  qcow2/dirty-bitmap: cache loaded bitmaps
  block/qcow2-bitmap: avoid adjusting bm->flags for RO bitmaps
  qcow2/dirty-bitmaps: load IN_USE bitmaps if disk is RO
  qcow2-bitmap: track bitmap type
  qapi: add bitmap info
  qcow2-bitmap: add basic bitmaps info
  qjson: allow caller to ask for arbitrary indent
  qapi/block-core: add BitmapMapping and BitmapEntry structs
  qemu-img: split off common chunk of map command
  qemu-img: add bitmap dump
  qemu-img: add bitmap clear

 block/qcow2-bitmap.c     | 220 +++++++++++++++++--------
 block/qcow2.c            |   9 +
 block/qcow2.h            |   3 +
 include/qapi/qmp/qjson.h |   1 +
 qapi/block-core.json     |  92 ++++++++++-
 qemu-img-cmds.hx         |   6 +
 qemu-img.c               | 419 +++++++++++++++++++++++++++++++++++++----------
 qobject/qjson.c          |  21 +--
 8 files changed, 612 insertions(+), 159 deletions(-)

Comments

no-reply@patchew.org May 12, 2018, 1:38 a.m. UTC | #1
Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20180512012537.22478-1-jsnow@redhat.com
Subject: [Qemu-devel] [RFC PATCH 00/12] qemu-img: add bitmap queries

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]               patchew/20180512012537.22478-1-jsnow@redhat.com -> patchew/20180512012537.22478-1-jsnow@redhat.com
Switched to a new branch 'test'
98c78cde32 qemu-img: add bitmap clear
64b46d376f qemu-img: add bitmap dump
e820e6d20d qemu-img: split off common chunk of map command
15894bec9b qapi/block-core: add BitmapMapping and BitmapEntry structs
a09d1c3a65 qjson: allow caller to ask for arbitrary indent
384e244766 qcow2-bitmap: add basic bitmaps info
35cf9ace22 qapi: add bitmap info
36be89af25 qcow2-bitmap: track bitmap type
d347564ea3 qcow2/dirty-bitmaps: load IN_USE bitmaps if disk is RO
c554bff42b block/qcow2-bitmap: avoid adjusting bm->flags for RO bitmaps
9d00c36fba qcow2/dirty-bitmap: cache loaded bitmaps
7f34c78783 qcow2-bitmap: cache bm_list

=== OUTPUT BEGIN ===
Checking PATCH 1/12: qcow2-bitmap: cache bm_list...
Checking PATCH 2/12: qcow2/dirty-bitmap: cache loaded bitmaps...
Checking PATCH 3/12: block/qcow2-bitmap: avoid adjusting bm->flags for RO bitmaps...
Checking PATCH 4/12: qcow2/dirty-bitmaps: load IN_USE bitmaps if disk is RO...
Checking PATCH 5/12: qcow2-bitmap: track bitmap type...
Checking PATCH 6/12: qapi: add bitmap info...
Checking PATCH 7/12: qcow2-bitmap: add basic bitmaps info...
WARNING: line over 80 characters
#43: FILE: block/qcow2-bitmap.c:72:
+    [BME_FLAG_BIT_EXTRA]  = { BME_FLAG_EXTRA,  BITMAP_FLAG_ENUM_EXTRA_DATA_COMPATIBLE },

total: 0 errors, 1 warnings, 118 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 8/12: qjson: allow caller to ask for arbitrary indent...
Checking PATCH 9/12: qapi/block-core: add BitmapMapping and BitmapEntry structs...
Checking PATCH 10/12: qemu-img: split off common chunk of map command...
WARNING: line over 80 characters
#74: FILE: qemu-img.c:2781:
+                error_report("--output must be used with human or json as argument.");

ERROR: open brace '{' following function declarations go on the next line
#127: FILE: qemu-img.c:2816:
+static void parse_unexpected(int argc, char *argv[]) {

total: 1 errors, 1 warnings, 173 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 11/12: qemu-img: add bitmap dump...
ERROR: space prohibited after that '*' (ctx:BxW)
#179: FILE: qemu-img.c:3029:
+    int (* handler)(BlockDriverState *b, BitmapOpts *opts);
          ^

total: 1 errors, 0 warnings, 203 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 12/12: qemu-img: add bitmap clear...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Vladimir Sementsov-Ogievskiy May 14, 2018, 11:32 a.m. UTC | #2
12.05.2018 04:25, John Snow wrote:
> Allow qemu-img to show information about bitmaps stored in qcow2 images.
> Add a 'bitmap' meta-command with 'dump' sub-command to retrieve a list of
> dirty regions in bitmaps stored in a qcow2 image.
>
> RFC:
> - I am not 1000% convinced the bm_list caching is perfectly safe,
>    especially with respect to migration and inactivation. There are
>    more efficiencies and tweaks I can make, but I think this is the
>    minimal set.
>
> - I decided not to gate bitmap info in the "info" command behind
>    extra flags.
>
> - Bitmap data-gathering in "bitmap dump" could be made more
>    space-efficient by just reporting one segment at a time,
>    probably.
>
> - `bitmap rm` and `bitmap mk` need extra work, so I am not submitting
>    them just yet: rm needs more work around the remove persistence API,
>    and make needs more work around the "can add" API.
>
> - None of these commands will work with "in use" bitmaps; we need
>    qemu-img check -r bitmaps support for this. I'm not sure what the
>    right behavior to "fix" in-use bitmaps should be:
>          - Cleared: This might be dangerous.
>          - Fully Set: This is safer, but stupid.
>          - Deleted: This might be the best option.

I think it's the only valid option.

>          - Un-set in-use: VERY dangerous; would rather not.
>
> John Snow (12):
>    qcow2-bitmap: cache bm_list
>    qcow2/dirty-bitmap: cache loaded bitmaps
>    block/qcow2-bitmap: avoid adjusting bm->flags for RO bitmaps
>    qcow2/dirty-bitmaps: load IN_USE bitmaps if disk is RO
>    qcow2-bitmap: track bitmap type
>    qapi: add bitmap info
>    qcow2-bitmap: add basic bitmaps info
>    qjson: allow caller to ask for arbitrary indent
>    qapi/block-core: add BitmapMapping and BitmapEntry structs
>    qemu-img: split off common chunk of map command
>    qemu-img: add bitmap dump
>    qemu-img: add bitmap clear
>
>   block/qcow2-bitmap.c     | 220 +++++++++++++++++--------
>   block/qcow2.c            |   9 +
>   block/qcow2.h            |   3 +
>   include/qapi/qmp/qjson.h |   1 +
>   qapi/block-core.json     |  92 ++++++++++-
>   qemu-img-cmds.hx         |   6 +
>   qemu-img.c               | 419 +++++++++++++++++++++++++++++++++++++----------
>   qobject/qjson.c          |  21 +--
>   8 files changed, 612 insertions(+), 159 deletions(-)
>