[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 5/9] hbitmap: Add hbitmap_copy
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [PATCH v2 5/9] hbitmap: Add hbitmap_copy |
Date: |
Thu, 20 Mar 2014 18:47:58 +0800 |
User-agent: |
Mutt/1.5.22 (2013-10-16) |
On Thu, 03/20 11:22, Paolo Bonzini wrote:
> Il 12/03/2014 07:31, Fam Zheng ha scritto:
> >+HBitmap *hbitmap_copy(const HBitmap *bitmap)
> >+{
> >+ int i;
> >+ HBitmap *hb = g_memdup(bitmap, sizeof(struct HBitmap));
> >+
> >+ for (i = HBITMAP_LEVELS; i-- > 0; ) {
> >+ hb->levels[i] = g_memdup(bitmap->levels[i],
> >+ bitmap->size * sizeof(unsigned long));
> >+ }
> >+
> >+ return hb;
>
> Not quite... the bitmap->size is in bits, so you need to scale it down by
>
> size = MAX((size + BITS_PER_LONG - 1) >> BITS_PER_LEVEL, 1);
>
> before each memdup.
>
This is fixed in V3 which is posted on the list.
Thanks,
Fam
- Re: [Qemu-devel] [PATCH v2 3/9] block: Handle error of bdrv_getlength in bdrv_create_dirty_bitmap, (continued)
- [Qemu-devel] [PATCH v2 1/9] qapi: Add optional field "name" to block dirty bitmap, Fam Zheng, 2014/03/12
- [Qemu-devel] [PATCH v2 4/9] block: Introduce bdrv_dirty_bitmap_granularity(), Fam Zheng, 2014/03/12
- [Qemu-devel] [PATCH v2 5/9] hbitmap: Add hbitmap_copy, Fam Zheng, 2014/03/12
- [Qemu-devel] [PATCH v2 6/9] block: Add bdrv_copy_dirty_bitmap and bdrv_reset_dirty_bitmap, Fam Zheng, 2014/03/12
- [Qemu-devel] [PATCH v2 7/9] qmp: Add dirty-bitmap-enable and dirty-bitmap-disable, Fam Zheng, 2014/03/12
- [Qemu-devel] [PATCH v2 8/9] qmp: Add support of "dirty-bitmap" sync mode for drive-backup, Fam Zheng, 2014/03/12
- [Qemu-devel] [PATCH v2 9/9] qapi: Add transaction support to dirty-bitmap-{add, disable}, Fam Zheng, 2014/03/12