qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 12/21] block: Use BlockBackend more


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 12/21] block: Use BlockBackend more
Date: Thu, 29 Jan 2015 18:12:43 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

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 <address@hidden>
> ---
>  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?


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


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]