qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, famz@redhat.com, John Snow <jsnow@redhat.com>,
	armbru@redhat.com, mreitz@redhat.com, vsementsov@parallels.com,
	stefanha@redhat.com
Subject: [Qemu-devel] [PATCH v14 04/19] block: Introduce bdrv_dirty_bitmap_granularity()
Date: Fri, 20 Feb 2015 18:07:10 -0500	[thread overview]
Message-ID: <1424473645-29161-5-git-send-email-jsnow@redhat.com> (raw)
In-Reply-To: <1424473645-29161-1-git-send-email-jsnow@redhat.com>

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

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
---
 block.c               | 8 ++++++--
 include/block/block.h | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/block.c b/block.c
index 60dbdbd..8b40e38 100644
--- a/block.c
+++ b/block.c
@@ -5440,8 +5440,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 =
-            ((uint32_t) BDRV_SECTOR_SIZE << hbitmap_granularity(bm->bitmap));
+        info->granularity = bdrv_dirty_bitmap_granularity(bm);
         info->has_name = !!bm->name;
         info->name = g_strdup(bm->name);
         entry->value = info;
@@ -5481,6 +5480,11 @@ uint32_t bdrv_get_default_bitmap_granularity(BlockDriverState *bs)
     return granularity;
 }
 
+uint32_t bdrv_dirty_bitmap_granularity(BdrvDirtyBitmap *bitmap)
+{
+    return BDRV_SECTOR_SIZE << hbitmap_granularity(bitmap->bitmap);
+}
+
 void bdrv_dirty_iter_init(BlockDriverState *bs,
                           BdrvDirtyBitmap *bitmap, HBitmapIter *hbi)
 {
diff --git a/include/block/block.h b/include/block/block.h
index 3589132..41b8418 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -448,6 +448,7 @@ void bdrv_dirty_bitmap_make_anon(BlockDriverState *bs, BdrvDirtyBitmap *bitmap);
 void bdrv_release_dirty_bitmap(BlockDriverState *bs, BdrvDirtyBitmap *bitmap);
 BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs);
 uint32_t bdrv_get_default_bitmap_granularity(BlockDriverState *bs);
+uint32_t bdrv_dirty_bitmap_granularity(BdrvDirtyBitmap *bitmap);
 int bdrv_get_dirty(BlockDriverState *bs, BdrvDirtyBitmap *bitmap, int64_t sector);
 void bdrv_set_dirty_bitmap(BlockDriverState *bs, BdrvDirtyBitmap *bitmap,
                            int64_t cur_sector, int nr_sectors);
-- 
1.9.3

  parent reply	other threads:[~2015-02-20 23:07 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-20 23:07 [Qemu-devel] [PATCH v14 00/19] block: incremental backup series John Snow
2015-02-20 23:07 ` [Qemu-devel] [PATCH v14 01/19] qapi: Add optional field "name" to block dirty bitmap John Snow
2015-02-20 23:07 ` [Qemu-devel] [PATCH v14 02/19] qmp: Ensure consistent granularity type John Snow
2015-02-20 23:07 ` [Qemu-devel] [PATCH v14 03/19] qmp: Add block-dirty-bitmap-add and block-dirty-bitmap-remove John Snow
2015-02-27 18:44   ` Eric Blake
2015-02-20 23:07 ` John Snow [this message]
2015-02-27 20:42   ` [Qemu-devel] [PATCH v14 04/19] block: Introduce bdrv_dirty_bitmap_granularity() Eric Blake
2015-02-20 23:07 ` [Qemu-devel] [PATCH v14 05/19] hbitmap: add hbitmap_merge John Snow
2015-02-20 23:07 ` [Qemu-devel] [PATCH v14 06/19] qmp: Add block-dirty-bitmap-enable and block-dirty-bitmap-disable John Snow
2015-02-20 23:07 ` [Qemu-devel] [PATCH v14 07/19] block: Add bitmap successors John Snow
2015-02-20 23:07 ` [Qemu-devel] [PATCH v14 08/19] qmp: Add support of "dirty-bitmap" sync mode for drive-backup John Snow
2015-02-20 23:07 ` [Qemu-devel] [PATCH v14 09/19] qmp: add block-dirty-bitmap-clear John Snow
2015-02-20 23:07 ` [Qemu-devel] [PATCH v14 10/19] qapi: Add transaction support to block-dirty-bitmap operations John Snow
2015-02-23 15:48   ` Max Reitz
2015-02-20 23:07 ` [Qemu-devel] [PATCH v14 11/19] qmp: Add dirty bitmap status fields in query-block John Snow
2015-02-20 23:07 ` [Qemu-devel] [PATCH v14 12/19] block: add BdrvDirtyBitmap documentation John Snow
2015-02-20 23:07 ` [Qemu-devel] [PATCH v14 13/19] block: Ensure consistent bitmap function prototypes John Snow
2015-02-20 23:07 ` [Qemu-devel] [PATCH v14 14/19] iotests: add invalid input incremental backup tests John Snow
2015-02-20 23:07 ` [Qemu-devel] [PATCH v14 15/19] iotests: add simple incremental backup case John Snow
2015-02-20 23:07 ` [Qemu-devel] [PATCH v14 16/19] iotests: add transactional incremental backup test John Snow
2015-02-20 23:07 ` [Qemu-devel] [PATCH v14 17/19] iotests: add incremental backup failure recovery test John Snow
2015-02-20 23:07 ` [Qemu-devel] [PATCH v14 18/19] block: Resize bitmaps on bdrv_truncate John Snow
2015-02-23 17:03   ` Max Reitz
2015-02-23 19:12     ` John Snow
2015-02-20 23:07 ` [Qemu-devel] [PATCH v14 19/19] docs: incremental backup documentation John Snow
2015-02-20 23:55   ` Eric Blake
2015-02-21  0:09     ` John Snow
2015-02-23 17:07 ` [Qemu-devel] [PATCH v14 00/19] block: incremental backup series Max Reitz

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=1424473645-29161-5-git-send-email-jsnow@redhat.com \
    --to=jsnow@redhat.com \
    --cc=armbru@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@parallels.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).