From: Eric Blake <eblake@redhat.com>
To: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: kwolf@redhat.com, mreitz@redhat.com, armbru@redhat.com,
den@openvz.org, vsementsov@virtuozzo.com
Subject: Re: [Qemu-devel] [PATCH] qemu-img info lists bitmap directory entries
Date: Tue, 27 Nov 2018 16:44:58 -0600 [thread overview]
Message-ID: <5f0a48b9-f735-4b70-6ebf-d83f4da90736@redhat.com> (raw)
In-Reply-To: <1543322466-525229-1-git-send-email-andrey.shinkevich@virtuozzo.com>
On 11/27/18 6:41 AM, Andrey Shinkevich wrote:
> The 'Format specific information' of qemu-img info command will show
> the name, flags and granularity for every QCOW2 bitmap.
>
> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
> ---
> Dear colleagues,
>
> With this patch, qemu-img info will display a name, flags and granularity
> information for every bitmap in the directory section of a QCOW2 image.
> That information appears in the 'Format specific information' section as
> it's shown in the following example:
>
> image: /vz/vmprivate/VM1/harddisk.hdd
> file format: qcow2
> virtual size: 64G (68719476736 bytes)
> disk size: 3.0M
> cluster_size: 1048576
> Format specific information:
> compat: 1.1
> lazy refcounts: true
> refcount bits: 16
> dirty bitmaps:
> [0]:
> flags:
> [0]: in-use
> [1]: auto
> name: {257b5ea5-38c5-410e-a457-71c76f763c60}
> granularity: 65536
> [1]:
> flags:
> [0]: in-use
> [1]: auto
> name: back-up
> granularity: 65536
> corrupt: false
This example is worth including in the commit message proper (by putting
it above the Signed-off-by and --- lines).
In addition to Vladimir's review (he's correct about using 4.0),
> +++ b/block/qcow2-bitmap.c
> @@ -1008,6 +1008,56 @@ fail:
> return false;
> }
>
> +static Qcow2BitmapInfoFlagsList *get_bitmap_info_flags(uint32_t flags)
> +{
> + Qcow2BitmapInfoFlagsList *list = NULL;
> + Qcow2BitmapInfoFlagsList **plist = &list;
> +
> + if (flags & BME_FLAG_IN_USE) {
> + Qcow2BitmapInfoFlagsList *entry = g_new0(Qcow2BitmapInfoFlagsList, 1);
> + entry->value = QCOW2_BITMAP_INFO_FLAGS_IN_USE;
> + *plist = entry;
> + plist = &entry->next;
> + }
> + if (flags & BME_FLAG_AUTO) {
> + Qcow2BitmapInfoFlagsList *entry = g_new0(Qcow2BitmapInfoFlagsList, 1);
> + entry->value = QCOW2_BITMAP_INFO_FLAGS_AUTO;
> + *plist = entry;
> + }
> + return list;
> +}
This implementation means that qemu won't report bits that are set but
which qemu doesn't recognize. Is that a problem? I wouldn't
over-engineer it unless we have a use case, but maybe one way would be
to have an optional integer field alongside the array of known flags,
where the integer is present only if there are unrecognized flags
present. But by the time we encounter an image with more than the two
flags we currently recognize, we may have also patched this code to
recognize a new flag.
> @@ -4279,6 +4287,8 @@ static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs)
> QCOW2_INCOMPAT_CORRUPT,
> .has_corrupt = true,
> .refcount_bits = s->refcount_bits,
> + .has_bitmaps = bitmaps ? true : false,
This looks awkward; I'd write it ' = !!bitmaps'.
> +++ b/qapi/block-core.json
> @@ -77,7 +77,8 @@
> '*lazy-refcounts': 'bool',
> '*corrupt': 'bool',
> 'refcount-bits': 'int',
> - '*encrypt': 'ImageInfoSpecificQCow2Encryption'
> + '*encrypt': 'ImageInfoSpecificQCow2Encryption',
> + '*bitmaps': ['Qcow2BitmapInfo']
Missing documentation on the new member, including a '(since 4.0)' tag.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
prev parent reply other threads:[~2018-11-27 22:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-27 12:41 [Qemu-devel] [PATCH] qemu-img info lists bitmap directory entries Andrey Shinkevich
2018-11-27 13:12 ` Vladimir Sementsov-Ogievskiy
2018-11-27 13:36 ` Andrey Shinkevich
2018-11-27 22:44 ` Eric Blake [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5f0a48b9-f735-4b70-6ebf-d83f4da90736@redhat.com \
--to=eblake@redhat.com \
--cc=andrey.shinkevich@virtuozzo.com \
--cc=armbru@redhat.com \
--cc=den@openvz.org \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).