block/dirty-bitmaps: unify qmp_locked and user_locked calls

These 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.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-id: 20190223000614.13894-8-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
This commit is contained in:
John Snow 2019-03-12 12:05:48 -04:00
parent 21d2376f26
commit 27a1b301a4
5 changed files with 36 additions and 42 deletions

View file

@ -2011,7 +2011,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)) {
@ -2060,7 +2060,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);
@ -2101,7 +2101,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);
@ -2895,7 +2895,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);
@ -2934,7 +2934,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);
@ -2958,7 +2958,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);
@ -2979,7 +2979,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);
@ -3561,7 +3561,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);
@ -3674,7 +3674,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);