Bitmaps patches
[Qemu-devel] [PULL 01/17] block/dirty-bitmap: add recording and busy properties
In reply to John SnowThe current API allows us to report a single status, which we've defined as:
Frozen: has a successor, treated as qmp_locked, may or may not be enabled.
Locked: no successor, qmp_locked. may or may not be enabled.
Disabled: Not frozen or locked, disabled.
Active: Not frozen, locked, or disabled.
The problem is that both "Frozen" and "Locked" mean nearly the same thing, and that both of them do not intuit whether they are recording guest writes or not.
This patch deprecates that status field and introduces two orthogonal properties instead to replace it.
Message-id: [email protected]
--- qemu-deprecated.texi | 6 ++++++ qapi/block-core.json | 10 +++++++++- block/dirty-bitmap.c | 9 +++++++++ tests/qemu-iotests/236.out | 28 ++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 1 deletion(-)
qemu-deprecated.texi +6 -0
@@ -67,6 +67,12 @@ topologies described with -smp include all possible cpus, i.e. "autoload" parameter is now ignored. All bitmaps are automatically loaded from qcow2 images. +@subsection query-block result field dirty-bitmaps[i].status (since 4.0) + +The ``status'' field of the ``BlockDirtyInfo'' structure, returned by +the query-block command is deprecated. Two new boolean fields, +``recording'' and ``busy'' effectively replace it. + @subsection query-cpus (since 2.12.0) The ``query-cpus'' command is replaced by the ``query-cpus-fast'' command.
qapi/block-core.json +9 -1
@@ -458,7 +458,14 @@ # # @granularity: granularity of the dirty bitmap in bytes (since 1.4) # -# @status: current status of the dirty bitmap (since 2.4) +# @status: Deprecated in favor of @recording and @locked. (since 2.4) +# +# @recording: true if the bitmap is recording new writes from the guest. +# Replaces `active` and `disabled` statuses. (since 4.0) +# +# @busy: true if the bitmap is in-use by some operation (NBD or jobs) +# and cannot be modified via QMP or used by another operation. +# Replaces `locked` and `frozen` statuses. (since 4.0) # # @persistent: true if the bitmap will eventually be flushed to persistent # storage (since 4.0)
@@ -467,6 +474,7 @@ ## { 'struct': 'BlockDirtyInfo', 'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32', + 'recording': 'bool', 'busy': 'bool', 'status': 'DirtyBitmapStatus', 'persistent': 'bool' } } ##
block/dirty-bitmap.c +9 -0
@@ -226,6 +226,13 @@ DirtyBitmapStatus bdrv_dirty_bitmap_status(BdrvDirtyBitmap *bitmap) } } +/* Called with BQL taken. */ +static bool bdrv_dirty_bitmap_recording (BdrvDirtyBitmap *bitmap) +{ +return !bitmap->disabled || (bitmap->successor && + !bitmap->successor->disabled); +} +/** * Create a successor bitmap destined to replace this bitmap after an operation. * Requires that the bitmap is not frozen and has no successor.
@@ -448,6 +455,8 @@ BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs) 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_user_locked (bm); info->persistent = bm->persistent; entry->value = info; *plist = entry;
tests/qemu-iotests/236.out +28 -0
@@ -22,17 +22,21 @@ write -P0xcd 0x3ff0000 64k "bitmaps": { "drive0": [ { + "busy": false, "count": 262144, "granularity": 65536, "name": "bitmapB", "persistent": false, + "recording": true, "status": "active" }, { + "busy": false, "count": 262144, "granularity": 65536, "name": "bitmapA", "persistent": false, + "recording": true, "status": "active" } ]
@@ -84,17 +88,21 @@ write -P0xcd 0x3ff0000 64k "bitmaps": { "drive0": [ { + "busy": false, "count": 262144, "granularity": 65536, "name": "bitmapB", "persistent": false, + "recording": true, "status": "active" }, { + "busy": false, "count": 262144, "granularity": 65536, "name": "bitmapA", "persistent": false, + "recording": true, "status": "active" } ]
@@ -184,24 +192,30 @@ write -P0xea 0x3fe0000 64k "bitmaps": { "drive0": [ { + "busy": false, "count": 393216, "granularity": 65536, "name": "bitmapC", "persistent": false, + "recording": false, "status": "disabled" }, { + "busy": false, "count": 262144, "granularity": 65536, "name": "bitmapB", "persistent": false, + "recording": false, "status": "disabled" }, { + "busy": false, "count": 458752, "granularity": 65536, "name": "bitmapA", "persistent": false, + "recording": false, "status": "disabled" } ]
@@ -251,24 +265,30 @@ write -P0xea 0x3fe0000 64k "bitmaps": { "drive0": [ { + "busy": false, "count": 393216, "granularity": 65536, "name": "bitmapC", "persistent": false, + "recording": false, "status": "disabled" }, { + "busy": false, "count": 262144, "granularity": 65536, "name": "bitmapB", "persistent": false, + "recording": false, "status": "disabled" }, { + "busy": false, "count": 458752, "granularity": 65536, "name": "bitmapA", "persistent": false, + "recording": false, "status": "disabled" } ]
@@ -311,31 +331,39 @@ write -P0xea 0x3fe0000 64k "bitmaps": { "drive0": [ { + "busy": false, "count": 458752, "granularity": 65536, "name": "bitmapD", "persistent": false, + "recording": false, "status": "disabled" }, { + "busy": false, "count": 393216, "granularity": 65536, "name": "bitmapC", "persistent": false, + "recording": false, "status": "disabled" }, { + "busy": false, "count": 262144, "granularity": 65536, "name": "bitmapB", "persistent": false, + "recording": false, "status": "disabled" }, { + "busy": false, "count": 458752, "granularity": 65536, "name": "bitmapA", "persistent": false, + "recording": false, "status": "disabled" } ]
Signature · 1 line
2.17.2
The following changes since commit 234afe78281b10a798fb97c584e1b677844aaab8:
Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2019-03-08' into staging (2019-03-08 16:31:34 +0000)
are available in the Git repository at:
https://github.com/jnsnow/qemu.git tags/bitmaps-pull-request
for you to fetch changes up to fc91aa3d937e56d512c702d9b966fcea0e499f0e:
block/dirty-bitmaps: implement inconsistent bit (2019-03-08 14:07:29 -0500)
----------------------------------------------------------------
Pull request
----------------------------------------------------------------
John Snow (17):
block/dirty-bitmap: add recording and busy properties block/dirty-bitmaps: rename frozen predicate helper block/dirty-bitmap: remove set/reset assertions against enabled bit block/dirty-bitmap: change semantics of enabled predicate
nbd: change error checking order for bitmaps block/dirty-bitmap: explicitly lock bitmaps with successors block/dirty-bitmaps: unify qmp_locked and user_locked calls block/dirty-bitmaps: move comment block
blockdev: remove unused paio parameter documentation
iotests: add busy/recording bit test to 124 block/dirty-bitmaps: add inconsistent bit block/dirty-bitmap: add inconsistent status block/dirty-bitmaps: add block_dirty_bitmap_check function block/dirty-bitmaps: prohibit readonly bitmaps for backups block/dirty-bitmaps: prohibit removing readonly bitmaps block/dirty-bitmaps: disallow busy bitmaps as merge source block/dirty-bitmaps: implement inconsistent bit
qemu-deprecated.texi | 6 ++ qapi/block-core.json | 28 +++++- include/block/dirty-bitmap.h | 20 +++- block/dirty-bitmap.c | 169 ++++++++++++++++++++++----------- block/qcow2-bitmap.c | 103 ++++++++++---------- blockdev.c | 51 ++-------- migration/block-dirty-bitmap.c | 18 ++-- nbd/server.c | 13 ++- tests/qemu-iotests/124 | 113 ++++++++++++++++++++++ tests/qemu-iotests/124.out | 4 +- tests/qemu-iotests/236.out | 28 ++++++ 11 files changed, 377 insertions(+), 176 deletions(-)
Signature · 1 line
2.17.2
[Qemu-devel] [PULL 03/17] block/dirty-bitmap: remove set/reset assertions against enabled bit
bdrv_set_dirty_bitmap and bdrv_reset_dirty_bitmap are only used as an internal API by the mirror and migration areas of our code. These calls modify the bitmap, but do so at the behest of QEMU and not the guest.
Presently, these bitmaps are always "enabled" anyway, but there's no reason they have to be.
Modify these internal APIs to drop this assertion.
Message-id: [email protected]
--- block/dirty-bitmap.c | 2 -- 1 file changed, 2 deletions(-)
block/dirty-bitmap.c +0 -2
@@ -544,7 +544,6 @@ int64_t bdrv_dirty_iter_next(BdrvDirtyBitmapIter *iter)void bdrv_set_dirty_bitmap_locked (BdrvDirtyBitmap *bitmap,int64_t offset,int64_t bytes) { -assert (bdrv_dirty_bitmap_enabled (bitmap));assert (!bdrv_dirty_bitmap_readonly (bitmap));hbitmap_set (bitmap->bitmap, offset, bytes); }
@@ -561,7 +560,6 @@ void bdrv_set_dirty_bitmap(BdrvDirtyBitmap *bitmap,void bdrv_reset_dirty_bitmap_locked (BdrvDirtyBitmap *bitmap,int64_t offset,int64_t bytes) { -assert (bdrv_dirty_bitmap_enabled (bitmap));assert (!bdrv_dirty_bitmap_readonly (bitmap));hbitmap_reset (bitmap->bitmap, offset, bytes); }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL 02/17] block/dirty-bitmaps: rename frozen predicate helper
In reply to John Snow"Frozen" was a good description a long time ago, but it isn't adequate now. Rename the frozen predicate to has_successor to make the semantics of the predicate more clear to outside callers.
In the process, remove some calls to frozen() that no longer semantically make sense. For bdrv_enable_dirty_bitmap_locked and bdrv_disable_dirty_bitmap_locked, it doesn't make sense to prohibit QEMU internals from performing this action when we only wished to prohibit QMP users from issuing these commands. All of the QMP API commands for bitmap manipulation already check against user_locked() to prohibit these actions.
Several other assertions really want to check that the bitmap isn't in-use by another operation -- use the bitmap_user_locked function for this instead, which presently also checks for has_successor. This leaves some redundant checks of has_successor through different helpers that are addressed in forthcoming patches.
Message-id: [email protected]
--- include/block/dirty-bitmap.h | 2 +- block/dirty-bitmap.c | 34 +++++++++++++++++++--------------- migration/block-dirty-bitmap.c | 2 +- 3 files changed, 21 insertions(+), 17 deletions(-)
include/block/dirty-bitmap.h +1 -1
@@ -36,7 +36,7 @@ BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs);uint32_t bdrv_get_default_bitmap_granularity (BlockDriverState *bs);uint32_t bdrv_dirty_bitmap_granularity (const BdrvDirtyBitmap *bitmap);bool bdrv_dirty_bitmap_enabled (BdrvDirtyBitmap *bitmap); -bool bdrv_dirty_bitmap_frozen (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);
block/dirty-bitmap.c +19 -15
@@ -50,7 +50,7 @@ struct BdrvDirtyBitmap {HBitmap *meta;/* Meta dirty bitmap */ bool qmp_locked;/* Bitmap is locked, it can't be modified through QMP */ -BdrvDirtyBitmap *successor;/* Anonymous child; implies frozen status */ +BdrvDirtyBitmap *successor;/* Anonymous child; implies user_locked state */ char *name;/* Optional non-empty unique ID */ int64_t size;/* Size of the bitmap, in bytes */ bool disabled;/* Bitmap is disabled. It ignores all writes to
@@ -183,14 +183,14 @@ const char *bdrv_dirty_bitmap_name(const BdrvDirtyBitmap *bitmap) }/* Called with BQL taken. */ -bool bdrv_dirty_bitmap_frozen (BdrvDirtyBitmap *bitmap) +bool bdrv_dirty_bitmap_has_successor (BdrvDirtyBitmap *bitmap) {return bitmap->successor; }/* Both conditions disallow user-modification via QMP. */ bool bdrv_dirty_bitmap_user_locked (BdrvDirtyBitmap *bitmap) { -return bdrv_dirty_bitmap_frozen (bitmap) || +return bdrv_dirty_bitmap_has_successor (bitmap) ||bdrv_dirty_bitmap_qmp_locked (bitmap); }
@@ -215,7 +215,7 @@ bool bdrv_dirty_bitmap_enabled(BdrvDirtyBitmap *bitmap)/* Called with BQL taken. */ DirtyBitmapStatus bdrv_dirty_bitmap_status (BdrvDirtyBitmap *bitmap) { -if (bdrv_dirty_bitmap_frozen (bitmap)) { +if (bdrv_dirty_bitmap_has_successor (bitmap)) {return DIRTY_BITMAP_STATUS_FROZEN ; }else if (bdrv_dirty_bitmap_qmp_locked (bitmap)) {return DIRTY_BITMAP_STATUS_LOCKED ;
@@ -235,7 +235,7 @@ static bool bdrv_dirty_bitmap_recording(BdrvDirtyBitmap *bitmap)/** * Create a successor bitmap destined to replace this bitmap after an operation. -* Requires that the bitmap is not frozen and has no successor. +* Requires that the bitmap is not user_locked and has no successor. * Called with BQL taken. */ int bdrv_dirty_bitmap_create_successor(BlockDriverState *bs,
@@ -244,12 +244,16 @@ int bdrv_dirty_bitmap_create_successor(BlockDriverState *bs,uint64_t granularity;BdrvDirtyBitmap *child; -if (bdrv_dirty_bitmap_frozen (bitmap)) { -error_setg (errp,"Cannot create a successor for a bitmap that is " -"currently frozen" ); +if (bdrv_dirty_bitmap_user_locked (bitmap)) { +error_setg (errp,"Cannot create a successor for a bitmap that is in-use " +"by an operation" ); +return -1 ; + } +if (bdrv_dirty_bitmap_has_successor (bitmap)) { +error_setg (errp,"Cannot create a successor for a bitmap that already " +"has one" );return -1 ; } -assert (!bitmap->successor);/* Create an anonymous successor */ granularity =bdrv_dirty_bitmap_granularity (bitmap);
@@ -268,7 +272,6 @@ int bdrv_dirty_bitmap_create_successor(BlockDriverState *bs,void bdrv_enable_dirty_bitmap_locked (BdrvDirtyBitmap *bitmap) { -assert (!bdrv_dirty_bitmap_frozen (bitmap)); bitmap->disabled = false; }
@@ -285,7 +288,8 @@ void bdrv_dirty_bitmap_enable_successor(BdrvDirtyBitmap *bitmap)static void bdrv_release_dirty_bitmap_locked (BdrvDirtyBitmap *bitmap) {assert (!bitmap->active_iterators); -assert (!bdrv_dirty_bitmap_frozen (bitmap)); +assert (!bdrv_dirty_bitmap_user_locked (bitmap)); +assert (!bdrv_dirty_bitmap_has_successor (bitmap));assert (!bitmap->meta);QLIST_REMOVE (bitmap, list);hbitmap_free (bitmap->bitmap);
@@ -325,7 +329,7 @@ BdrvDirtyBitmap *bdrv_dirty_bitmap_abdicate(BlockDriverState *bs,/** * In cases of failure where we can no longer safely delete the parent, * we may wish to re-join the parent and child/successor. -* The merged parent will be un-frozen, but not explicitly re-enabled. +* The merged parent will not be user_locked, nor explicitly re-enabled. * Called within bdrv_dirty_bitmap_lock..unlock and with BQL taken. */ BdrvDirtyBitmap *bdrv_reclaim_dirty_bitmap_locked(BlockDriverState *bs,
@@ -373,7 +377,8 @@ void bdrv_dirty_bitmap_truncate(BlockDriverState *bs, int64_t bytes)bdrv_dirty_bitmaps_lock (bs); QLIST_FOREACH(bitmap, &bs->dirty_bitmaps, list) { -assert (!bdrv_dirty_bitmap_frozen (bitmap)); +assert (!bdrv_dirty_bitmap_user_locked (bitmap)); +assert (!bdrv_dirty_bitmap_has_successor (bitmap));assert (!bitmap->active_iterators);hbitmap_truncate (bitmap->bitmap, bytes); bitmap->size = bytes;
@@ -391,7 +396,7 @@ void bdrv_release_dirty_bitmap(BlockDriverState *bs, BdrvDirtyBitmap *bitmap)/** * Release all named dirty bitmaps attached to a BDS (for use in bdrv_close()). -* There must not be any frozen bitmaps attached. +* There must not be any user_locked bitmaps attached. * This function does not remove persistent bitmaps from the storage. * Called with BQL taken. */
@@ -428,7 +433,6 @@ void bdrv_remove_persistent_dirty_bitmap(BlockDriverState *bs,void bdrv_disable_dirty_bitmap (BdrvDirtyBitmap *bitmap) {bdrv_dirty_bitmap_lock (bitmap); -assert (!bdrv_dirty_bitmap_frozen (bitmap)); bitmap->disabled = true;bdrv_dirty_bitmap_unlock (bitmap); }
migration/block-dirty-bitmap.c +1 -1
@@ -542,7 +542,7 @@ static void dirty_bitmap_load_complete(QEMUFile *f, DirtyBitmapLoadState *s) } } -if (bdrv_dirty_bitmap_frozen (s->bitmap)) { +if (bdrv_dirty_bitmap_has_successor (s->bitmap)) {bdrv_dirty_bitmap_lock (s->bitmap);if (enabled_bitmaps ==NULL ) {/* in postcopy */
Signature · 1 line
2.17.2
[Qemu-devel] [PULL 04/17] block/dirty-bitmap: change semantics of enabled predicate
In reply to John SnowCurrently, the enabled predicate means something like:
"the QAPI status of the bitmap is ACTIVE."
After this patch, it should mean exclusively:
"This bitmap is recording guest writes, and is allowed to do so."
In many places, this is how this predicate was already used. Internal usages of the bitmap QPI can call user_locked to find out if the bitmap is in use by an operation.
To accommodate this, modify the create_successor routine to now explicitly disable the parent bitmap at creation time.
Justifications:
1. bdrv_dirty_bitmap_status suffers no change from the lack of 1:1 parity with the new predicates because of the order in which the predicates are checked. This is now only for compatibility.
2. bdrv_set_dirty() is unchanged: pre-patch, it was skipping bitmaps that were disabled or had a successor, while post-patch it is only skipping bitmaps that are disabled. To accommodate this, create_successor now ensures that any bitmap with a successor is explicitly disabled.
3. qcow2_store_persistent_dirty_bitmaps: No functional change. This function cares only about the literal enabled bit, and makes no effort to check if the bitmap is in-use or not. After this patch there are still no ways to produce an enabled bitmap with a successor.
4. block_dirty_bitmap_enable_prepare
block_dirty_bitmap_disable_prepare
init_dirty_bitmap_migration
nbd_export_new
These functions care about the literal enabled bit, and already check user_locked separately.
Message-id: [email protected]
--- block/dirty-bitmap.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
block/dirty-bitmap.c +7 -2
@@ -209,7 +209,7 @@ bool bdrv_dirty_bitmap_qmp_locked(BdrvDirtyBitmap *bitmap)/* Called with BQL taken. */ bool bdrv_dirty_bitmap_enabled (BdrvDirtyBitmap *bitmap) { -return !(bitmap->disabled || bitmap->successor); +return !bitmap->disabled; }/* Called with BQL taken. */
@@ -236,6 +236,7 @@ static bool bdrv_dirty_bitmap_recording(BdrvDirtyBitmap *bitmap)/** * Create a successor bitmap destined to replace this bitmap after an operation. * Requires that the bitmap is not user_locked and has no successor. +* The successor will be enabled if the parent bitmap was. * Called with BQL taken. */ int bdrv_dirty_bitmap_create_successor(BlockDriverState *bs,
@@ -264,6 +265,7 @@ int bdrv_dirty_bitmap_create_successor(BlockDriverState *bs,/* Successor will be on or off based on our current state. */ child->disabled = bitmap->disabled; + bitmap->disabled = true;/* Install the successor and freeze the parent */ bitmap->successor = child;
@@ -329,7 +331,8 @@ BdrvDirtyBitmap *bdrv_dirty_bitmap_abdicate(BlockDriverState *bs,/** * In cases of failure where we can no longer safely delete the parent, * we may wish to re-join the parent and child/successor. -* The merged parent will not be user_locked, nor explicitly re-enabled. +* The merged parent will not be user_locked. +* The marged parent will be enabled if and only if the successor was enabled. * Called within bdrv_dirty_bitmap_lock..unlock and with BQL taken. */ BdrvDirtyBitmap *bdrv_reclaim_dirty_bitmap_locked(BlockDriverState *bs,
@@ -347,6 +350,8 @@ BdrvDirtyBitmap *bdrv_reclaim_dirty_bitmap_locked(BlockDriverState *bs,error_setg (errp,"Merging of parent and successor bitmap failed" );return NULL ; } + + parent->disabled = successor->disabled;bdrv_release_dirty_bitmap_locked (successor); parent->successor =NULL ;
Signature · 1 line
2.17.2
[Qemu-devel] [PULL 05/17] nbd: change error checking order for bitmaps
In reply to John SnowCheck that the bitmap is not in use prior to it checking if it is not enabled/recording guest writes. The bitmap being busy was likely at the behest of the user, so this error has a greater chance of being understood by the user.
Message-id: [email protected]
--- nbd/server.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
nbd/server.c +5 -5
@@ -1510,6 +1510,11 @@ NBDExport *nbd_export_new(BlockDriverState *bs, uint64_t dev_offset, goto fail; } +if (bdrv_dirty_bitmap_user_locked (bm)) { +error_setg (errp,"Bitmap '%s' is in use" , bitmap); + goto fail; + } +if ((nbdflags &NBD_FLAG_READ_ONLY ) &&bdrv_is_writable (bs) &&bdrv_dirty_bitmap_enabled (bm)) { error_setg(errp,
@@ -1518,11 +1523,6 @@ NBDExport *nbd_export_new(BlockDriverState *bs, uint64_t dev_offset, goto fail; } -if (bdrv_dirty_bitmap_user_locked (bm)) { -error_setg (errp,"Bitmap '%s' is in use" , bitmap); - goto fail; - } -bdrv_dirty_bitmap_set_qmp_locked (bm, true); exp->export_bitmap = bm; exp->export_bitmap_context = g_strdup_printf("qemu:dirty-bitmap:%s",
Signature · 1 line
2.17.2
[Qemu-devel] [PULL 14/17] block/dirty-bitmaps: prohibit readonly bitmaps for backups
In reply to John Snowdrive and blockdev backup cannot use readonly bitmaps, because the sync=incremental mechanism actually edits the bitmaps on success.
If you really want to do this operation, use a copied bitmap.
Message-id: [email protected]
--- blockdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
blockdev.c +2 -2
@@ -3533,7 +3533,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn,bdrv_unref (target_bs); goto out; } -if (bdrv_dirty_bitmap_check (bmap,BDRV_BITMAP_ALLOW_RO , errp)) { +if (bdrv_dirty_bitmap_check (bmap,BDRV_BITMAP_DEFAULT , errp)) { goto out; } }
@@ -3643,7 +3643,7 @@ BlockJob *do_blockdev_backup(BlockdevBackup *backup, JobTxn *txn,error_setg (errp,"Bitmap '%s' could not be found" , backup->bitmap); goto out; } -if (bdrv_dirty_bitmap_check (bmap,BDRV_BITMAP_ALLOW_RO , errp)) { +if (bdrv_dirty_bitmap_check (bmap,BDRV_BITMAP_DEFAULT , errp)) { goto out; } }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL 09/17] blockdev: remove unused paio parameter documentation
In reply to John SnowThis field isn't present anymore.
Message-id: [email protected]
--- blockdev.c | 1 - 1 file changed, 1 deletion(-)
blockdev.c +0 -1
@@ -1255,7 +1255,6 @@ out_aio_context:* @node: The name of the BDS node to search for bitmaps * @name: The name of the bitmap to search for * @pbs: Output pointer for BDS lookup, if desired. Can be NULL. -* @paio: Output pointer for aio_context acquisition, if desired. Can be NULL. * @errp: Output pointer for error information. Can be NULL. * * @return: A bitmap object on success, or NULL on failure.
Signature · 1 line
2.17.2
[Qemu-devel] [PULL 12/17] block/dirty-bitmap: add inconsistent status
In reply to John SnowEven though the status field is deprecated, we still have to support it for a few more releases. Since this is a very new kind of bitmap state, it makes sense for it to have its own status field.
Message-id: [email protected]
--- qapi/block-core.json | 7 ++++++- block/dirty-bitmap.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-)
qapi/block-core.json +6 -1
@@ -442,10 +442,15 @@ # 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'] } + 'data': ['active', 'disabled', 'frozen', 'locked', 'inconsistent'] } ## # @BlockDirtyInfo:
block/dirty-bitmap.c +6 -1
@@ -209,10 +209,15 @@ bool bdrv_dirty_bitmap_enabled(BdrvDirtyBitmap *bitmap)* 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_has_successor (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 ;
Signature · 1 line
2.17.2
[Qemu-devel] [PULL 06/17] block/dirty-bitmap: explicitly lock bitmaps with successors
In reply to John SnowInstead of implying a user_locked/busy status, make it explicit. Now, bitmaps in use by migration, NBD or backup operations are all treated the same way with the same code paths.
Message-id: [email protected]
--- block/dirty-bitmap.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
block/dirty-bitmap.c +6 -5
@@ -50,7 +50,7 @@ struct BdrvDirtyBitmap {HBitmap *meta;/* Meta dirty bitmap */ bool qmp_locked;/* Bitmap is locked, it can't be modified through QMP */ -BdrvDirtyBitmap *successor;/* Anonymous child; implies user_locked state */ +BdrvDirtyBitmap *successor;/* Anonymous child, if any. */ char *name;/* Optional non-empty unique ID */ int64_t size;/* Size of the bitmap, in bytes */ bool disabled;/* Bitmap is disabled. It ignores all writes to
@@ -188,10 +188,8 @@ bool bdrv_dirty_bitmap_has_successor(BdrvDirtyBitmap *bitmap)return bitmap->successor; } -/* Both conditions disallow user-modification via QMP. */ bool bdrv_dirty_bitmap_user_locked (BdrvDirtyBitmap *bitmap) { -return bdrv_dirty_bitmap_has_successor (bitmap) || -bdrv_dirty_bitmap_qmp_locked (bitmap); +return bdrv_dirty_bitmap_qmp_locked (bitmap); }void bdrv_dirty_bitmap_set_qmp_locked (BdrvDirtyBitmap *bitmap,bool qmp_locked)
@@ -267,8 +265,9 @@ int bdrv_dirty_bitmap_create_successor(BlockDriverState *bs, child->disabled = bitmap->disabled; bitmap->disabled = true; -/* Install the successor and freeze the parent */ +/* Install the successor and lock the parent */ bitmap->successor = child; + bitmap->qmp_locked = true;return 0 ; }
@@ -323,6 +322,7 @@ BdrvDirtyBitmap *bdrv_dirty_bitmap_abdicate(BlockDriverState *bs, bitmap->successor =NULL ; successor->persistent = bitmap->persistent; bitmap->persistent = false; + bitmap->qmp_locked = false;bdrv_release_dirty_bitmap (bs, bitmap);return successor;
@@ -352,6 +352,7 @@ BdrvDirtyBitmap *bdrv_reclaim_dirty_bitmap_locked(BlockDriverState *bs, } parent->disabled = successor->disabled; + parent->qmp_locked = false;bdrv_release_dirty_bitmap_locked (successor); parent->successor =NULL ;
Signature · 1 line
2.17.2
[Qemu-devel] [PULL 08/17] block/dirty-bitmaps: move comment block
In reply to John SnowSimply move the big status enum comment block to above the status function, and document it as being deprecated. The whole confusing block can get deleted in three releases time.
Message-id: [email protected]
--- block/dirty-bitmap.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-)
block/dirty-bitmap.c +19 -17
@@ -28,22 +28,6 @@#include "block/block_int.h" #include "block/blockjob.h" -/** -* 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), -* but 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. -*/ struct BdrvDirtyBitmap {QemuMutex *mutex;HBitmap *bitmap;/* Dirty bitmap implementation */
@@ -204,7 +188,25 @@ bool bdrv_dirty_bitmap_enabled(BdrvDirtyBitmap *bitmap)return !bitmap->disabled; } -/* Called with BQL taken. */ +/** +* 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. +*/ DirtyBitmapStatus bdrv_dirty_bitmap_status (BdrvDirtyBitmap *bitmap) {if (bdrv_dirty_bitmap_has_successor (bitmap)) {
Signature · 1 line
2.17.2
[Qemu-devel] [PULL 07/17] block/dirty-bitmaps: unify qmp_locked and user_locked calls
In reply to John SnowThese mean the same thing now. Unify them and rename the merged call bdrv_dirty_bitmap_busy to indicate semantically what we are describing, as well as help disambiguate from the various _locked and _unlocked versions of bitmap helpers that refer to mutex locks.
Message-id: [email protected]
--- include/block/dirty-bitmap.h | 5 ++-- block/dirty-bitmap.c | 42 +++++++++++++++------------------- blockdev.c | 18 +++++++-------- migration/block-dirty-bitmap.c | 6 ++--- nbd/server.c | 6 ++--- 5 files changed, 35 insertions(+), 42 deletions(-)
include/block/dirty-bitmap.h +2 -3
@@ -68,7 +68,7 @@ void bdrv_dirty_bitmap_deserialize_finish(BdrvDirtyBitmap *bitmap);void bdrv_dirty_bitmap_set_readonly (BdrvDirtyBitmap *bitmap,bool value);void bdrv_dirty_bitmap_set_persistance (BdrvDirtyBitmap *bitmap,bool persistent); -void bdrv_dirty_bitmap_set_qmp_locked (BdrvDirtyBitmap *bitmap,bool qmp_locked); +void bdrv_dirty_bitmap_set_busy (BdrvDirtyBitmap *bitmap,bool busy);void bdrv_merge_dirty_bitmap (BdrvDirtyBitmap *dest,const BdrvDirtyBitmap *src,HBitmap **backup,Error **errp);void bdrv_dirty_bitmap_set_migration (BdrvDirtyBitmap *bitmap,bool migration);
@@ -91,8 +91,7 @@ bool bdrv_dirty_bitmap_readonly(const BdrvDirtyBitmap *bitmap);bool bdrv_has_readonly_bitmaps (BlockDriverState *bs);bool bdrv_dirty_bitmap_get_autoload (const BdrvDirtyBitmap *bitmap);bool bdrv_dirty_bitmap_get_persistance (BdrvDirtyBitmap *bitmap); -bool bdrv_dirty_bitmap_qmp_locked (BdrvDirtyBitmap *bitmap); -bool bdrv_dirty_bitmap_user_locked (BdrvDirtyBitmap *bitmap); +bool bdrv_dirty_bitmap_busy (BdrvDirtyBitmap *bitmap);bool bdrv_has_changed_persistent_bitmaps (BlockDriverState *bs);BdrvDirtyBitmap *bdrv_dirty_bitmap_next (BlockDriverState *bs,BdrvDirtyBitmap *bitmap);
block/dirty-bitmap.c +18 -24
134 lines not on this page · raw message
blockdev.c +9 -9
@@ -2009,7 +2009,7 @@ static void block_dirty_bitmap_clear_prepare(BlkActionState *common,return ; } -if (bdrv_dirty_bitmap_user_locked (state->bitmap)) { +if (bdrv_dirty_bitmap_busy (state->bitmap)) {error_setg (errp,"Cannot modify a bitmap in use by another operation" );return ; }else if (bdrv_dirty_bitmap_readonly (state->bitmap)) {
@@ -2058,7 +2058,7 @@ static void block_dirty_bitmap_enable_prepare(BlkActionState *common,return ; } -if (bdrv_dirty_bitmap_user_locked (state->bitmap)) { +if (bdrv_dirty_bitmap_busy (state->bitmap)) {error_setg (errp,"Bitmap '%s' is currently in use by another operation" " and cannot be enabled" , action->name);
@@ -2099,7 +2099,7 @@ static void block_dirty_bitmap_disable_prepare(BlkActionState *common,return ; } -if (bdrv_dirty_bitmap_user_locked (state->bitmap)) { +if (bdrv_dirty_bitmap_busy (state->bitmap)) {error_setg (errp,"Bitmap '%s' is currently in use by another operation" " and cannot be disabled" , action->name);
@@ -2893,7 +2893,7 @@ void qmp_block_dirty_bitmap_remove(const char *node, const char *name,return ; } -if (bdrv_dirty_bitmap_user_locked (bitmap)) { +if (bdrv_dirty_bitmap_busy (bitmap)) {error_setg (errp,"Bitmap '%s' is currently in use by another operation and" " cannot be removed" , name);
@@ -2932,7 +2932,7 @@ void qmp_block_dirty_bitmap_clear(const char *node, const char *name,return ; } -if (bdrv_dirty_bitmap_user_locked (bitmap)) { +if (bdrv_dirty_bitmap_busy (bitmap)) {error_setg (errp,"Bitmap '%s' is currently in use by another operation" " and cannot be cleared" , name);
@@ -2956,7 +2956,7 @@ void qmp_block_dirty_bitmap_enable(const char *node, const char *name,return ; } -if (bdrv_dirty_bitmap_user_locked (bitmap)) { +if (bdrv_dirty_bitmap_busy (bitmap)) {error_setg (errp,"Bitmap '%s' is currently in use by another operation" " and cannot be enabled" , name);
@@ -2977,7 +2977,7 @@ void qmp_block_dirty_bitmap_disable(const char *node, const char *name,return ; } -if (bdrv_dirty_bitmap_user_locked (bitmap)) { +if (bdrv_dirty_bitmap_busy (bitmap)) {error_setg (errp,"Bitmap '%s' is currently in use by another operation" " and cannot be disabled" , name);
@@ -3559,7 +3559,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn,bdrv_unref (target_bs); goto out; } -if (bdrv_dirty_bitmap_user_locked (bmap)) { +if (bdrv_dirty_bitmap_busy (bmap)) {error_setg (errp,"Bitmap '%s' is currently in use by another operation" " and cannot be used for backup" , backup->bitmap);
@@ -3672,7 +3672,7 @@ BlockJob *do_blockdev_backup(BlockdevBackup *backup, JobTxn *txn,error_setg (errp,"Bitmap '%s' could not be found" , backup->bitmap); goto out; } -if (bdrv_dirty_bitmap_user_locked (bmap)) { +if (bdrv_dirty_bitmap_busy (bmap)) {error_setg (errp,"Bitmap '%s' is currently in use by another operation" " and cannot be used for backup" , backup->bitmap);
migration/block-dirty-bitmap.c +3 -3
@@ -261,7 +261,7 @@ static void dirty_bitmap_mig_cleanup(void)while ((dbms =QSIMPLEQ_FIRST (&dirty_bitmap_mig_state.dbms_list)) !=NULL ) {QSIMPLEQ_REMOVE_HEAD (&dirty_bitmap_mig_state.dbms_list, entry); -bdrv_dirty_bitmap_set_qmp_locked (dbms->bitmap, false); +bdrv_dirty_bitmap_set_busy (dbms->bitmap, false);bdrv_unref (dbms->bs);g_free (dbms); }
@@ -301,7 +301,7 @@ static int init_dirty_bitmap_migration(void) goto fail; } -if (bdrv_dirty_bitmap_user_locked (bitmap)) { +if (bdrv_dirty_bitmap_busy (bitmap)) {error_report ("Can't migrate a bitmap that is in use by another operation: '%s'" ,bdrv_dirty_bitmap_name (bitmap)); goto fail;
@@ -314,7 +314,7 @@ static int init_dirty_bitmap_migration(void) }bdrv_ref (bs); -bdrv_dirty_bitmap_set_qmp_locked (bitmap, true); +bdrv_dirty_bitmap_set_busy (bitmap, true); dbms =g_new0 (DirtyBitmapMigBitmapState,1 ); dbms->bs = bs;
nbd/server.c +3 -3
@@ -1510,7 +1510,7 @@ NBDExport *nbd_export_new(BlockDriverState *bs, uint64_t dev_offset, goto fail; } -if (bdrv_dirty_bitmap_user_locked (bm)) { +if (bdrv_dirty_bitmap_busy (bm)) {error_setg (errp,"Bitmap '%s' is in use" , bitmap); goto fail; }
@@ -1523,7 +1523,7 @@ NBDExport *nbd_export_new(BlockDriverState *bs, uint64_t dev_offset, goto fail; } -bdrv_dirty_bitmap_set_qmp_locked (bm, true); +bdrv_dirty_bitmap_set_busy (bm, true); exp->export_bitmap = bm; exp->export_bitmap_context =g_strdup_printf ("qemu:dirty-bitmap:%s" , bitmap);
@@ -1641,7 +1641,7 @@ void nbd_export_put(NBDExport *exp) }if (exp->export_bitmap) { -bdrv_dirty_bitmap_set_qmp_locked (exp->export_bitmap, false); +bdrv_dirty_bitmap_set_busy (exp->export_bitmap, false);g_free (exp->export_bitmap_context); }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL 11/17] block/dirty-bitmaps: add inconsistent bit
In reply to John SnowAdd an inconsistent bit to dirty-bitmaps that allows us to report a bitmap as persistent but potentially inconsistent, i.e. if we find bitmaps on a qcow2 that have been marked as "in use".
Message-id: [email protected]
--- qapi/block-core.json | 13 +++++++++---- include/block/dirty-bitmap.h | 2 ++ block/dirty-bitmap.c | 20 ++++++++++++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-)
qapi/block-core.json +9 -4
@@ -467,15 +467,20 @@ # and cannot be modified via QMP or used by another operation. # Replaces `locked` and `frozen` statuses. (since 4.0) # -# @persistent: true if the bitmap will eventually be flushed to persistent -# storage (since 4.0) +# @persistent: true if the bitmap was stored on disk, is scheduled to be stored +# on disk, or both. (since 4.0) +# +# @inconsistent: true if this is a persistent bitmap that was improperly +# stored. Implies @persistent to be true; @recording and +# @busy to be false. This bitmap cannot be used. To remove +# it, use @block-dirty-bitmap-remove. (Since 4.0) # # Since: 1.3 ## { 'struct': 'BlockDirtyInfo', 'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32', - 'recording': 'bool', 'busy': 'bool', - 'status': 'DirtyBitmapStatus', 'persistent': 'bool' } } + 'recording': 'bool', 'busy': 'bool', 'status': 'DirtyBitmapStatus', + 'persistent': 'bool', '*inconsistent': 'bool' } } ## # @Qcow2BitmapInfoFlags:
include/block/dirty-bitmap.h +2 -0
@@ -68,6 +68,7 @@ void bdrv_dirty_bitmap_deserialize_finish(BdrvDirtyBitmap *bitmap);void bdrv_dirty_bitmap_set_readonly (BdrvDirtyBitmap *bitmap,bool value);void bdrv_dirty_bitmap_set_persistance (BdrvDirtyBitmap *bitmap,bool persistent); +void bdrv_dirty_bitmap_set_inconsistent (BdrvDirtyBitmap *bitmap);void bdrv_dirty_bitmap_set_busy (BdrvDirtyBitmap *bitmap,bool busy);void bdrv_merge_dirty_bitmap (BdrvDirtyBitmap *dest,const BdrvDirtyBitmap *src,HBitmap **backup,Error **errp);
@@ -91,6 +92,7 @@ bool bdrv_dirty_bitmap_readonly(const BdrvDirtyBitmap *bitmap);bool bdrv_has_readonly_bitmaps (BlockDriverState *bs);bool bdrv_dirty_bitmap_get_autoload (const BdrvDirtyBitmap *bitmap);bool bdrv_dirty_bitmap_get_persistance (BdrvDirtyBitmap *bitmap); +bool bdrv_dirty_bitmap_inconsistent (const BdrvDirtyBitmap *bitmap);bool bdrv_dirty_bitmap_busy (BdrvDirtyBitmap *bitmap);bool bdrv_has_changed_persistent_bitmaps (BlockDriverState *bs); BdrvDirtyBitmap *bdrv_dirty_bitmap_next(BlockDriverState *bs,
block/dirty-bitmap.c +20 -0
@@ -46,6 +46,9 @@ struct BdrvDirtyBitmap {and this bitmap must remain unchanged while this flag is set. */ bool persistent;/* bitmap must be saved to owner disk image */ +bool inconsistent;/* bitmap is persistent, but inconsistent. +* It cannot be used at all in any way, except +* a QMP user can remove it. */ bool migration;/* Bitmap is selected for migration, it should not be stored on the next inactivation (persistent flag doesn't matter until next
@@ -464,6 +467,8 @@ BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs) info->recording =bdrv_dirty_bitmap_recording (bm); info->busy =bdrv_dirty_bitmap_busy (bm); info->persistent = bm->persistent; + info->has_inconsistent = bm->inconsistent; + info->inconsistent = bm->inconsistent; entry->value = info; *plist = entry; plist = &entry->next;
@@ -711,6 +716,16 @@ void bdrv_dirty_bitmap_set_persistance(BdrvDirtyBitmap *bitmap, bool persistent)qemu_mutex_unlock (bitmap->mutex); } +/* Called with BQL taken. */ +void bdrv_dirty_bitmap_set_inconsistent (BdrvDirtyBitmap *bitmap) +{ +qemu_mutex_lock (bitmap->mutex); +assert (bitmap->persistent == true); + bitmap->inconsistent = true; + bitmap->disabled = true; +qemu_mutex_unlock (bitmap->mutex); +} +/* Called with BQL taken. */ void bdrv_dirty_bitmap_set_migration (BdrvDirtyBitmap *bitmap,bool migration) {
@@ -724,6 +739,11 @@ bool bdrv_dirty_bitmap_get_persistance(BdrvDirtyBitmap *bitmap)return bitmap->persistent && !bitmap->migration; } +bool bdrv_dirty_bitmap_inconsistent (const BdrvDirtyBitmap *bitmap) +{ +return bitmap->inconsistent; +} +bool bdrv_has_changed_persistent_bitmaps (BlockDriverState *bs) {BdrvDirtyBitmap *bm;
Signature · 1 line
2.17.2
[Qemu-devel] [PULL 15/17] block/dirty-bitmaps: prohibit removing readonly bitmaps
In reply to John SnowRemove is an inherently RW operation, so this will fail anyway, but we can fail it very quickly instead of trying and failing, so do so.
Message-id: [email protected]
--- blockdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
blockdev.c +2 -1
@@ -2882,7 +2882,8 @@ void qmp_block_dirty_bitmap_remove(const char *node, const char *name,return ; } -if (bdrv_dirty_bitmap_check (bitmap,BDRV_BITMAP_BUSY , errp)) { +if (bdrv_dirty_bitmap_check (bitmap,BDRV_BITMAP_BUSY |BDRV_BITMAP_RO , + errp)) {return ; }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL 16/17] block/dirty-bitmaps: disallow busy bitmaps as merge source
In reply to John SnowWe didn't do any state checking on source bitmaps at all, so this adds inconsistent and busy checks. readonly is allowed, so you can still copy a readonly bitmap to a new destination to use it for operations like drive-backup.
Message-id: [email protected]
--- block/dirty-bitmap.c | 3 +++ 1 file changed, 3 insertions(+)
block/dirty-bitmap.c +3 -0
@@ -824,6 +824,9 @@ void bdrv_merge_dirty_bitmap(BdrvDirtyBitmap *dest, const BdrvDirtyBitmap *src, goto out; } +if (bdrv_dirty_bitmap_check (src,BDRV_BITMAP_ALLOW_RO , errp)) { + goto out; + }if (!hbitmap_can_merge (dest->bitmap, src->bitmap)) {error_setg (errp,"Bitmaps are incompatible and can't be merged" );
Signature · 1 line
2.17.2
[Qemu-devel] [PULL 10/17] iotests: add busy/recording bit test to 124
In reply to John SnowThis adds a simple test that ensures the busy bit works for push backups, as well as doubling as bonus test for incremental backups that get interrupted by EIO errors.
Recording bit tests are already handled sufficiently by 236.
Message-id: [email protected]
--- tests/qemu-iotests/124 | 113 +++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/124.out | 4 +- 2 files changed, 115 insertions(+), 2 deletions(-)
tests/qemu-iotests/124 +113 -0
@@ -634,6 +634,119 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBackupBase): self.vm.shutdown() self.check_backups() + def test_incremental_pause(self): + """ + Test an incremental backup that errors into a pause and is resumed. + """ + + drive0 = self.drives[0] + # NB: The blkdebug script here looks for a "flush, read, read" pattern. + # The flush occurs in hmp_io_writes, the first read in device_add, and + # the last read during the block job. + result = self.vm.qmp('blockdev-add', + node_name=drive0['id'], + driver=drive0['fmt'], + file={ + 'driver': 'blkdebug', + 'image': { + 'driver': 'file', + 'filename': drive0['file'] + }, + 'set-state': [{ + 'event': 'flush_to_disk', + 'state': 1, + 'new_state': 2 + },{ + 'event': 'read_aio', + 'state': 2, + 'new_state': 3 + }], + 'inject-error': [{ + 'event': 'read_aio', + 'errno': 5, + 'state': 3, + 'immediately': False, + 'once': True + }], + }) + self.assert_qmp(result, 'return', {}) + self.create_anchor_backup(drive0) + bitmap = self.add_bitmap('bitmap0', drive0) + + # Emulate guest activity + self.hmp_io_writes(drive0['id'], (('0xab', 0, 512), + ('0xfe', '16M', '256k'), + ('0x64', '32736k', '64k'))) + + # For the purposes of query-block visibility of bitmaps, add a drive + # frontend after we've written data; otherwise we can't use hmp-io + result = self.vm.qmp("device_add", + id="device0", + drive=drive0['id'], + driver="virtio-blk") + self.assert_qmp(result, 'return', {}) + + # Bitmap Status Check + query = self.vm.qmp('query-block') + ret = [bmap for bmap in query['return'][0]['dirty-bitmaps'] + if bmap.get('name') == bitmap.name][0] + self.assert_qmp(ret, 'count', 458752) + self.assert_qmp(ret, 'granularity', 65536) + self.assert_qmp(ret, 'status', 'active') + self.assert_qmp(ret, 'busy', False) + self.assert_qmp(ret, 'recording', True) + + # Start backup + parent, _ = bitmap.last_target() + target = self.prepare_backup(bitmap, parent) + res = self.vm.qmp('drive-backup', + job_id=bitmap.drive['id'], + device=bitmap.drive['id'], + sync='incremental', + bitmap=bitmap.name, + format=bitmap.drive['fmt'], + target=target, + mode='existing', + on_source_error='stop') + self.assert_qmp(res, 'return', {}) + + # Wait for the error + event = self.vm.event_wait(name="BLOCK_JOB_ERROR", + match={"data":{"device":bitmap.drive['id']}}) + self.assert_qmp(event, 'data', {'device': bitmap.drive['id'], + 'action': 'stop', + 'operation': 'read'}) + + # Bitmap Status Check + query = self.vm.qmp('query-block') + ret = [bmap for bmap in query['return'][0]['dirty-bitmaps'] + if bmap.get('name') == bitmap.name][0] + self.assert_qmp(ret, 'count', 458752) + self.assert_qmp(ret, 'granularity', 65536) + self.assert_qmp(ret, 'status', 'frozen') + self.assert_qmp(ret, 'busy', True) + self.assert_qmp(ret, 'recording', True) + + # Resume and check incremental backup for consistency + res = self.vm.qmp('block-job-resume', device=bitmap.drive['id']) + self.assert_qmp(res, 'return', {}) + self.wait_qmp_backup(bitmap.drive['id']) + + # Bitmap Status Check + query = self.vm.qmp('query-block') + ret = [bmap for bmap in query['return'][0]['dirty-bitmaps'] + if bmap.get('name') == bitmap.name][0] + self.assert_qmp(ret, 'count', 0) + self.assert_qmp(ret, 'granularity', 65536) + self.assert_qmp(ret, 'status', 'active') + self.assert_qmp(ret, 'busy', False) + self.assert_qmp(ret, 'recording', True) + + # Finalize / Cleanup + self.make_reference_backup(bitmap) + self.vm.shutdown() + self.check_backups() + if __name__ == '__main__': iotests.main(supported_fmts=['qcow2'])
tests/qemu-iotests/124.out +2 -2
@@ -1,5 +1,5 @@ -........... +............ ---------------------------------------------------------------------- -Ran 11 tests +Ran 12 tests OK
Signature · 1 line
2.17.2
[Qemu-devel] [PULL 13/17] block/dirty-bitmaps: add block_dirty_bitmap_check function
In reply to John SnowInstead of checking against busy, inconsistent, or read only directly, use a check function with permissions bits that let us streamline the checks without reproducing them in many places.
Included in this patch are permissions changes that simply add the inconsistent check to existing permissions call spots, without addressing existing bugs.
In general, this means that busy+readonly checks become BDRV_BITMAP_DEFAULT, which checks against all three conditions. busy-only checks become BDRV_BITMAP_ALLOW_RO.
Notably, remove allows inconsistent bitmaps, so it doesn't follow the pattern.
Message-id: [email protected]
--- include/block/dirty-bitmap.h | 13 ++++++++- block/dirty-bitmap.c | 42 ++++++++++++++++++++--------- blockdev.c | 49 +++++++--------------------------- migration/block-dirty-bitmap.c | 12 +++------ nbd/server.c | 3 +-- 5 files changed, 55 insertions(+), 64 deletions(-)
include/block/dirty-bitmap.h +12 -1
@@ -5,6 +5,16 @@#include "qapi/qapi-types-block-core.h" #include "qemu/hbitmap.h" +typedef enum BitmapCheckFlags { +BDRV_BITMAP_BUSY =1 , +BDRV_BITMAP_RO =2 , +BDRV_BITMAP_INCONSISTENT =4 , +}BitmapCheckFlags ; + +#define BDRV_BITMAP_DEFAULT (BDRV_BITMAP_BUSY | BDRV_BITMAP_RO | \ + BDRV_BITMAP_INCONSISTENT) +#define BDRV_BITMAP_ALLOW_RO (BDRV_BITMAP_BUSY | BDRV_BITMAP_INCONSISTENT) + BdrvDirtyBitmap *bdrv_create_dirty_bitmap(BlockDriverState *bs, uint32_t granularity, const char *name,
@@ -24,6 +34,8 @@ BdrvDirtyBitmap *bdrv_reclaim_dirty_bitmap(BlockDriverState *bs,void bdrv_dirty_bitmap_enable_successor (BdrvDirtyBitmap *bitmap);BdrvDirtyBitmap *bdrv_find_dirty_bitmap (BlockDriverState *bs,const char *name); +int bdrv_dirty_bitmap_check (const BdrvDirtyBitmap *bitmap,uint32_t flags, +Error **errp);void bdrv_release_dirty_bitmap (BlockDriverState *bs,BdrvDirtyBitmap *bitmap);void bdrv_release_named_dirty_bitmaps (BlockDriverState *bs); void bdrv_remove_persistent_dirty_bitmap(BlockDriverState *bs,
@@ -93,7 +105,6 @@ bool bdrv_has_readonly_bitmaps(BlockDriverState *bs);bool bdrv_dirty_bitmap_get_autoload (const BdrvDirtyBitmap *bitmap);bool bdrv_dirty_bitmap_get_persistance (BdrvDirtyBitmap *bitmap);bool bdrv_dirty_bitmap_inconsistent (const BdrvDirtyBitmap *bitmap); -bool bdrv_dirty_bitmap_busy (BdrvDirtyBitmap *bitmap);bool bdrv_has_changed_persistent_bitmaps (BlockDriverState *bs);BdrvDirtyBitmap *bdrv_dirty_bitmap_next (BlockDriverState *bs,BdrvDirtyBitmap *bitmap);
block/dirty-bitmap.c +30 -12
69 lines not on this page · raw message
blockdev.c +9 -40
103 lines not on this page · raw message
migration/block-dirty-bitmap.c +3 -9
@@ -274,6 +274,7 @@ static int init_dirty_bitmap_migration(void)BdrvDirtyBitmap *bitmap;DirtyBitmapMigBitmapState *dbms;BdrvNextIterator it; +Error *local_err =NULL ; dirty_bitmap_mig_state.bulk_completed = false; dirty_bitmap_mig_state.prev_bs =NULL ;
@@ -301,15 +302,8 @@ static int init_dirty_bitmap_migration(void) goto fail; } -if (bdrv_dirty_bitmap_busy (bitmap)) { -error_report ("Can't migrate a bitmap that is in use by another operation: '%s'" , -bdrv_dirty_bitmap_name (bitmap)); - goto fail; - } - -if (bdrv_dirty_bitmap_readonly (bitmap)) { -error_report ("Can't migrate read-only dirty bitmap: '%s" , -bdrv_dirty_bitmap_name (bitmap)); +if (bdrv_dirty_bitmap_check (bitmap,BDRV_BITMAP_DEFAULT , &local_err)) { +error_report_err (local_err); goto fail; }
nbd/server.c +1 -2
@@ -1510,8 +1510,7 @@ NBDExport *nbd_export_new(BlockDriverState *bs, uint64_t dev_offset, goto fail; } -if (bdrv_dirty_bitmap_busy (bm)) { -error_setg (errp,"Bitmap '%s' is in use" , bitmap); +if (bdrv_dirty_bitmap_check (bm,BDRV_BITMAP_ALLOW_RO , errp)) { goto fail; }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL 17/17] block/dirty-bitmaps: implement inconsistent bit
In reply to John SnowSet the inconsistent bit on load instead of rejecting such bitmaps. There is no way to un-set it; the only option is to delete the bitmap.
Obvervations:
- bitmap loading does not need to update the header for in_use bitmaps.
- inconsistent bitmaps don't need to have their data loaded; they're glorified corruption sentinels.
- bitmap saving does not need to save inconsistent bitmaps back to disk.
- bitmap reopening DOES need to drop the readonly flag from inconsistent bitmaps to allow reopening of qcow2 files with non-qemu-owned bitmaps being eventually flushed back to disk.
Message-id: [email protected]
--- block/qcow2-bitmap.c | 103 ++++++++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 50 deletions(-)
block/qcow2-bitmap.c +53 -50
@@ -343,9 +343,15 @@ static BdrvDirtyBitmap *load_bitmap(BlockDriverState *bs,uint32_t granularity;BdrvDirtyBitmap *bitmap =NULL ; + granularity =1U << bm->granularity_bits; + bitmap =bdrv_create_dirty_bitmap (bs, granularity, bm->name, errp); +if (bitmap ==NULL ) { + goto fail; + } +if (bm->flags &BME_FLAG_IN_USE ) { -error_setg (errp,"Bitmap '%s' is in use" , bm->name); - goto fail; +/* Data is unusable, skip loading it */ +return bitmap; } ret =bitmap_table_load (bs, &bm->table, &bitmap_table);
@@ -356,12 +362,6 @@ static BdrvDirtyBitmap *load_bitmap(BlockDriverState *bs, goto fail; } - granularity =1U << bm->granularity_bits; - bitmap =bdrv_create_dirty_bitmap (bs, granularity, bm->name, errp); -if (bitmap ==NULL ) { - goto fail; - } - ret =load_bitmap_data (bs, bitmap_table, bm->table.size, bitmap);if (ret <0 ) { error_setg_errno(errp, -ret, "Could not read bitmap '%s' from image",
@@ -949,6 +949,7 @@ bool qcow2_load_dirty_bitmaps(BlockDriverState *bs, Error **errp)Qcow2Bitmap *bm;GSList *created_dirty_bitmaps =NULL ;bool header_updated = false; +bool needs_update = false;if (s->nb_bitmaps ==0 ) {/* No bitmaps - nothing to do */
@@ -962,35 +963,39 @@ bool qcow2_load_dirty_bitmaps(BlockDriverState *bs, Error **errp) } QSIMPLEQ_FOREACH(bm, bm_list, entry) { -if (!(bm->flags &BME_FLAG_IN_USE )) { -BdrvDirtyBitmap *bitmap =load_bitmap (bs, bm, errp); -if (bitmap ==NULL ) { - goto fail; - } - -if (!(bm->flags &BME_FLAG_AUTO )) { -bdrv_disable_dirty_bitmap (bitmap); - } -bdrv_dirty_bitmap_set_persistance (bitmap, true); - bm->flags |=BME_FLAG_IN_USE ; - created_dirty_bitmaps = -g_slist_append (created_dirty_bitmaps, bitmap); +BdrvDirtyBitmap *bitmap =load_bitmap (bs, bm, errp); +if (bitmap ==NULL ) { + goto fail; } - } -if (created_dirty_bitmaps !=NULL ) { -if (can_write (bs)) { -/* in_use flags must be updated */ -int ret =update_ext_header_and_dir_in_place (bs, bm_list); -if (ret <0 ) { -error_setg_errno (errp, -ret,"Can't update bitmap directory" ); - goto fail; - } - header_updated = true; +bdrv_dirty_bitmap_set_persistance (bitmap, true); +if (bm->flags &BME_FLAG_IN_USE ) { +bdrv_dirty_bitmap_set_inconsistent (bitmap); }else { -g_slist_foreach (created_dirty_bitmaps, set_readonly_helper, - (gpointer )true); +/* NB: updated flags only get written if can_write(bs) is true. */ + bm->flags |=BME_FLAG_IN_USE ; + needs_update = true; } +if (!(bm->flags &BME_FLAG_AUTO )) { +bdrv_disable_dirty_bitmap (bitmap); + } + created_dirty_bitmaps = +g_slist_append (created_dirty_bitmaps, bitmap); + } + +if (needs_update &&can_write (bs)) { +/* in_use flags must be updated */ +int ret =update_ext_header_and_dir_in_place (bs, bm_list); +if (ret <0 ) { +error_setg_errno (errp, -ret,"Can't update bitmap directory" ); + goto fail; + } + header_updated = true; + } + +if (!can_write (bs)) { +g_slist_foreach (created_dirty_bitmaps, set_readonly_helper, + (gpointer )true); }g_slist_free (created_dirty_bitmaps);
@@ -1112,23 +1117,21 @@ int qcow2_reopen_bitmaps_rw_hint(BlockDriverState *bs, bool *header_updated, } QSIMPLEQ_FOREACH(bm, bm_list, entry) { -if (!(bm->flags &BME_FLAG_IN_USE )) { -BdrvDirtyBitmap *bitmap =bdrv_find_dirty_bitmap (bs, bm->name); -if (bitmap ==NULL ) { -continue ; - } - -if (!bdrv_dirty_bitmap_readonly (bitmap)) { -error_setg (errp,"Bitmap %s is not readonly but not marked" -"'IN_USE' in the image. Something went wrong," -"all the bitmaps may be corrupted" , bm->name); - ret = -EINVAL ; - goto out; - } +BdrvDirtyBitmap *bitmap =bdrv_find_dirty_bitmap (bs, bm->name); +if (bitmap ==NULL ) { +continue ; + } - bm->flags |=BME_FLAG_IN_USE ; - ro_dirty_bitmaps =g_slist_append (ro_dirty_bitmaps, bitmap); +if (!bdrv_dirty_bitmap_readonly (bitmap)) { +error_setg (errp,"Bitmap %s was loaded prior to rw-reopen, but was " +"not marked as readonly. This is a bug, something went " +"wrong. All of the bitmaps may be corrupted" , bm->name); + ret = -EINVAL ; + goto out; } + + bm->flags |=BME_FLAG_IN_USE ; + ro_dirty_bitmaps =g_slist_append (ro_dirty_bitmaps, bitmap); }if (ro_dirty_bitmaps !=NULL ) {
@@ -1424,8 +1427,8 @@ void qcow2_store_persistent_dirty_bitmaps(BlockDriverState *bs, Error **errp)Qcow2Bitmap *bm;if (!bdrv_dirty_bitmap_get_persistance (bitmap) || -bdrv_dirty_bitmap_readonly (bitmap)) - { +bdrv_dirty_bitmap_readonly (bitmap) || +bdrv_dirty_bitmap_inconsistent (bitmap)) {continue ; }
Signature · 1 line
2.17.2
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PULL 00/17] Bitmaps patches
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'6a083e7a44 block/dirty-bitmaps: implement inconsistent bit f00e672dd7 block/dirty-bitmaps: disallow busy bitmaps as merge source ca8fdb5e18 block/dirty-bitmaps: prohibit removing readonly bitmaps 4085064d76 block/dirty-bitmaps: prohibit readonly bitmaps for backups 46e4307e40 block/dirty-bitmaps: add block_dirty_bitmap_check function e0e53b95d2 block/dirty-bitmap: add inconsistent status061152794d block/dirty-bitmaps: add inconsistent bit20eb6ea4b5 iotests: add busy/recording bit test to 124f0dea169fe blockdev: remove unused paio parameter documentation 5b090a904b block/dirty-bitmaps: move comment block235c618265 block/dirty-bitmaps: unify qmp_locked and user_locked calls 9cd31200c1 block/dirty-bitmap: explicitly lock bitmaps with successors 0260a9c1c5 nbd: change error checking order for bitmaps 80fbc5114e block/dirty-bitmap: change semantics of enabled predicate 62a0dda136 block/dirty-bitmap: remove set/reset assertions against enabled bit 4d10356687 block/dirty-bitmaps: rename frozen predicate helper 8e21a1f266 block/dirty-bitmap: add recording and busy properties
=== OUTPUT BEGIN ===
1/17 Checking commit 8e21a1f266ae (block/dirty-bitmap: add recording and busy properties) 2/17 Checking commit 4d10356687c2 (block/dirty-bitmaps: rename frozen predicate helper)
WARNING: line over 80 characters
#87: FILE: block/dirty-bitmap.c:248:
+ error_setg(errp, "Cannot create a successor for a bitmap that is in-use "
total: 0 errors, 1 warnings, 124 lines checked
Patch 2/17 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
3/17 Checking commit 62a0dda1369b (block/dirty-bitmap: remove set/reset assertions against enabled bit) 4/17 Checking commit 80fbc5114eb1 (block/dirty-bitmap: change semantics of enabled predicate) 5/17 Checking commit 0260a9c1c566 (nbd: change error checking order for bitmaps)
6/17 Checking commit 9cd31200c142 (block/dirty-bitmap: explicitly lock bitmaps with successors) 7/17 Checking commit 235c61826568 (block/dirty-bitmaps: unify qmp_locked and user_locked calls)
ERROR: open brace '{' following function declarations go on the next line
#39: FILE: block/dirty-bitmap.c:190:
+bool bdrv_dirty_bitmap_busy(BdrvDirtyBitmap *bitmap) {
total: 1 errors, 0 warnings, 271 lines checked
Patch 7/17 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
8/17 Checking commit 5b090a904b91 (block/dirty-bitmaps: move comment block) 9/17 Checking commit f0dea169fe5e (blockdev: remove unused paio parameter documentation) 10/17 Checking commit 20eb6ea4b57a (iotests: add busy/recording bit test to 124) 11/17 Checking commit 061152794d63 (block/dirty-bitmaps: add inconsistent bit)
WARNING: Block comments use a leading /* on a separate line
#26: FILE: block/dirty-bitmap.c:49:
+ bool inconsistent; /* bitmap is persistent, but inconsistent.
WARNING: Block comments use a trailing */ on a separate line #28: FILE: block/dirty-bitmap.c:51:
+ * a QMP user can remove it. */
total: 0 errors, 2 warnings, 82 lines checked
Patch 11/17 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
12/17 Checking commit e0e53b95d21c (block/dirty-bitmap: add inconsistent status) 13/17 Checking commit 46e4307e401e (block/dirty-bitmaps: add block_dirty_bitmap_check function)
ERROR: open brace '{' following function declarations go on the next line
#37: FILE: block/dirty-bitmap.c:177:
+static bool bdrv_dirty_bitmap_busy(const BdrvDirtyBitmap *bitmap) {
WARNING: line over 80 characters
#284: FILE: migration/block-dirty-bitmap.c:305:
+ if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_DEFAULT, &local_err)) {
total: 1 errors, 1 warnings, 236 lines checked
Patch 13/17 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
14/17 Checking commit 4085064d763d (block/dirty-bitmaps: prohibit readonly bitmaps for backups) 15/17 Checking commit ca8fdb5e18fe (block/dirty-bitmaps: prohibit removing readonly bitmaps) 16/17 Checking commit f00e672dd7a8 (block/dirty-bitmaps: disallow busy bitmaps as merge source) 17/17 Checking commit 6a083e7a449c (block/dirty-bitmaps: implement inconsistent bit) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PULL 00/17] Bitmaps patches
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
t [tag update] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'3d5e719ca4 block/dirty-bitmaps: implement inconsistent bit 465831cd59 block/dirty-bitmaps: disallow busy bitmaps as merge source 31780545dd block/dirty-bitmaps: prohibit removing readonly bitmaps 7559e374a2 block/dirty-bitmaps: prohibit readonly bitmaps for backups aa7d65f2c7 block/dirty-bitmaps: add block_dirty_bitmap_check function c680f34e1a block/dirty-bitmap: add inconsistent status144ff09b4a block/dirty-bitmaps: add inconsistent bit3404fb4d3c iotests: add busy/recording bit test to 124c1abe84ba0 blockdev: remove unused paio parameter documentation a9cea08dae block/dirty-bitmaps: move comment block0c7cb0afda block/dirty-bitmaps: unify qmp_locked and user_locked calls 0978398f68 block/dirty-bitmap: explicitly lock bitmaps with successors 359bac67ac nbd: change error checking order for bitmaps 03ca272dcf block/dirty-bitmap: change semantics of enabled predicate 39788c7010 block/dirty-bitmap: remove set/reset assertions against enabled bit 953dca788e block/dirty-bitmaps: rename frozen predicate helper ad226cd02f block/dirty-bitmap: add recording and busy properties
=== OUTPUT BEGIN ===
1/17 Checking commit ad226cd02f0d (block/dirty-bitmap: add recording and busy properties) 2/17 Checking commit 953dca788e01 (block/dirty-bitmaps: rename frozen predicate helper)
WARNING: line over 80 characters
#87: FILE: block/dirty-bitmap.c:248:
+ error_setg(errp, "Cannot create a successor for a bitmap that is in-use "
total: 0 errors, 1 warnings, 124 lines checked
Patch 2/17 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
3/17 Checking commit 39788c7010d2 (block/dirty-bitmap: remove set/reset assertions against enabled bit) 4/17 Checking commit 03ca272dcfe2 (block/dirty-bitmap: change semantics of enabled predicate) 5/17 Checking commit 359bac67ac40 (nbd: change error checking order for bitmaps)
6/17 Checking commit 0978398f6879 (block/dirty-bitmap: explicitly lock bitmaps with successors) 7/17 Checking commit 0c7cb0afdaff (block/dirty-bitmaps: unify qmp_locked and user_locked calls)
ERROR: open brace '{' following function declarations go on the next line
#39: FILE: block/dirty-bitmap.c:190:
+bool bdrv_dirty_bitmap_busy(BdrvDirtyBitmap *bitmap) {
total: 1 errors, 0 warnings, 271 lines checked
Patch 7/17 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
8/17 Checking commit a9cea08daeed (block/dirty-bitmaps: move comment block) 9/17 Checking commit c1abe84ba004 (blockdev: remove unused paio parameter documentation) 10/17 Checking commit 3404fb4d3ca7 (iotests: add busy/recording bit test to 124) 11/17 Checking commit 144ff09b4a7c (block/dirty-bitmaps: add inconsistent bit)
WARNING: Block comments use a leading /* on a separate line
#26: FILE: block/dirty-bitmap.c:49:
+ bool inconsistent; /* bitmap is persistent, but inconsistent.
WARNING: Block comments use a trailing */ on a separate line #28: FILE: block/dirty-bitmap.c:51:
+ * a QMP user can remove it. */
total: 0 errors, 2 warnings, 82 lines checked
Patch 11/17 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
12/17 Checking commit c680f34e1af5 (block/dirty-bitmap: add inconsistent status) 13/17 Checking commit aa7d65f2c71f (block/dirty-bitmaps: add block_dirty_bitmap_check function)
ERROR: open brace '{' following function declarations go on the next line
#37: FILE: block/dirty-bitmap.c:177:
+static bool bdrv_dirty_bitmap_busy(const BdrvDirtyBitmap *bitmap) {
WARNING: line over 80 characters
#284: FILE: migration/block-dirty-bitmap.c:305:
+ if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_DEFAULT, &local_err)) {
total: 1 errors, 1 warnings, 236 lines checked
Patch 13/17 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
14/17 Checking commit 7559e374a22f (block/dirty-bitmaps: prohibit readonly bitmaps for backups) 15/17 Checking commit 31780545dd08 (block/dirty-bitmaps: prohibit removing readonly bitmaps) 16/17 Checking commit 465831cd595f (block/dirty-bitmaps: disallow busy bitmaps as merge source) 17/17 Checking commit 3d5e719ca44a (block/dirty-bitmaps: implement inconsistent bit) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PULL 00/17] Bitmaps patches
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
t [tag update] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'd67d39e43b block/dirty-bitmaps: implement inconsistent bit cc50ffdaaa block/dirty-bitmaps: disallow busy bitmaps as merge source fe93ecd8b1 block/dirty-bitmaps: prohibit removing readonly bitmaps 1d82e65c16 block/dirty-bitmaps: prohibit readonly bitmaps for backups 61c55a9de7 block/dirty-bitmaps: add block_dirty_bitmap_check function 4f1ceecd95 block/dirty-bitmap: add inconsistent status9d5d76cbd6 block/dirty-bitmaps: add inconsistent bitbdc998d9d5 iotests: add busy/recording bit test to 12422c03a2fd5 blockdev: remove unused paio parameter documentation d74e8a7202 block/dirty-bitmaps: move comment block8ea8b7a875 block/dirty-bitmaps: unify qmp_locked and user_locked calls ae989ad6ff block/dirty-bitmap: explicitly lock bitmaps with successors 6c71258b44 nbd: change error checking order for bitmaps cf861d0168 block/dirty-bitmap: change semantics of enabled predicate 5ba70dfbcf block/dirty-bitmap: remove set/reset assertions against enabled bit 83886ed7db block/dirty-bitmaps: rename frozen predicate helper 0e38e3ff4f block/dirty-bitmap: add recording and busy properties
=== OUTPUT BEGIN ===
1/17 Checking commit 0e38e3ff4ff4 (block/dirty-bitmap: add recording and busy properties) 2/17 Checking commit 83886ed7db44 (block/dirty-bitmaps: rename frozen predicate helper)
WARNING: line over 80 characters
#87: FILE: block/dirty-bitmap.c:248:
+ error_setg(errp, "Cannot create a successor for a bitmap that is in-use "
total: 0 errors, 1 warnings, 124 lines checked
Patch 2/17 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
3/17 Checking commit 5ba70dfbcf19 (block/dirty-bitmap: remove set/reset assertions against enabled bit) 4/17 Checking commit cf861d01687f (block/dirty-bitmap: change semantics of enabled predicate) 5/17 Checking commit 6c71258b445a (nbd: change error checking order for bitmaps)
6/17 Checking commit ae989ad6ffc7 (block/dirty-bitmap: explicitly lock bitmaps with successors) 7/17 Checking commit 8ea8b7a8757e (block/dirty-bitmaps: unify qmp_locked and user_locked calls)
ERROR: open brace '{' following function declarations go on the next line
#39: FILE: block/dirty-bitmap.c:190:
+bool bdrv_dirty_bitmap_busy(BdrvDirtyBitmap *bitmap) {
total: 1 errors, 0 warnings, 271 lines checked
Patch 7/17 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
8/17 Checking commit d74e8a720254 (block/dirty-bitmaps: move comment block) 9/17 Checking commit 22c03a2fd589 (blockdev: remove unused paio parameter documentation) 10/17 Checking commit bdc998d9d5ed (iotests: add busy/recording bit test to 124) 11/17 Checking commit 9d5d76cbd6ca (block/dirty-bitmaps: add inconsistent bit)
WARNING: Block comments use a leading /* on a separate line
#26: FILE: block/dirty-bitmap.c:49:
+ bool inconsistent; /* bitmap is persistent, but inconsistent.
WARNING: Block comments use a trailing */ on a separate line #28: FILE: block/dirty-bitmap.c:51:
+ * a QMP user can remove it. */
total: 0 errors, 2 warnings, 82 lines checked
Patch 11/17 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
12/17 Checking commit 4f1ceecd9528 (block/dirty-bitmap: add inconsistent status) 13/17 Checking commit 61c55a9de7e4 (block/dirty-bitmaps: add block_dirty_bitmap_check function)
ERROR: open brace '{' following function declarations go on the next line
#37: FILE: block/dirty-bitmap.c:177:
+static bool bdrv_dirty_bitmap_busy(const BdrvDirtyBitmap *bitmap) {
WARNING: line over 80 characters
#284: FILE: migration/block-dirty-bitmap.c:305:
+ if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_DEFAULT, &local_err)) {
total: 1 errors, 1 warnings, 236 lines checked
Patch 13/17 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
14/17 Checking commit 1d82e65c16d6 (block/dirty-bitmaps: prohibit readonly bitmaps for backups) 15/17 Checking commit fe93ecd8b1cd (block/dirty-bitmaps: prohibit removing readonly bitmaps) 16/17 Checking commit cc50ffdaaa38 (block/dirty-bitmaps: disallow busy bitmaps as merge source) 17/17 Checking commit d67d39e43b84 (block/dirty-bitmaps: implement inconsistent bit) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
Guess I'll fix these first, sorry for the noise.
Quoted 119 lines · On 3/8/19 3:53 PM, [email protected] wrote:
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PULL 00/17] Bitmaps patches=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base >/dev/null|| exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl--mailback base..
=== TEST SCRIPT END ===Updating
3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
t [tag update] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'd67d39e43bblock/dirty-bitmaps: implement inconsistent bitcc50ffdaaablock/dirty-bitmaps: disallow busy bitmaps as merge sourcefe93ecd8b1block/dirty-bitmaps: prohibit removing readonly bitmaps1d82e65c16block/dirty-bitmaps: prohibit readonly bitmaps for backups61c55a9de7block/dirty-bitmaps: addblock_dirty_bitmap_checkfunction4f1ceecd95block/dirty-bitmap: add inconsistent status9d5d76cbd6block/dirty-bitmaps: add inconsistent bitbdc998d9d5iotests: add busy/recording bit test to 12422c03a2fd5blockdev: remove unused paio parameter documentationd74e8a7202block/dirty-bitmaps: move comment block8ea8b7a875block/dirty-bitmaps: unifyqmp_lockedanduser_lockedcallsae989ad6ffblock/dirty-bitmap: explicitly lock bitmaps with successors6c71258b44nbd: change error checking order for bitmapscf861d0168block/dirty-bitmap: change semantics of enabled predicate5ba70dfbcfblock/dirty-bitmap: remove set/reset assertions against enabled bit83886ed7dbblock/dirty-bitmaps: rename frozen predicate helper0e38e3ff4fblock/dirty-bitmap: add recording and busy properties=== OUTPUT BEGIN ===
1/17 Checking commit0e38e3ff4ff4(block/dirty-bitmap: add recording and busy properties) 2/17 Checking commit83886ed7db44(block/dirty-bitmaps: rename frozen predicate helper)
WARNING: line over 80 characters
#87: FILE:block/dirty-bitmap.c:248:
+ error_setg(errp, "Cannot create a successor for a bitmap that is in-use "total: 0 errors, 1 warnings, 124 lines checked
Patch 2/17 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH inMAINTAINERS.
3/17 Checking commit5ba70dfbcf19(block/dirty-bitmap: remove set/reset assertions against enabled bit) 4/17 Checking commitcf861d01687f(block/dirty-bitmap: change semantics of enabled predicate) 5/17 Checking commit6c71258b445a(nbd: change error checking order for bitmaps)
6/17 Checking commitae989ad6ffc7(block/dirty-bitmap: explicitly lock bitmaps with successors) 7/17 Checking commit8ea8b7a8757e(block/dirty-bitmaps: unifyqmp_lockedanduser_lockedcalls)
ERROR: open brace '{' following function declarations go on the next line
#39: FILE:block/dirty-bitmap.c:190:
+boolbdrv_dirty_bitmap_busy(BdrvDirtyBitmap *bitmap){total: 1 errors, 0 warnings, 271 lines checked
Patch 7/17 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in
MAINTAINERS.8/17 Checking commit
d74e8a720254(block/dirty-bitmaps: move comment block) 9/17 Checking commit22c03a2fd589(blockdev: remove unused paio parameter documentation) 10/17 Checking commitbdc998d9d5ed(iotests: add busy/recording bit test to 124) 11/17 Checking commit9d5d76cbd6ca(block/dirty-bitmaps: add inconsistent bit)
WARNING: Block comments use a leading /* on a separate line
#26: FILE:block/dirty-bitmap.c:49:
+ bool inconsistent; /* bitmap is persistent, but inconsistent.WARNING: Block comments use a trailing */ on a separate line #28: FILE:
block/dirty-bitmap.c:51:
+ * a QMP user can remove it. */total: 0 errors, 2 warnings, 82 lines checked
Patch 11/17 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH inMAINTAINERS.
12/17 Checking commit4f1ceecd9528(block/dirty-bitmap: add inconsistent status) 13/17 Checking commit61c55a9de7e4(block/dirty-bitmaps: addblock_dirty_bitmap_checkfunction)
ERROR: open brace '{' following function declarations go on the next line
#37: FILE:block/dirty-bitmap.c:177:
+static boolbdrv_dirty_bitmap_busy(const BdrvDirtyBitmap *bitmap){WARNING: line over 80 characters
#284: FILE:migration/block-dirty-bitmap.c:305:
+ if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_DEFAULT, &local_err)) {total: 1 errors, 1 warnings, 236 lines checked
Patch 13/17 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in
MAINTAINERS.14/17 Checking commit
1d82e65c16d6(block/dirty-bitmaps: prohibit readonly bitmaps for backups) 15/17 Checking commitfe93ecd8b1cd(block/dirty-bitmaps: prohibit removing readonly bitmaps) 16/17 Checking commitcc50ffdaaa38(block/dirty-bitmaps: disallow busy bitmaps as merge source) 17/17 Checking commitd67d39e43b84(block/dirty-bitmaps: implement inconsistent bit) === OUTPUT END ===Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
Quoted 6 lines · John Snow
The following changes since commit
234afe78281b10a798fb97c584e1b677844aaab8:Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2019-03-08' into staging (2019-03-08 16:31:34 +0000)
are available in the Git repository at:
Quoted 8 lines
https://github.com/jnsnow/qemu.git tags/bitmaps-pull-request
for you to fetch changes up to
fc91aa3d937e56d512c702d9b966fcea0e499f0e:
block/dirty-bitmaps: implement inconsistent bit (2019-03-08 14:07:29 -0500)----------------------------------------------------------------
Pull request
Replying to the cover letter in case Peter doesn't see the nested reply:
NACK, v2 coming up for minor checkpatch fixes
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org