From: Eric Blake <eblake@redhat.com>
To: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>,
qemu-block@nongnu.org
Cc: kwolf@redhat.com, den@openvz.org, vsementsov@virtuozzo.com,
qemu-devel@nongnu.org, mreitz@redhat.com
Subject: Re: [PATCH v3 4/6] iotests: Dump bitmap directory info with qcow2.py
Date: Tue, 2 Jun 2020 12:35:59 -0500 [thread overview]
Message-ID: <b9b51392-055e-d947-7ca0-91878f817587@redhat.com> (raw)
In-Reply-To: <1591019293-211155-5-git-send-email-andrey.shinkevich@virtuozzo.com>
On 6/1/20 8:48 AM, Andrey Shinkevich wrote:
> Read and dump entries from the bitmap directory of QCOW2 image with the
> script qcow2.py.
>
> Header extension: Bitmaps
> ...
> Bitmap name bitmap-1
> flag auto
> bitmap_table_offset 0xf0000
> bitmap_table_size 8
> flag_bits 2
> type 1
> granularity_bits 16
> name_size 8
> extra_data_size 0
>
> Suggested-by: Kevin Wolf <kwolf@redhat.com>
> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
> ---
> tests/qemu-iotests/qcow2.py | 104 +++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 103 insertions(+), 1 deletion(-)
>
> + self.bitmap_flags = []
> + BME_FLAG_IN_USE = 1
> + BME_FLAG_AUTO = 1 << 1
Would it be worth using '1 << 0' for BME_FLAG_IN_USE, to make it obvious
that these are consecutive bits, especially if we later add a third bit?
> + for n in range(self.nb_bitmaps):
> + buf = fd.read(buf_size)
> + dir_entry = Qcow2BitmapDirEntry(buf)
> + fd.seek(dir_entry.extra_data_size, 1)
> + bitmap_name = fd.read(dir_entry.name_size)
> + dir_entry.name = bitmap_name.decode('ascii')
> + self.bitmaps.append(dir_entry)
> + entry_raw_size = dir_entry.bitmap_dir_entry_raw_size()
> + shift = ((entry_raw_size + 7) & ~7) - entry_raw_size
> + fd.seek(shift, 1)
Is there a symbolic constant instead of the magic '1' for fd.seek()?
> @@ -157,7 +256,10 @@ class QcowHeader:
> else:
> padded = (length + 7) & ~7
> data = fd.read(padded)
> - self.extensions.append(QcowHeaderExtension(magic, length, data))
> + self.extensions.append(QcowHeaderExtension(magic, length,
> + data))
Should this reformatting be done earlier in the series to minimize churn?
> + for ex in self.extensions:
> + ex.load(fd)
>
> def update_extensions(self, fd):
>
>
Fixing the things I pointed out does not seem major, so
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2020-06-02 17:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-01 13:48 [PATCH v3 0/6] iotests: Dump QCOW2 dirty bitmaps metadata Andrey Shinkevich
2020-06-01 13:48 ` [PATCH v3 1/6] iotests: Add extension names to qcow2.py dump Andrey Shinkevich
2020-06-02 16:05 ` Eric Blake
2020-06-02 16:07 ` Eric Blake
2020-06-02 19:25 ` Vladimir Sementsov-Ogievskiy
2020-06-01 13:48 ` [PATCH v3 2/6] iotests: move check for printable data to QcowHeaderExtension class Andrey Shinkevich
2020-06-02 16:14 ` Eric Blake
2020-06-02 19:32 ` Vladimir Sementsov-Ogievskiy
2020-06-01 13:48 ` [PATCH v3 3/6] iotests: dump bitmap extension data with qcow2.py Andrey Shinkevich
2020-06-02 16:16 ` Eric Blake
2020-06-02 20:10 ` Vladimir Sementsov-Ogievskiy
2020-06-01 13:48 ` [PATCH v3 4/6] iotests: Dump bitmap directory info " Andrey Shinkevich
2020-06-02 17:35 ` Eric Blake [this message]
2020-06-02 21:15 ` Vladimir Sementsov-Ogievskiy
2020-06-01 13:48 ` [PATCH v3 5/6] iotests: Dump bitmap table entries serialized in QCOW2 image Andrey Shinkevich
2020-06-02 17:38 ` Eric Blake
2020-06-02 21:26 ` Vladimir Sementsov-Ogievskiy
2020-06-01 13:48 ` [PATCH v3 6/6] iotests: Dump QCOW2 image metadata in JSON format with qcow2.py Andrey Shinkevich
2020-06-02 17:40 ` Eric Blake
2020-06-02 21:36 ` Vladimir Sementsov-Ogievskiy
2020-06-01 21:46 ` [PATCH v3 0/6] iotests: Dump QCOW2 dirty bitmaps metadata Eric Blake
2020-06-04 7:54 ` Andrey Shinkevich
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=b9b51392-055e-d947-7ca0-91878f817587@redhat.com \
--to=eblake@redhat.com \
--cc=andrey.shinkevich@virtuozzo.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).