From: John Snow <jsnow@redhat.com>
To: Eric Blake <eblake@redhat.com>, Max Reitz <mreitz@redhat.com>,
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, armbru@redhat.com, famz@redhat.com,
den@openvz.org, stefanha@redhat.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v22 19/30] qcow2: add persistent dirty bitmaps support
Date: Fri, 30 Jun 2017 13:58:55 -0400 [thread overview]
Message-ID: <fc19b4a1-081e-008d-5573-59e29419786f@redhat.com> (raw)
In-Reply-To: <bddd14a1-5d18-58b2-8e4b-8579ad0e7f49@redhat.com>
On 06/30/2017 01:47 PM, Eric Blake wrote:
> On 06/29/2017 09:23 PM, Max Reitz wrote:
>> On 2017-06-30 04:18, Eric Blake wrote:
>>> On 06/28/2017 07:05 AM, Vladimir Sementsov-Ogievskiy wrote:
>>>> Store persistent dirty bitmaps in qcow2 image.
>>>>
>>>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>>>> Reviewed-by: Max Reitz <mreitz@redhat.com>
>>>> ---
>
>>>
>>> This grabs the size (currently in sectors, although I plan to fix it to
>>> be in bytes)...
>>>
>>>> + const char *bm_name = bdrv_dirty_bitmap_name(bitmap);
>>>> + uint8_t *buf = NULL;
>>>> + BdrvDirtyBitmapIter *dbi;
>>>> + uint64_t *tb;
>>>> + uint64_t tb_size =
>>>> + size_to_clusters(s,
>>>> + bdrv_dirty_bitmap_serialization_size(bitmap, 0, bm_size));
>>>
>>> ...then finds out how many bytes are required to serialize the entire
>>> image, where bm_size should be the same as before...
>>>
>>>> + while ((sector = bdrv_dirty_iter_next(dbi)) != -1) {
>>>> + uint64_t cluster = sector / sbc;
>>>> + uint64_t end, write_size;
>>>> + int64_t off;
>>>> +
>>>> + sector = cluster * sbc;
>>>> + end = MIN(bm_size, sector + sbc);
>>>> + write_size =
>>>> + bdrv_dirty_bitmap_serialization_size(bitmap, sector, end - sector);
>>>
>>> But here, rather than tackling the entire image at once, you are
>>> subdividing your queries along arbitrary lines. But nowhere do I see a
>>> call to bdrv_dirty_bitmap_serialization_align() to make sure your
>>> end-sector value is properly aligned; if it is not aligned, you will
>>> trigger an assertion failure here...
>>
>> It's 4:21 am here, so I cannot claim to be right, but if I remember
>> correctly, it will automatically aligned because sbc is the number of
>> bits (and thus sectors) a bitmap cluster covers.
>
> Okay, I re-read the spec. First thing I noticed: we have a potential
> conflict if an image is allowed to be resized:
>
> "All stored bitmaps are related to the virtual disk stored in the same
> image, so each bitmap size is equal to the virtual disk size."
>
> If you resize an image, does the bitmap size have to be adjusted as
> well? What if you create one bitmap, then take an internal snapshot,
> then resize? Or do we declare that (at least for now) the presence of a
> bitmap is incompatible with the use of an internal snapshot?
>
> Conversely, we state that:
>
>
> "Structure of a bitmap directory entry:
> ...
> 8 - 11: bitmap_table_size
> Number of entries in the bitmap table of the bitmap."
>
This is the number of bitmaps stored in the qcow2, not the size of one
particular bitmap.
> Since a bitmap therefore tracks its own size, I think the earlier
> statement that all bitmap sizes are equal to the virtual disk size is
> too strict (there seems to be no technical reason why a bitmap can't
> have a different size that the image).
>
>
> But, having read that, you are correct that we are subdividing our
> bitmaps according to what fits in a qcow2 cluster, and the smallest
> qcow2 cluster we can come up with is 512-bytes (or 4k bits of the
> bitmap). Checking hbitmap.c, we are merely asserting that our alignment
> is always a multiple of 64 << hb->granularity. But since we are
> partitioning a cluster at a time, our minimum alignment will be 512 <<
> hb->granularity, which is always aligned.
>
> So all the more I need to do is add an assertion.
>
>> I'm for fixing it later. I would have announced the series "applied" an
>> hour ago if I hadn't had to bisect iotest 055 breakage...
>
> I'm working it into my v4 posting of dirty-bitmap cleanups.
>
next prev parent reply other threads:[~2017-06-30 17:59 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-28 12:05 [Qemu-devel] [PATCH v22 00/30] qcow2: persistent dirty bitmaps Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 01/30] specs/qcow2: fix bitmap granularity qemu-specific note Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 02/30] specs/qcow2: do not use wording 'bitmap header' Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 03/30] hbitmap: improve dirty iter Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 04/30] tests: add hbitmap iter test Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 05/30] block: fix bdrv_dirty_bitmap_granularity signature Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 06/30] block/dirty-bitmap: add deserialize_ones func Vladimir Sementsov-Ogievskiy
2017-06-30 1:55 ` Eric Blake
2017-06-30 2:01 ` Eric Blake
2017-06-30 17:52 ` John Snow
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 07/30] qcow2-refcount: rename inc_refcounts() and make it public Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 08/30] qcow2: add bitmaps extension Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 09/30] block/dirty-bitmap: fix comment for BlockDirtyBitmap.disabled field Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 10/30] block/dirty-bitmap: add readonly field to BdrvDirtyBitmap Vladimir Sementsov-Ogievskiy
2017-06-30 1:21 ` Max Reitz
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 11/30] qcow2: autoloading dirty bitmaps Vladimir Sementsov-Ogievskiy
2017-06-30 1:35 ` Eric Blake
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 12/30] block: refactor bdrv_reopen_commit Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 13/30] block: new bdrv_reopen_bitmaps_rw interface Vladimir Sementsov-Ogievskiy
2017-06-28 12:10 ` Vladimir Sementsov-Ogievskiy
2017-06-28 12:36 ` Eric Blake
2017-06-28 13:02 ` Vladimir Sementsov-Ogievskiy
2017-06-28 13:13 ` Vladimir Sementsov-Ogievskiy
2017-06-28 13:34 ` Vladimir Sementsov-Ogievskiy
2017-06-28 13:31 ` Paolo Bonzini
2017-06-28 14:36 ` Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 14/30] qcow2: support .bdrv_reopen_bitmaps_rw Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 15/30] block/dirty-bitmap: add autoload field to BdrvDirtyBitmap Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 16/30] block: bdrv_close: release bitmaps after drv->bdrv_close Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 17/30] block: introduce persistent dirty bitmaps Vladimir Sementsov-Ogievskiy
2017-06-30 1:43 ` Eric Blake
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 18/30] block/dirty-bitmap: add bdrv_dirty_bitmap_next() Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 19/30] qcow2: add persistent dirty bitmaps support Vladimir Sementsov-Ogievskiy
2017-06-30 2:18 ` Eric Blake
2017-06-30 2:23 ` Max Reitz
2017-06-30 17:47 ` Eric Blake
2017-06-30 17:58 ` John Snow [this message]
2017-06-30 18:28 ` Eric Blake
2017-07-02 14:01 ` Max Reitz
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 20/30] qcow2: store bitmaps on reopening image as read-only Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 21/30] block: add bdrv_can_store_new_dirty_bitmap Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 22/30] qcow2: add .bdrv_can_store_new_dirty_bitmap Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 23/30] qmp: add persistent flag to block-dirty-bitmap-add Vladimir Sementsov-Ogievskiy
2017-07-07 7:54 ` Markus Armbruster
2017-07-07 8:07 ` Vladimir Sementsov-Ogievskiy
2017-07-07 12:21 ` Vladimir Sementsov-Ogievskiy
2017-07-07 13:25 ` Markus Armbruster
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 24/30] qmp: add autoload parameter " Vladimir Sementsov-Ogievskiy
2017-07-07 7:54 ` Markus Armbruster
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 25/30] qmp: add x-debug-block-dirty-bitmap-sha256 Vladimir Sementsov-Ogievskiy
2017-07-07 8:05 ` Markus Armbruster
2017-07-07 8:13 ` Daniel P. Berrange
2017-07-07 9:00 ` Markus Armbruster
2017-07-07 12:43 ` Vladimir Sementsov-Ogievskiy
2017-07-07 13:53 ` Markus Armbruster
2017-07-07 20:57 ` John Snow
2017-07-10 6:49 ` Markus Armbruster
2017-07-10 16:29 ` John Snow
2017-07-07 12:30 ` [Qemu-devel] [Qemu-block] " Eric Blake
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 26/30] iotests: test qcow2 persistent dirty bitmap Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 27/30] block/dirty-bitmap: add bdrv_remove_persistent_dirty_bitmap Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 28/30] qcow2: add .bdrv_remove_persistent_dirty_bitmap Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 29/30] qmp: block-dirty-bitmap-remove: remove persistent Vladimir Sementsov-Ogievskiy
2017-06-28 12:05 ` [Qemu-devel] [PATCH v22 30/30] block: release persistent bitmaps on inactivate Vladimir Sementsov-Ogievskiy
2017-06-28 13:01 ` [Qemu-devel] [PATCH v22 00/30] qcow2: persistent dirty bitmaps Paolo Bonzini
2017-06-28 13:53 ` Vladimir Sementsov-Ogievskiy
2017-06-29 21:16 ` John Snow
2017-06-30 2:38 ` Max Reitz
2017-11-17 16:04 ` Eric Blake
2017-11-17 16:17 ` Vladimir Sementsov-Ogievskiy
2017-11-17 16:56 ` Eric Blake
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=fc19b4a1-081e-008d-5573-59e29419786f@redhat.com \
--to=jsnow@redhat.com \
--cc=armbru@redhat.com \
--cc=den@openvz.org \
--cc=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--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).