On 3/1/19 1:15 PM, John Snow wrote: > Add 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". > > Signed-off-by: John Snow <js...@redhat.com> > --- > qapi/block-core.json | 13 +++++++++---- > include/block/dirty-bitmap.h | 2 ++ > block/dirty-bitmap.c | 19 +++++++++++++++++++ > 3 files changed, 30 insertions(+), 4 deletions(-) > > diff --git a/qapi/block-core.json b/qapi/block-core.json > index 6e543594b3..e639ef6d1c 100644 > --- a/qapi/block-core.json > +++ b/qapi/block-core.json > @@ -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) > #
I know we waffled on word-smithing this, but this turned out nicely. > > +/* Called with BQL taken. */ > +void bdrv_dirty_bitmap_set_inconsistent(BdrvDirtyBitmap *bitmap) > +{ > + qemu_mutex_lock(bitmap->mutex); > + bitmap->inconsistent = true; > + bitmap->disabled = true; > + qemu_mutex_unlock(bitmap->mutex); Worth an assert that persistent is true? Either way, Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org