qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: kwolf@redhat.com, peter.maydell@linaro.org, quintela@redhat.com,
	qemu-devel@nongnu.org, dgilbert@redhat.com, stefanha@redhat.com,
	den@openvz.org, amit.shah@redhat.com, pbonzini@redhat.com,
	jsnow@redhat.com
Subject: Re: [Qemu-devel] [PATCH 01/13] hbitmap: serialization
Date: Thu, 3 Dec 2015 15:35:11 +0800	[thread overview]
Message-ID: <20151203073511.GA31986@ad.usersys.redhat.com> (raw)
In-Reply-To: <1447255003-2043-2-git-send-email-vsementsov@virtuozzo.com>

On Wed, 11/11 18:16, Vladimir Sementsov-Ogievskiy wrote:
> +void hbitmap_deserialize_finish(HBitmap *bitmap)
> +{
> +    int64_t i, size, prev_size;
> +    int lev;
> +
> +    /* restore levels starting from penultimate to zero level, assuming
> +     * that the last level is ok */
> +    size = MAX((bitmap->size + BITS_PER_LONG - 1) >> BITS_PER_LEVEL, 1);
> +    for (lev = HBITMAP_LEVELS - 1; lev-- > 0; ) {
> +        prev_size = size;
> +        size = MAX((size + BITS_PER_LONG - 1) >> BITS_PER_LEVEL, 1);
> +        memset(bitmap->levels[lev], 0, size * sizeof(unsigned long));
> +
> +        for (i = 0; i < prev_size; ++i) {
> +            if (bitmap->levels[lev + 1][i]) {
> +                bitmap->levels[lev][i >> BITS_PER_LEVEL] |=
> +                    1 << (i & (BITS_PER_LONG - 1));

This should be 1UL.

Fam

> +            }
> +        }
> +    }
> +
> +    bitmap->levels[0][0] |= 1UL << (BITS_PER_LONG - 1);
> +}
> +
>  void hbitmap_free(HBitmap *hb)
>  {
>      unsigned i;
> -- 
> 2.1.4
> 
> 

  reply	other threads:[~2015-12-03  7:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-11 15:16 [Qemu-devel] [PATCH v7 00/13] Dirty bitmaps migration Vladimir Sementsov-Ogievskiy
2015-11-11 15:16 ` [Qemu-devel] [PATCH 01/13] hbitmap: serialization Vladimir Sementsov-Ogievskiy
2015-12-03  7:35   ` Fam Zheng [this message]
2015-12-03  7:44     ` Vladimir Sementsov-Ogievskiy
2015-11-11 15:16 ` [Qemu-devel] [PATCH 02/13] block: BdrvDirtyBitmap serialization interface Vladimir Sementsov-Ogievskiy
2015-11-11 15:16 ` [Qemu-devel] [PATCH 03/13] block: tiny refactoring: minimize hbitmap_(set/reset) usage Vladimir Sementsov-Ogievskiy
2015-11-11 15:16 ` [Qemu-devel] [PATCH 04/13] block: add meta bitmaps Vladimir Sementsov-Ogievskiy
2015-12-03 11:07   ` Fam Zheng
2015-11-11 15:16 ` [Qemu-devel] [PATCH 05/13] block: add bdrv_next_dirty_bitmap() Vladimir Sementsov-Ogievskiy
2015-11-11 15:16 ` [Qemu-devel] [PATCH 06/13] qapi: add dirty-bitmaps migration capability Vladimir Sementsov-Ogievskiy
2015-11-11 15:16 ` [Qemu-devel] [PATCH 07/13] migration/qemu-file: add qemu_put_counted_string() Vladimir Sementsov-Ogievskiy
2015-11-11 15:16 ` [Qemu-devel] [PATCH 08/13] migration: add migration/block-dirty-bitmap.c Vladimir Sementsov-Ogievskiy
2015-11-11 15:16 ` [Qemu-devel] [PATCH 09/13] iotests: maintain several vms in test Vladimir Sementsov-Ogievskiy
2015-11-11 15:16 ` [Qemu-devel] [PATCH 10/13] iotests: add add_incoming_migration to VM class Vladimir Sementsov-Ogievskiy
2015-11-11 15:16 ` [Qemu-devel] [PATCH 11/13] qapi: add md5 checksum of last dirty bitmap level to query-block Vladimir Sementsov-Ogievskiy
2015-11-11 15:16 ` [Qemu-devel] [PATCH 12/13] iotests: add default node-name Vladimir Sementsov-Ogievskiy
2015-11-11 15:16 ` [Qemu-devel] [PATCH 13/13] iotests: add dirty bitmap migration test 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=20151203073511.GA31986@ad.usersys.redhat.com \
    --to=famz@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=den@openvz.org \
    --cc=dgilbert@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --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).