From: John Snow <jsnow@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH 07/12] qcow2-bitmap: add basic bitmaps info
Date: Wed, 16 May 2018 17:17:03 -0400 [thread overview]
Message-ID: <a168ef12-19ae-0eec-a447-11f04d2b7e56@redhat.com> (raw)
In-Reply-To: <453c0511-0114-49f9-07e1-3eb63c06cf6c@virtuozzo.com>
On 05/14/2018 11:12 AM, Vladimir Sementsov-Ogievskiy wrote:
> 12.05.2018 04:25, John Snow wrote:
>> Add functions for querying the basic information inside of bitmaps.
>> Restructure the bitmaps flags masks to facilitate providing a list of
>> flags belonging to the bitmap(s) being queried.
>>
>> Signed-off-by: John Snow <jsnow@redhat.com>
>> ---
>> block/qcow2-bitmap.c | 81
>> ++++++++++++++++++++++++++++++++++++++++++++++++++--
>> block/qcow2.c | 7 +++++
>> block/qcow2.h | 1 +
>> 3 files changed, 87 insertions(+), 2 deletions(-)
>>
>> diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
>> index 60e01abfd7..811b82743a 100644
>> --- a/block/qcow2-bitmap.c
>> +++ b/block/qcow2-bitmap.c
>> @@ -49,8 +49,28 @@
>> /* Bitmap directory entry flags */
>> #define BME_RESERVED_FLAGS 0xfffffffcU
>> -#define BME_FLAG_IN_USE (1U << 0)
>> -#define BME_FLAG_AUTO (1U << 1)
>> +
>> +enum BME_FLAG_BITS {
>> + BME_FLAG_BIT__BEGIN = 0,
>> + BME_FLAG_BIT_IN_USE = BME_FLAG_BIT__BEGIN,
>> + BME_FLAG_BIT_AUTO = 1,
>> + BME_FLAG_BIT_EXTRA = 2,
>> + BME_FLAG_BIT__MAX,
>> +};
>> +
>> +#define BME_FLAG_IN_USE (1U << BME_FLAG_BIT_IN_USE)
>> +#define BME_FLAG_AUTO (1U << BME_FLAG_BIT_AUTO)
>> +#define BME_FLAG_EXTRA (1U << BME_FLAG_BIT_EXTRA)
>> +
>> +/* Correlate canonical spec values to autogenerated QAPI values */
>> +struct {
>> + uint32_t mask;
>
> mask is unused in this patch
>
>> + int qapi_value;
>> +} BMEFlagMap[BME_FLAG_BIT__MAX] = {
>> + [BME_FLAG_BIT_IN_USE] = { BME_FLAG_IN_USE,
>> BITMAP_FLAG_ENUM_IN_USE },
>> + [BME_FLAG_BIT_AUTO] = { BME_FLAG_AUTO, BITMAP_FLAG_ENUM_AUTO },
>> + [BME_FLAG_BIT_EXTRA] = { BME_FLAG_EXTRA,
>> BITMAP_FLAG_ENUM_EXTRA_DATA_COMPATIBLE },
>> +};
>> /* bits [1, 8] U [56, 63] are reserved */
>> #define BME_TABLE_ENTRY_RESERVED_MASK 0xff000000000001feULL
>> @@ -663,6 +683,63 @@ static void del_bitmap_list(BlockDriverState *bs)
>> }
>> }
>> +static BitmapFlagEnumList *get_bitmap_flags(uint32_t flags)
>> +{
>> + int i;
>> + BitmapFlagEnumList *flist = NULL;
>> + BitmapFlagEnumList *ftmp;
>> +
>> + while (flags) {
>> + i = ctz32(flags);
>> + ftmp = g_new0(BitmapFlagEnumList, 1);
>> + if (i >= BME_FLAG_BIT__BEGIN && i < BME_FLAG_BIT__MAX) {
>> + ftmp->value = BMEFlagMap[i].qapi_value;
>> + } else {
>> + ftmp->value = BITMAP_FLAG_ENUM_UNKNOWN;
>
> so, there may be several "unknown" entries. It's inconsistent with
> "@unknown: This bitmap has unknown or reserved properties.".
>
> Finally, can we export values for unknown flags? It should be more
> informative.
>
I changed my mind -- qemu-img is not a debugging tool and shouldn't get
lost in the weeds trying to enumerate the different kinds of reserved
values that are set.
It's an error to have them set, or not -- which ones specifically is not
information that an end-user need know or care about, and I don't want
to create an extra structure to contain the value.
I'm going to rewrite this loop to just only ever have one unknown value
at a maximum.
--js
next prev parent reply other threads:[~2018-05-16 21:17 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-12 1:25 [Qemu-devel] [RFC PATCH 00/12] qemu-img: add bitmap queries John Snow
2018-05-12 1:25 ` [Qemu-devel] [RFC PATCH 01/12] qcow2-bitmap: cache bm_list John Snow
2018-05-14 11:55 ` Vladimir Sementsov-Ogievskiy
2018-05-14 12:15 ` Vladimir Sementsov-Ogievskiy
2018-05-15 20:38 ` John Snow
2018-05-15 20:27 ` John Snow
2018-05-12 1:25 ` [Qemu-devel] [RFC PATCH 02/12] qcow2/dirty-bitmap: cache loaded bitmaps John Snow
2018-05-14 12:33 ` Vladimir Sementsov-Ogievskiy
2018-05-12 1:25 ` [Qemu-devel] [RFC PATCH 03/12] block/qcow2-bitmap: avoid adjusting bm->flags for RO bitmaps John Snow
2018-05-14 12:44 ` Vladimir Sementsov-Ogievskiy
2018-05-15 20:59 ` John Snow
2018-05-12 1:25 ` [Qemu-devel] [RFC PATCH 04/12] qcow2/dirty-bitmaps: load IN_USE bitmaps if disk is RO John Snow
2018-05-14 12:55 ` Vladimir Sementsov-Ogievskiy
2018-05-15 20:52 ` John Snow
2018-05-12 1:25 ` [Qemu-devel] [RFC PATCH 05/12] qcow2-bitmap: track bitmap type John Snow
2018-05-12 1:25 ` [Qemu-devel] [RFC PATCH 06/12] qapi: add bitmap info John Snow
2018-05-14 14:30 ` Vladimir Sementsov-Ogievskiy
2018-05-15 20:56 ` John Snow
2018-05-16 21:15 ` John Snow
2018-05-17 10:01 ` Vladimir Sementsov-Ogievskiy
2018-05-17 16:43 ` John Snow
2018-05-12 1:25 ` [Qemu-devel] [RFC PATCH 07/12] qcow2-bitmap: add basic bitmaps info John Snow
2018-05-14 15:12 ` Vladimir Sementsov-Ogievskiy
2018-05-15 21:03 ` John Snow
2018-05-16 21:17 ` John Snow [this message]
2018-05-17 10:03 ` Vladimir Sementsov-Ogievskiy
2018-05-12 1:25 ` [Qemu-devel] [RFC PATCH 08/12] qjson: allow caller to ask for arbitrary indent John Snow
2018-05-16 21:34 ` Eric Blake
2018-05-16 21:49 ` John Snow
2018-05-12 1:25 ` [Qemu-devel] [RFC PATCH 09/12] qapi/block-core: add BitmapMapping and BitmapEntry structs John Snow
2018-05-16 21:37 ` Eric Blake
2018-05-16 21:55 ` John Snow
2018-05-12 1:25 ` [Qemu-devel] [RFC PATCH 10/12] qemu-img: split off common chunk of map command John Snow
2018-05-12 1:25 ` [Qemu-devel] [RFC PATCH 11/12] qemu-img: add bitmap dump John Snow
2018-05-12 1:25 ` [Qemu-devel] [RFC PATCH 12/12] qemu-img: add bitmap clear John Snow
2018-05-12 1:38 ` [Qemu-devel] [RFC PATCH 00/12] qemu-img: add bitmap queries no-reply
2018-05-14 11:32 ` Vladimir Sementsov-Ogievskiy
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=a168ef12-19ae-0eec-a447-11f04d2b7e56@redhat.com \
--to=jsnow@redhat.com \
--cc=armbru@redhat.com \
--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).