qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 12/21] block: Use BlockBackend more
Date: Fri, 06 Feb 2015 16:43:25 -0500	[thread overview]
Message-ID: <54D5357D.60702@redhat.com> (raw)
In-Reply-To: <54CADA8B.8010707@redhat.com>

On 2015-01-29 at 20:12, Eric Blake wrote:
> On 01/26/2015 12:27 PM, Max Reitz wrote:
>> Replace bdrv_drain_all(), bdrv_commmit_all(), bdrv_flush_all(),
>> bdrv_invalidate_cache_all(), bdrv_next() and occurrences of bdrv_states
>> by their BlockBackend equivalents.
>>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>> ---
>>   block.c               | 22 ++++++++---------
>>   block/block-backend.c |  8 +++----
>>   block/qapi.c          | 13 ++++++++--
>>   block/snapshot.c      |  3 ++-
>>   blockdev.c            | 14 ++++++-----
>>   cpus.c                |  7 +++---
>>   migration/block.c     | 10 +++++---
>>   migration/migration.c |  4 ++--
>>   monitor.c             | 13 ++++++----
>>   qemu-char.c           |  3 ++-
>>   qemu-io.c             |  2 +-
>>   qmp.c                 | 14 +++++------
>>   savevm.c              | 66 ++++++++++++++++++++++++++++++---------------------
>>   xen-mapcache.c        |  3 ++-
>>   14 files changed, 107 insertions(+), 75 deletions(-)
>>
>> +++ b/block/qapi.c
>> @@ -393,15 +393,24 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
>>   {
>>       BlockStatsList *head = NULL, **p_next = &head;
>>       BlockDriverState *bs = NULL;
>> +    BlockBackend *blk = NULL;
>>   
>>       /* Just to be safe if query_nodes is not always initialized */
>>       query_nodes = has_query_nodes && query_nodes;
>>   
>> -    while ((bs = query_nodes ? bdrv_next_node(bs) : bdrv_next(bs))) {
>> +    while (query_nodes ? (bs = bdrv_next_node(bs)) != NULL
>> +                       : (blk = blk_next_inserted(blk)) != NULL)
> Don't we still want to list empty BBs in the query (that is,
> intentionally list that there are no stats because there is no medium)
> rather than silently omitting them?

Well, maybe, but this patch does not change that behavior. Actually, the 
behavior is changed in the "BlockBackend and media" series, and I guess 
it's probably the patch "blockdev: Do not create BDS for empty drive". 
As of that series in general, there is no BDS for empty drives any more 
and subsequently there are no blockstats any more.

So if anywhere, I'd need to fix it in that series, probably in the "Move 
BlockAcctStats into BlockBackend" patch.

>> @@ -348,6 +349,7 @@ static void unset_dirty_tracking(void)
>>   static void init_blk_migration(QEMUFile *f)
>>   {
>>       BlockDriverState *bs;
>> +    BlockBackend *blk = NULL;
>>       BlkMigDevState *bmds;
>>       int64_t sectors;
>>   
>> @@ -359,7 +361,9 @@ static void init_blk_migration(QEMUFile *f)
>>       block_mig_state.bulk_completed = 0;
>>       block_mig_state.zero_blocks = migrate_zero_blocks();
>>   
>> -    for (bs = bdrv_next(NULL); bs; bs = bdrv_next(bs)) {
>> +    while ((blk = blk_next_inserted(blk)) != NULL) {
>> +        bs = blk_bs(blk);
>> +
> What happens if someone initiates a live migration, then inserts the
> medium?  It looks like this will skip over the drive that was empty at
> the time the migration started.

Well, to me it looks like its your own fault then. Also, there is no 
difference between using blk_next_inserted() like here and using 
blk_next() + blk_is_inserted(), so you probably can still insert a 
medium during this loop. Maybe. I'm not sure, but I don't think anything 
changed from the old bdrv_next() behavior.

(blk_bext_inserted() iterates over all the BlockBackends and if the one 
you're looking for is not inserted by the time the BB is iterated over, 
it is skipped; if it is inserted, it is not skipped. It doesn't matter 
whether it was inserted at the beginning.)

Max

  reply	other threads:[~2015-02-06 21:43 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 19:27 [Qemu-devel] [PATCH 00/20] block: Rework bdrv_close_all() Max Reitz
2015-01-26 19:27 ` [Qemu-devel] [PATCH 01/21] block: Guard remaining unsafe blk_bs() callers Max Reitz
2015-01-28 22:14   ` Eric Blake
2015-01-26 19:27 ` [Qemu-devel] [PATCH 02/21] quorum: Fix close path Max Reitz
2015-01-28 22:16   ` Eric Blake
2015-01-26 19:27 ` [Qemu-devel] [PATCH 03/21] block: Add bdrv_close_all() notifiers Max Reitz
2015-01-28 22:24   ` Eric Blake
2015-01-26 19:27 ` [Qemu-devel] [PATCH 04/21] block: Add bdrv_close_all() handlers Max Reitz
2015-01-26 20:40   ` Paolo Bonzini
2015-01-26 20:43     ` Max Reitz
2015-01-26 21:10       ` Paolo Bonzini
2015-01-26 21:13         ` Max Reitz
2015-01-26 21:22           ` Paolo Bonzini
2015-01-28 22:05             ` Eric Blake
2015-01-28 22:56               ` Max Reitz
2015-01-29 10:59                 ` Paolo Bonzini
2015-01-28 22:44   ` Eric Blake
2015-01-28 22:51     ` Max Reitz
2015-01-26 19:27 ` [Qemu-devel] [PATCH 05/21] block: Remove per-BDS close notifiers Max Reitz
2015-01-29 23:44   ` Eric Blake
2015-01-26 19:27 ` [Qemu-devel] [PATCH 06/21] block: Use blk_remove_bs() in blk_delete() Max Reitz
2015-01-29 23:45   ` Eric Blake
2015-01-26 19:27 ` [Qemu-devel] [PATCH 07/21] blockdev: Use blk_remove_bs() in do_drive_del() Max Reitz
2015-01-29 23:46   ` Eric Blake
2015-01-26 19:27 ` [Qemu-devel] [PATCH 08/21] block: Make bdrv_close() static Max Reitz
2015-01-29 23:47   ` Eric Blake
2015-01-26 19:27 ` [Qemu-devel] [PATCH 09/21] block: Add blk_name_taken() Max Reitz
2015-01-29 23:51   ` Eric Blake
2015-01-26 19:27 ` [Qemu-devel] [PATCH 10/21] block: Add blk_next_inserted() Max Reitz
2015-01-29 23:52   ` Eric Blake
2015-01-26 19:27 ` [Qemu-devel] [PATCH 11/21] block: Add blk_commit_all() and blk_invalidate_cache_all() Max Reitz
2015-01-29 23:54   ` Eric Blake
2015-01-26 19:27 ` [Qemu-devel] [PATCH 12/21] block: Use BlockBackend more Max Reitz
2015-01-30  1:12   ` Eric Blake
2015-02-06 21:43     ` Max Reitz [this message]
2015-01-26 19:27 ` [Qemu-devel] [PATCH 13/21] blockdev: Add list of monitor-owned BlockBackends Max Reitz
2015-01-30 17:43   ` Eric Blake
2015-01-26 19:27 ` [Qemu-devel] [PATCH 14/21] blockdev: Remove blk_hide_on_behalf_of_do_drive_del() Max Reitz
2015-01-30 17:44   ` Eric Blake
2015-01-26 19:27 ` [Qemu-devel] [PATCH 15/21] block: Make bdrv_drain_one() public Max Reitz
2015-01-30 17:45   ` Eric Blake
2015-01-26 19:27 ` [Qemu-devel] [PATCH 16/21] block: Move some bdrv_*_all() functions to BB Max Reitz
2015-01-26 19:27 ` [Qemu-devel] [PATCH 17/21] block: Remove bdrv_states Max Reitz
2015-01-26 19:27 ` [Qemu-devel] [PATCH 18/21] blockdev: Keep track of monitor-owned BDS Max Reitz
2015-01-26 19:27 ` [Qemu-devel] [PATCH 19/21] block: Strip down bdrv_close_all() Max Reitz
2015-01-26 19:27 ` [Qemu-devel] [PATCH 20/21] iotests: Add "wait" functionality to _cleanup_qemu Max Reitz
2015-01-26 19:27 ` [Qemu-devel] [PATCH 21/21] iotests: Add test for multiple BB on BDS tree Max Reitz
2015-01-26 19:29 ` [Qemu-devel] [PATCH 00/20] block: Rework bdrv_close_all() Max Reitz

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=54D5357D.60702@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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).