diff options
author | John Snow <jsnow@redhat.com> | 2018-10-29 16:23:16 -0400 |
---|---|---|
committer | John Snow <jsnow@redhat.com> | 2018-10-29 16:23:16 -0400 |
commit | 993edc0ce0c6f44deb8272a7a857e419417f5f84 (patch) | |
tree | f45f81f8a4f3dcb77db140166c5c99ef6ce55642 /block/dirty-bitmap.c | |
parent | 2ea427effff61efa5d0dc69f9cae126d13879617 (diff) | |
download | qemu-993edc0ce0c6f44deb8272a7a857e419417f5f84.zip qemu-993edc0ce0c6f44deb8272a7a857e419417f5f84.tar.gz qemu-993edc0ce0c6f44deb8272a7a857e419417f5f84.tar.bz2 |
block/dirty-bitmaps: add user_locked status checker
Instead of both frozen and qmp_locked checks, wrap it into one check.
frozen implies the bitmap is split in two (for backup), and shouldn't
be modified. qmp_locked implies it's being used by another operation,
like being exported over NBD. In both cases it means we shouldn't allow
the user to modify it in any meaningful way.
Replace any usages where we check both frozen and qmp_locked with the
new check.
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20181002230218.13949-2-jsnow@redhat.com
[w/edits Suggested-By: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>]
Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'block/dirty-bitmap.c')
-rw-r--r-- | block/dirty-bitmap.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 8ac933c..9603cdd 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -176,6 +176,12 @@ bool bdrv_dirty_bitmap_frozen(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) || + bdrv_dirty_bitmap_qmp_locked(bitmap); +} + void bdrv_dirty_bitmap_set_qmp_locked(BdrvDirtyBitmap *bitmap, bool qmp_locked) { qemu_mutex_lock(bitmap->mutex); |