Block QAPI, monitor, command line patches

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVaEdIAAoJEDhwtADrkYZT/ZUP/3fbcM+iFGP03P0CfoMoNMzs
 82MqPGqRFp4+vp3BjJeyvkzet7lDGmadv9EmjyMVtIlSbbkGn+NGEmjyocrurDRF
 jzGvP+HXkw1KGagE4zMg+W9klFLltRgNoOQ+m3LJVySGMZ0oEMt1kz5BfgX8p/jL
 OYuWguYKgC8tAiOJ+GWUsKX8DcB5GrhT/ToTHm+v4oBIYviawYjAOzEWXIWzO8QL
 u5Jp5gXDPNcxkL2l1AOFFo7Yv8VqbC8EPaeHCb126R6WjvbVFOiIKyh39PvnOWw6
 p5rHt0Uca2ozYy2OlN0ETK2Ho+gwfhRfhlxKD5cQ2v2LGc9g4NtzVDQub6QmhqD0
 WBYM89kUQjrq7hg14NAUR01aopmx9BZVYnQD7D/0rW9babeHRWQE3oydvrjcFVFC
 jGQkfUGRwAQT862dlrJU52jyawfHmnp5efLrRpMth273BVZ8Wbce6odWqb9TikNx
 MipNW+8BtCWfxpOUP0VgK8mqhGI/96fThFRHpEKEyziBbd/apnsMpyIsfPNPZl6P
 XN6OIbq9UH3zXP4IDkJnyrb5wAfzzr1HV8OgJd7wV3R3s687PRsLD3mEpIjZD1IB
 Xu2v5jG+PaIepD+vPMNE4eO+vYQta9SmEQjZ1+Me8U9d9T3Rd33WnkJZ3aD3v9SM
 bQ/enBBUtO7o7k4XBRge
 =huzN
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/armbru/tags/pull-block-2015-05-29' into staging

Block QAPI, monitor, command line patches

# gpg: Signature made Fri May 29 12:02:32 2015 BST using RSA key ID EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"

* remotes/armbru/tags/pull-block-2015-05-29:
  qapi: add dirty bitmap status

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2015-05-29 15:32:15 +01:00
commit 2cc3bdbe2d
3 changed files with 34 additions and 3 deletions

13
block.c
View File

@ -3116,6 +3116,17 @@ bool bdrv_dirty_bitmap_enabled(BdrvDirtyBitmap *bitmap)
return !(bitmap->disabled || bitmap->successor);
}
DirtyBitmapStatus bdrv_dirty_bitmap_status(BdrvDirtyBitmap *bitmap)
{
if (bdrv_dirty_bitmap_frozen(bitmap)) {
return DIRTY_BITMAP_STATUS_FROZEN;
} else if (!bdrv_dirty_bitmap_enabled(bitmap)) {
return DIRTY_BITMAP_STATUS_DISABLED;
} else {
return DIRTY_BITMAP_STATUS_ACTIVE;
}
}
/**
* Create a successor bitmap destined to replace this bitmap after an operation.
* Requires that the bitmap is not frozen and has no successor.
@ -3256,7 +3267,7 @@ BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs)
info->granularity = bdrv_dirty_bitmap_granularity(bm);
info->has_name = !!bm->name;
info->name = g_strdup(bm->name);
info->frozen = bdrv_dirty_bitmap_frozen(bm);
info->status = bdrv_dirty_bitmap_status(bm);
entry->value = info;
*plist = entry;
plist = &entry->next;

View File

@ -476,6 +476,7 @@ uint32_t bdrv_get_default_bitmap_granularity(BlockDriverState *bs);
uint32_t bdrv_dirty_bitmap_granularity(BdrvDirtyBitmap *bitmap);
bool bdrv_dirty_bitmap_enabled(BdrvDirtyBitmap *bitmap);
bool bdrv_dirty_bitmap_frozen(BdrvDirtyBitmap *bitmap);
DirtyBitmapStatus bdrv_dirty_bitmap_status(BdrvDirtyBitmap *bitmap);
int bdrv_get_dirty(BlockDriverState *bs, BdrvDirtyBitmap *bitmap, int64_t sector);
void bdrv_set_dirty_bitmap(BdrvDirtyBitmap *bitmap,
int64_t cur_sector, int nr_sectors);

View File

@ -325,6 +325,25 @@
'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
'data': 'bool', '*offset': 'int' } }
##
# @DirtyBitmapStatus:
#
# An enumeration of possible states that a dirty bitmap can report to the user.
#
# @frozen: The bitmap is currently in-use by a backup operation or block job,
# and is immutable.
#
# @disabled: The bitmap is currently in-use by an internal operation and is
# read-only. It can still be deleted.
#
# @active: The bitmap is actively monitoring for new writes, and can be cleared,
# deleted, or used for backup operations.
#
# Since: 2.4
##
{ 'enum': 'DirtyBitmapStatus',
'data': ['active', 'disabled', 'frozen'] }
##
# @BlockDirtyInfo:
#
@ -336,13 +355,13 @@
#
# @granularity: granularity of the dirty bitmap in bytes (since 1.4)
#
# @frozen: whether the dirty bitmap is frozen (Since 2.4)
# @status: current status of the dirty bitmap (since 2.4)
#
# Since: 1.3
##
{ 'struct': 'BlockDirtyInfo',
'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
'frozen': 'bool'} }
'status': 'DirtyBitmapStatus'} }
##
# @BlockInfo: