block: remove dirty bitmaps 'status' field

The same information is available via the 'recording' and 'busy' fields.

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2021-02-19 19:19:54 +00:00
parent ad1324e044
commit 81cbfd5088
11 changed files with 174 additions and 427 deletions

View File

@ -166,43 +166,6 @@ bool bdrv_dirty_bitmap_enabled(BdrvDirtyBitmap *bitmap)
return !bitmap->disabled;
}
/**
* bdrv_dirty_bitmap_status: This API is now deprecated.
* Called with BQL taken.
*
* A BdrvDirtyBitmap can be in four possible user-visible states:
* (1) Active: successor is NULL, and disabled is false: full r/w mode
* (2) Disabled: successor is NULL, and disabled is true: qualified r/w mode,
* guest writes are dropped, but monitor writes are possible,
* through commands like merge and clear.
* (3) Frozen: successor is not NULL.
* A frozen bitmap cannot be renamed, deleted, cleared, set,
* enabled, merged to, etc. A frozen bitmap can only abdicate()
* or reclaim().
* In this state, the anonymous successor bitmap may be either
* Active and recording writes from the guest (e.g. backup jobs),
* or it can be Disabled and not recording writes.
* (4) Locked: Whether Active or Disabled, the user cannot modify this bitmap
* in any way from the monitor.
* (5) Inconsistent: This is a persistent bitmap whose "in use" bit is set, and
* is unusable by QEMU. It can be deleted to remove it from
* the qcow2.
*/
DirtyBitmapStatus bdrv_dirty_bitmap_status(BdrvDirtyBitmap *bitmap)
{
if (bdrv_dirty_bitmap_inconsistent(bitmap)) {
return DIRTY_BITMAP_STATUS_INCONSISTENT;
} else if (bdrv_dirty_bitmap_has_successor(bitmap)) {
return DIRTY_BITMAP_STATUS_FROZEN;
} else if (bdrv_dirty_bitmap_busy(bitmap)) {
return DIRTY_BITMAP_STATUS_LOCKED;
} else if (!bdrv_dirty_bitmap_enabled(bitmap)) {
return DIRTY_BITMAP_STATUS_DISABLED;
} else {
return DIRTY_BITMAP_STATUS_ACTIVE;
}
}
/* Called with BQL taken. */
static bool bdrv_dirty_bitmap_recording(BdrvDirtyBitmap *bitmap)
{
@ -582,7 +545,6 @@ 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->status = bdrv_dirty_bitmap_status(bm);
info->recording = bdrv_dirty_bitmap_recording(bm);
info->busy = bdrv_dirty_bitmap_busy(bm);
info->persistent = bm->persistent;

View File

@ -198,13 +198,6 @@ Use arguments ``base-node`` and ``top-node`` instead.
Specify the properties for the object as top-level arguments instead.
``query-named-block-nodes`` and ``query-block`` result dirty-bitmaps[i].status (since 4.0)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
The ``status`` field of the ``BlockDirtyInfo`` structure, returned by
these commands is deprecated. Two new boolean fields, ``recording`` and
``busy`` effectively replace it.
``query-block`` result field ``dirty-bitmaps`` (Since 4.2)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

View File

@ -120,6 +120,13 @@ Removed with no replacement.
Removed with no replacement.
``query-named-block-nodes`` and ``query-block`` result dirty-bitmaps[i].status (removed in 6.0)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
The ``status`` field of the ``BlockDirtyInfo`` structure, returned by
these commands is removed. Two new boolean fields, ``recording`` and
``busy`` effectively replace it.
Human Monitor Protocol (HMP) commands
-------------------------------------

View File

@ -46,7 +46,6 @@ bool bdrv_dirty_bitmap_enabled(BdrvDirtyBitmap *bitmap);
bool bdrv_dirty_bitmap_has_successor(BdrvDirtyBitmap *bitmap);
const char *bdrv_dirty_bitmap_name(const BdrvDirtyBitmap *bitmap);
int64_t bdrv_dirty_bitmap_size(const BdrvDirtyBitmap *bitmap);
DirtyBitmapStatus bdrv_dirty_bitmap_status(BdrvDirtyBitmap *bitmap);
void bdrv_set_dirty_bitmap(BdrvDirtyBitmap *bitmap,
int64_t offset, int64_t bytes);
void bdrv_reset_dirty_bitmap(BdrvDirtyBitmap *bitmap,

View File

@ -418,43 +418,6 @@
##
{ 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
##
# @DirtyBitmapStatus:
#
# An enumeration of possible states that a dirty bitmap can report to the user.
#
# @frozen: The bitmap is currently in-use by some operation and is immutable.
# If the bitmap was @active prior to the operation, new writes by the
# guest are being recorded in a temporary buffer, and will not be lost.
# Generally, bitmaps are cleared on successful use in an operation and
# the temporary buffer is committed into the bitmap. On failure, the
# temporary buffer is merged back into the bitmap without first
# clearing it.
# Please refer to the documentation for each bitmap-using operation,
# See also @blockdev-backup, @drive-backup.
#
# @disabled: The bitmap is not currently recording new writes by the guest.
# This is requested explicitly via @block-dirty-bitmap-disable.
# It can still be cleared, deleted, or used for backup operations.
#
# @active: The bitmap is actively monitoring for new writes, and can be cleared,
# deleted, or used for backup operations.
#
# @locked: The bitmap is currently in-use by some operation and is immutable.
# If the bitmap was @active prior to the operation, it is still
# recording new writes. If the bitmap was @disabled, it is not
# recording new writes. (Since 2.12)
#
# @inconsistent: This is a persistent dirty bitmap that was marked in-use on
# disk, and is unusable by QEMU. It can only be deleted.
# Please rely on the inconsistent field in @BlockDirtyInfo
# instead, as the status field is deprecated. (Since 4.0)
#
# Since: 2.4
##
{ 'enum': 'DirtyBitmapStatus',
'data': ['active', 'disabled', 'frozen', 'locked', 'inconsistent'] }
##
# @BlockDirtyInfo:
#
@ -466,8 +429,6 @@
#
# @granularity: granularity of the dirty bitmap in bytes (since 1.4)
#
# @status: current status of the dirty bitmap (since 2.4)
#
# @recording: true if the bitmap is recording new writes from the guest.
# Replaces `active` and `disabled` statuses. (since 4.0)
#
@ -483,17 +444,11 @@
# @busy to be false. This bitmap cannot be used. To remove
# it, use @block-dirty-bitmap-remove. (Since 4.0)
#
# Features:
# @deprecated: Member @status is deprecated. Use @recording and
# @locked instead.
#
# Since: 1.3
##
{ 'struct': 'BlockDirtyInfo',
'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
'recording': 'bool', 'busy': 'bool',
'status': { 'type': 'DirtyBitmapStatus',
'features': [ 'deprecated' ] },
'persistent': 'bool', '*inconsistent': 'bool' } }
##

View File

@ -348,7 +348,6 @@ class TestIncrementalBackup(TestIncrementalBackupBase):
'name': 'bitmap0',
'count': 458752,
'granularity': 65536,
'status': 'active',
'persistent': False
}))
@ -705,7 +704,6 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBackupBase):
drive0['id'], bitmap.name, {
'count': 458752,
'granularity': 65536,
'status': 'active',
'busy': False,
'recording': True
}))
@ -736,7 +734,6 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBackupBase):
drive0['id'], bitmap.name, {
'count': 458752,
'granularity': 65536,
'status': 'frozen',
'busy': True,
'recording': True
}))
@ -751,7 +748,6 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBackupBase):
drive0['id'], bitmap.name, {
'count': 0,
'granularity': 65536,
'status': 'active',
'busy': False,
'recording': True
}))

View File

@ -24,6 +24,6 @@ Stopping the NBD server on destination...
Wait for migration completion on target...
{"data": {"status": "completed"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
Check bitmaps on source:
[{"busy": false, "count": 0, "granularity": 65536, "name": "bitmap0", "persistent": false, "recording": true, "status": "active"}]
[{"busy": false, "count": 0, "granularity": 65536, "name": "bitmap0", "persistent": false, "recording": true}]
Check bitmaps on target:
[{"busy": false, "count": 0, "granularity": 65536, "name": "bitmap0", "persistent": false, "recording": true, "status": "active"}]
[{"busy": false, "count": 0, "granularity": 65536, "name": "bitmap0", "persistent": false, "recording": true}]

View File

@ -27,8 +27,7 @@ write -P0xcd 0x3ff0000 64k
"granularity": 65536,
"name": "bitmapB",
"persistent": false,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -36,8 +35,7 @@ write -P0xcd 0x3ff0000 64k
"granularity": 65536,
"name": "bitmapA",
"persistent": false,
"recording": true,
"status": "active"
"recording": true
}
]
}
@ -93,8 +91,7 @@ write -P0xcd 0x3ff0000 64k
"granularity": 65536,
"name": "bitmapB",
"persistent": false,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -102,8 +99,7 @@ write -P0xcd 0x3ff0000 64k
"granularity": 65536,
"name": "bitmapA",
"persistent": false,
"recording": true,
"status": "active"
"recording": true
}
]
}
@ -197,8 +193,7 @@ write -P0xea 0x3fe0000 64k
"granularity": 65536,
"name": "bitmapC",
"persistent": false,
"recording": false,
"status": "disabled"
"recording": false
},
{
"busy": false,
@ -206,8 +201,7 @@ write -P0xea 0x3fe0000 64k
"granularity": 65536,
"name": "bitmapB",
"persistent": false,
"recording": false,
"status": "disabled"
"recording": false
},
{
"busy": false,
@ -215,8 +209,7 @@ write -P0xea 0x3fe0000 64k
"granularity": 65536,
"name": "bitmapA",
"persistent": false,
"recording": false,
"status": "disabled"
"recording": false
}
]
}
@ -270,8 +263,7 @@ write -P0xea 0x3fe0000 64k
"granularity": 65536,
"name": "bitmapC",
"persistent": false,
"recording": false,
"status": "disabled"
"recording": false
},
{
"busy": false,
@ -279,8 +271,7 @@ write -P0xea 0x3fe0000 64k
"granularity": 65536,
"name": "bitmapB",
"persistent": false,
"recording": false,
"status": "disabled"
"recording": false
},
{
"busy": false,
@ -288,8 +279,7 @@ write -P0xea 0x3fe0000 64k
"granularity": 65536,
"name": "bitmapA",
"persistent": false,
"recording": false,
"status": "disabled"
"recording": false
}
]
}
@ -336,8 +326,7 @@ write -P0xea 0x3fe0000 64k
"granularity": 65536,
"name": "bitmapD",
"persistent": false,
"recording": false,
"status": "disabled"
"recording": false
},
{
"busy": false,
@ -345,8 +334,7 @@ write -P0xea 0x3fe0000 64k
"granularity": 65536,
"name": "bitmapC",
"persistent": false,
"recording": false,
"status": "disabled"
"recording": false
},
{
"busy": false,
@ -354,8 +342,7 @@ write -P0xea 0x3fe0000 64k
"granularity": 65536,
"name": "bitmapB",
"persistent": false,
"recording": false,
"status": "disabled"
"recording": false
},
{
"busy": false,
@ -363,8 +350,7 @@ write -P0xea 0x3fe0000 64k
"granularity": 65536,
"name": "bitmapA",
"persistent": false,
"recording": false,
"status": "disabled"
"recording": false
}
]
}

View File

@ -24,8 +24,7 @@
"granularity": 65536,
"name": "Transient",
"persistent": false,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -33,8 +32,7 @@
"granularity": 131072,
"name": "Large",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -42,8 +40,7 @@
"granularity": 65536,
"name": "Medium",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -51,8 +48,7 @@
"granularity": 32768,
"name": "Small",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
}
]
}
@ -68,8 +64,7 @@
"granularity": 32768,
"name": "Small",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -77,8 +72,7 @@
"granularity": 65536,
"name": "Medium",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -86,8 +80,7 @@
"granularity": 131072,
"name": "Large",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
}
]
}
@ -108,8 +101,7 @@
"granularity": 65536,
"name": "Newtwo",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -117,8 +109,7 @@
"granularity": 65536,
"name": "New",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -126,8 +117,7 @@
"granularity": 32768,
"name": "Small",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -135,8 +125,7 @@
"granularity": 65536,
"name": "Medium",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -144,8 +133,7 @@
"granularity": 131072,
"name": "Large",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
}
]
}
@ -163,8 +151,7 @@
"granularity": 65536,
"name": "New",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -172,8 +159,7 @@
"granularity": 65536,
"name": "Newtwo",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -181,8 +167,7 @@
"granularity": 32768,
"name": "Small",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -190,8 +175,7 @@
"granularity": 65536,
"name": "Medium",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -199,8 +183,7 @@
"granularity": 131072,
"name": "Large",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
}
]
}
@ -232,8 +215,7 @@
"granularity": 65536,
"name": "NewB",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -241,8 +223,7 @@
"granularity": 65536,
"name": "NewC",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -250,8 +231,7 @@
"granularity": 32768,
"name": "Small",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -259,8 +239,7 @@
"granularity": 65536,
"name": "Medium",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -268,8 +247,7 @@
"granularity": 131072,
"name": "Large",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
}
]
}

View File

@ -99,8 +99,7 @@ query-block: device = drive0, node-name = snap, dirty-bitmaps:
"granularity": 65536,
"name": "bitmap2",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -108,8 +107,7 @@ query-block: device = drive0, node-name = snap, dirty-bitmaps:
"granularity": 65536,
"name": "bitmap1",
"persistent": true,
"recording": true,
"status": "active"
"recording": true
},
{
"busy": false,
@ -117,8 +115,7 @@ query-block: device = drive0, node-name = snap, dirty-bitmaps:
"granularity": 65536,
"name": "bitmap0",
"persistent": false,
"recording": true,
"status": "active"
"recording": true
}
]

File diff suppressed because it is too large Load Diff