From: Kevin Wolf <kwolf@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, jsnow@redhat.com,
vsementsov@virtuozzo.com, qemu-block@nongnu.org,
Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v8 18/20] qcow2: Switch store_bitmap_data() to byte-based iteration
Date: Wed, 20 Sep 2017 08:22:44 +0200 [thread overview]
Message-ID: <20170920062244.GA4730@localhost.localdomain> (raw)
In-Reply-To: <ef350240-dbe3-e91a-ac1c-734a0c5d24f1@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2313 bytes --]
Am 19.09.2017 um 21:42 hat Eric Blake geschrieben:
> However...
>
> >> - sbc = limit >> BDRV_SECTOR_BITS;
> >> assert(DIV_ROUND_UP(bm_size, limit) == tb_size);
> >>
> >> - while ((sector = bdrv_dirty_iter_next(dbi) >> BDRV_SECTOR_BITS) >= 0) {
> >> - uint64_t cluster = sector / sbc;
> >> + while ((offset = bdrv_dirty_iter_next(dbi)) >= 0) {
> >> + uint64_t cluster = offset / limit;
>
> bdrv_dirty_iter_next() returns the next dirty bit (which is not
> necessarily the first bit in the cluster). For the purposes of
> serialization, we want to serialize the entire cluster in one go, even
> though we will be serializing 0 bits up until the first dirty bit. So
> offset at this point may be unaligned,
Ok, this is the part that I was missing. It makes a lot more sense now.
Also, I think 'cluster' meaning bitmap clusters and not qcow2 clusters
here confused me a bit.
> > The part that I'm missing yet is why we need to do it. The bitmap
> > granularity is also the granularity of bdrv_dirty_iter_next(), so isn't
> > offset already aligned and we could even assert that instead of aligning
> > down? (As long we enforce our restriction, which we seem to do in
> > bitmap_list_load().)
>
> Sadly, a quick:
> [...]
> does NOT fail iotests 165, which appears to be the only test that
> actually hammers on qcow2 bitmaps (changing it to an 'assert(false)'
> only shows an effect on 165) - which means our test is NOT exercising
> all possible alignments. And it's python-based, with lame output, which
> makes debugging it painful. But never fear, for v9 I will improve the
> test to actually affect the bitmap at a point that would fail with my
> temporary assertion in place, and thus proving that we DO need to align
> down. Note that test 165 is testing only a 1G image, but I just showed
> that 64k clusters with 64k granularity covers up to 32G of image space
> in one cluster of the bitmap, so the test is only covering one cluster
> of serialization in the first place, and as written, the test is
> dirtying byte 0, which explains why it happens to get an offset aligned
> to limit, even though that is not a valid assertion.
More tests are always welcome and a good argument for getting a series
merged. :-)
Kevin
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
next prev parent reply other threads:[~2017-09-20 6:22 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-18 18:57 [Qemu-devel] [PATCH v8 00/20] make dirty-bitmap byte-based Eric Blake
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 01/20] block: Make bdrv_img_create() size selection easier to read Eric Blake
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 02/20] hbitmap: Rename serialization_granularity to serialization_align Eric Blake
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 03/20] qcow2: Ensure bitmap serialization is aligned Eric Blake
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 04/20] dirty-bitmap: Drop unused functions Eric Blake
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 05/20] dirty-bitmap: Avoid size query failure during truncate Eric Blake
2017-09-19 9:17 ` Fam Zheng
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 06/20] dirty-bitmap: Change bdrv_dirty_bitmap_size() to report bytes Eric Blake
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 07/20] dirty-bitmap: Track bitmap size by bytes Eric Blake
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 08/20] dirty-bitmap: Change bdrv_dirty_bitmap_*serialize*() to take bytes Eric Blake
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 09/20] qcow2: Switch sectors_covered_by_bitmap_cluster() to byte-based Eric Blake
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 10/20] dirty-bitmap: Set iterator start by offset, not sector Eric Blake
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 11/20] dirty-bitmap: Change bdrv_dirty_iter_next() to report byte offset Eric Blake
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 12/20] dirty-bitmap: Change bdrv_get_dirty_count() to report bytes Eric Blake
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 13/20] dirty-bitmap: Change bdrv_get_dirty_locked() to take bytes Eric Blake
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 14/20] dirty-bitmap: Change bdrv_[re]set_dirty_bitmap() to use bytes Eric Blake
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 15/20] mirror: Switch mirror_dirty_init() to byte-based iteration Eric Blake
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 16/20] qcow2: Switch qcow2_measure() " Eric Blake
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 17/20] qcow2: Switch load_bitmap_data() " Eric Blake
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 18/20] qcow2: Switch store_bitmap_data() " Eric Blake
2017-09-19 12:44 ` Kevin Wolf
2017-09-19 19:42 ` Eric Blake
2017-09-20 6:22 ` Kevin Wolf [this message]
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 19/20] dirty-bitmap: Switch bdrv_set_dirty() to bytes Eric Blake
2017-09-18 18:58 ` [Qemu-devel] [PATCH v8 20/20] dirty-bitmap: Convert internal hbitmap size/granularity Eric Blake
2017-09-19 12:46 ` [Qemu-devel] [PATCH v8 00/20] make dirty-bitmap byte-based Kevin Wolf
2017-09-19 14:42 ` Fam Zheng
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=20170920062244.GA4730@localhost.localdomain \
--to=kwolf@redhat.com \
--cc=eblake@redhat.com \
--cc=jsnow@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).