From: John Snow <jsnow@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"qemu-block@nongnu.org" <qemu-block@nongnu.org>
Cc: Max Reitz <mreitz@redhat.com>, Fam Zheng <fam@euphon.net>,
Kevin Wolf <kwolf@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
"eblake@redhat.com" <eblake@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 1/7] block/dirty-bitmaps: add inconsistent bit
Date: Wed, 6 Mar 2019 10:15:42 -0500 [thread overview]
Message-ID: <a2d33717-48f8-2133-021e-48e34b3b0871@redhat.com> (raw)
In-Reply-To: <82ec6790-f366-3912-e85b-4908647d5c8d@virtuozzo.com>
On 3/6/19 7:25 AM, Vladimir Sementsov-Ogievskiy wrote:
> 01.03.2019 22:15, 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 <jsnow@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)
>> #
>> # 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:
>> diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h
>> index ba8477b73f..bd1b6479df 100644
>> --- a/include/block/dirty-bitmap.h
>> +++ b/include/block/dirty-bitmap.h
>> @@ -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,
>> diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
>> index 980cae4fa3..9e8630e1ac 100644
>> --- a/block/dirty-bitmap.c
>> +++ b/block/dirty-bitmap.c
>> @@ -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,15 @@ 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);
>> + bitmap->inconsistent = true;
>> + bitmap->disabled = true;
>
> Agree, that it worth to assert persistance
>
OK, I will do so.
>> + qemu_mutex_unlock(bitmap->mutex);
>> +}
>> +
>> /* Called with BQL taken. */
>> void bdrv_dirty_bitmap_set_migration(BdrvDirtyBitmap *bitmap, bool migration)
>> {
>> @@ -724,6 +738,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;
>>
>
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>
> Sorry for a delay, I'm very busy with our rebase to 2.12 :(
>
I am very genuinely the last person you would ever have to apologize for
in being late. I'm only waiting for your reviews because you have
contributed so much to this feature and I want to make sure I don't
check in anything that you haven't had a chance to critique.
Thanks for the reviews!
next prev parent reply other threads:[~2019-03-06 15:15 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-01 19:15 [Qemu-devel] [PATCH v3 0/7] bitmaps: add inconsistent bit John Snow
2019-03-01 19:15 ` [Qemu-devel] [PATCH v3 1/7] block/dirty-bitmaps: " John Snow
2019-03-01 19:32 ` Eric Blake
2019-03-01 19:44 ` John Snow
2019-03-06 12:25 ` Vladimir Sementsov-Ogievskiy
2019-03-06 13:06 ` Vladimir Sementsov-Ogievskiy
2019-03-06 13:08 ` Vladimir Sementsov-Ogievskiy
2019-03-06 15:15 ` John Snow [this message]
2019-03-01 19:15 ` [Qemu-devel] [PATCH v3 2/7] block/dirty-bitmap: add inconsistent status John Snow
2019-03-06 13:05 ` Vladimir Sementsov-Ogievskiy
2019-03-06 15:14 ` John Snow
2019-03-01 19:15 ` [Qemu-devel] [PATCH v3 3/7] block/dirty-bitmaps: add block_dirty_bitmap_check function John Snow
2019-03-01 19:36 ` Eric Blake
2019-03-01 19:57 ` John Snow
2019-03-01 20:03 ` Eric Blake
2019-03-01 20:06 ` Eric Blake
2019-03-06 13:44 ` Vladimir Sementsov-Ogievskiy
2019-03-06 15:17 ` John Snow
2019-03-01 19:15 ` [Qemu-devel] [PATCH v3 4/7] block/dirty-bitmaps: prohibit readonly bitmaps for backups John Snow
2019-03-01 19:38 ` Eric Blake
2019-03-06 13:47 ` Vladimir Sementsov-Ogievskiy
2019-03-01 19:15 ` [Qemu-devel] [PATCH v3 5/7] block/dirty-bitmaps: prohibit removing readonly bitmaps John Snow
2019-03-01 19:39 ` Eric Blake
2019-03-06 13:49 ` Vladimir Sementsov-Ogievskiy
2019-03-01 19:15 ` [Qemu-devel] [PATCH v3 6/7] block/dirty-bitmaps: disallow busy bitmaps as merge source John Snow
2019-03-01 19:44 ` Eric Blake
2019-03-01 19:48 ` John Snow
2019-03-01 19:57 ` Eric Blake
2019-03-01 20:04 ` John Snow
2019-03-06 13:57 ` Vladimir Sementsov-Ogievskiy
2019-03-06 15:24 ` John Snow
2019-03-06 15:29 ` Eric Blake
2019-03-06 13:57 ` Vladimir Sementsov-Ogievskiy
2019-03-01 19:15 ` [Qemu-devel] [PATCH v3 7/7] block/dirty-bitmaps: implement inconsistent bit John Snow
2019-03-01 19:53 ` Eric Blake
2019-03-06 14:26 ` Vladimir Sementsov-Ogievskiy
2019-03-06 21:46 ` John Snow
2019-03-07 16:37 ` Eric Blake
2019-03-08 18:46 ` John Snow
2019-03-05 23:59 ` [Qemu-devel] [PATCH v3 0/7] bitmaps: add " John Snow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a2d33717-48f8-2133-021e-48e34b3b0871@redhat.com \
--to=jsnow@redhat.com \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=fam@euphon.net \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).