From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38399) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YB6BS-0002dI-0D for qemu-devel@nongnu.org; Tue, 13 Jan 2015 13:27:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YB6BM-0000HD-Om for qemu-devel@nongnu.org; Tue, 13 Jan 2015 13:27:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34395) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YB6BM-0000H6-DT for qemu-devel@nongnu.org; Tue, 13 Jan 2015 13:27:12 -0500 Message-ID: <54B5637E.80609@redhat.com> Date: Tue, 13 Jan 2015 13:27:10 -0500 From: John Snow MIME-Version: 1.0 References: <1421080265-2228-1-git-send-email-jsnow@redhat.com> <1421080265-2228-14-git-send-email-jsnow@redhat.com> <54B54CE8.2060006@parallels.com> In-Reply-To: <54B54CE8.2060006@parallels.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v11 13/13] block: BdrvDirtyBitmap miscellaneous fixup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladimir Sementsov-Ogievskiy , qemu-devel@nongnu.org Cc: kwolf@redhat.com, famz@redhat.com, armbru@redhat.com, stefanha@redhat.com, mreitz@redhat.com On 01/13/2015 11:50 AM, Vladimir Sementsov-Ogievskiy wrote: > Hmm. May be, update the size field to be uint64_t too? Negative size is > not meaningful.. > > Best regards, > Vladimir > No, it is not meaningful. However, it does match the return type from=20 bdrv_nb_sectors(bs), which uses -1 to indicate an error. So we also=20 don't really need to change it in this circumstance, since we'll not be=20 exceeding what int64_t/bdrv_nb_sectors can provide anyway. (Plus, INT64_MAX sectors is an absurdly large amount of bytes!) I'll see how many changes this requires in other helper functions when I=20 prepare a V12. If it's easy I will do it. Thanks! --js > On 12.01.2015 19:31, John Snow wrote: >> (1) granularity type consistency: Update the granularity to be uint64_= t >> in all places. This value is always in bytes. >> >> (2) Some documentation for the fields within BdrvDirtyBitmap. >> >> Signed-off-by: John Snow >> --- >> block.c | 16 ++++++++-------- >> include/block/block.h | 2 +- >> 2 files changed, 9 insertions(+), 9 deletions(-) >> >> diff --git a/block.c b/block.c >> index 9e2b8c0..13f9cc0 100644 >> --- a/block.c >> +++ b/block.c >> @@ -52,13 +52,13 @@ >> #endif >> struct BdrvDirtyBitmap { >> - HBitmap *bitmap; >> - BdrvDirtyBitmap *successor; >> - int64_t size; >> - int64_t granularity; >> - char *name; >> - bool enabled; >> - bool frozen; >> + HBitmap *bitmap; /* Dirty sector bitmap */ >> + BdrvDirtyBitmap *successor; /* Anonymous child */ >> + int64_t size; /* Number of sectors */ >> + uint64_t granularity; /* Granularity in bytes */ >> + char *name; /* Optional non-empty unique ID */ >> + bool enabled; /* Writes are being tracked */ >> + bool frozen; /* Protected; see >> bdrv_freeze_dirty_bitmap() */ >> QLIST_ENTRY(BdrvDirtyBitmap) list; >> }; >> @@ -5350,7 +5350,7 @@ void >> bdrv_dirty_bitmap_make_anon(BlockDriverState *bs, BdrvDirtyBitmap >> *bitmap) >> } >> BdrvDirtyBitmap *bdrv_create_dirty_bitmap(BlockDriverState *bs, >> - int granularity, >> + uint64_t granularity, >> const char *name, >> Error **errp) >> { >> diff --git a/include/block/block.h b/include/block/block.h >> index 99ed679..749429e 100644 >> --- a/include/block/block.h >> +++ b/include/block/block.h >> @@ -430,7 +430,7 @@ bool bdrv_qiov_is_aligned(BlockDriverState *bs, >> QEMUIOVector *qiov); >> struct HBitmapIter; >> typedef struct BdrvDirtyBitmap BdrvDirtyBitmap; >> BdrvDirtyBitmap *bdrv_create_dirty_bitmap(BlockDriverState *bs, >> - int granularity, >> + uint64_t granularity, >> const char *name, >> Error **errp); >> int bdrv_dirty_bitmap_create_successor(BlockDriverState *bs, > > --=20 =E2=80=94js