qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [2.3 PATCH v7 03/10] block: Introduce bdrv_dirty_bitmap


From: Max Reitz
Subject: Re: [Qemu-devel] [2.3 PATCH v7 03/10] block: Introduce bdrv_dirty_bitmap_granularity()
Date: Wed, 26 Nov 2014 13:29:06 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 2014-11-25 at 20:46, John Snow wrote:
From: Fam Zheng <address@hidden>

This returns the granularity (in bytes) of dirty bitmap,
which matches the QMP interface and the existing query
interface.

Signed-off-by: Fam Zheng <address@hidden>
Reviewed-by: Benoit Canet <address@hidden>

Maybe you should have removed the R-b because of the functional changes, but BenoƮt should complain about that, not me.

Signed-off-by: John Snow <address@hidden>
---
  block.c               | 9 +++++++--
  include/block/block.h | 2 ++
  2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/block.c b/block.c
index a940345..ea4c8d8 100644
--- a/block.c
+++ b/block.c
@@ -5364,8 +5364,7 @@ BlockDirtyInfoList 
*bdrv_query_dirty_bitmaps(BlockDriverState *bs)
          BlockDirtyInfo *info = g_new0(BlockDirtyInfo, 1);
          BlockDirtyInfoList *entry = g_new0(BlockDirtyInfoList, 1);
          info->count = bdrv_get_dirty_count(bs, bm);
-        info->granularity =
-            ((int64_t) BDRV_SECTOR_SIZE << hbitmap_granularity(bm->bitmap));
+        info->granularity = bdrv_dirty_bitmap_granularity(bs, bm);
          info->has_name = !!bm->name;
          info->name = g_strdup(bm->name);
          entry->value = info;
@@ -5404,6 +5403,12 @@ int64_t bdrv_dbm_calc_def_granularity(BlockDriverState 
*bs)
      return granularity;
  }
+int64_t bdrv_dirty_bitmap_granularity(BlockDriverState *bs,
+                                  BdrvDirtyBitmap *bitmap)
+{
+    return BDRV_SECTOR_SIZE << hbitmap_granularity(bitmap->bitmap);
+}
+

Oh, BDRV_SECTOR_SIZE is an unsigned long long. Great, I didn't know. (So this can't overflow)

Reviewed-by: Max Reitz <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]