]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
Merge remote-tracking branch 'remotes/jnsnow/tags/bitmaps-pull-request' into staging
authorPeter Maydell <peter.maydell@linaro.org>
Thu, 30 May 2019 11:10:27 +0000 (12:10 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 30 May 2019 11:10:27 +0000 (12:10 +0100)
Pull request

# gpg: Signature made Wed 29 May 2019 00:58:33 BST
# gpg:                using RSA key F9B7ABDBBCACDF95BE76CBD07DEF8106AAFC390E
# gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>" [full]
# Primary key fingerprint: FAEB 9711 A12C F475 812F  18F2 88A9 064D 1835 61EB
#      Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76  CBD0 7DEF 8106 AAFC 390E

* remotes/jnsnow/tags/bitmaps-pull-request:
  iotests: test external snapshot with bitmap copying
  qapi: support external bitmaps in block-dirty-bitmap-merge
  migration/dirty-bitmaps: change bitmap enumeration method

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
1  2 
blockdev.c
qapi/block-core.json

diff --combined blockdev.c
index bc339d78184423171cc7ef0009632e954a3282d1,64ccef735b1e7c57347a45c167f0adaeb4437296..17c2d801d7c5fec50d7b7d460f1f332341254264
@@@ -2112,11 -2112,10 +2112,10 @@@ static void block_dirty_bitmap_disable_
      }
  }
  
- static BdrvDirtyBitmap *do_block_dirty_bitmap_merge(const char *node,
-                                                     const char *target,
-                                                     strList *bitmaps,
-                                                     HBitmap **backup,
-                                                     Error **errp);
+ static BdrvDirtyBitmap *do_block_dirty_bitmap_merge(
+         const char *node, const char *target,
+         BlockDirtyBitmapMergeSourceList *bitmaps,
+         HBitmap **backup, Error **errp);
  
  static void block_dirty_bitmap_merge_prepare(BlkActionState *common,
                                               Error **errp)
@@@ -2965,15 -2964,14 +2964,14 @@@ void qmp_block_dirty_bitmap_disable(con
      bdrv_disable_dirty_bitmap(bitmap);
  }
  
- static BdrvDirtyBitmap *do_block_dirty_bitmap_merge(const char *node,
-                                                     const char *target,
-                                                     strList *bitmaps,
-                                                     HBitmap **backup,
-                                                     Error **errp)
+ static BdrvDirtyBitmap *do_block_dirty_bitmap_merge(
+         const char *node, const char *target,
+         BlockDirtyBitmapMergeSourceList *bitmaps,
+         HBitmap **backup, Error **errp)
  {
      BlockDriverState *bs;
      BdrvDirtyBitmap *dst, *src, *anon;
-     strList *lst;
+     BlockDirtyBitmapMergeSourceList *lst;
      Error *local_err = NULL;
  
      dst = block_dirty_bitmap_lookup(node, target, &bs, errp);
      }
  
      for (lst = bitmaps; lst; lst = lst->next) {
-         src = bdrv_find_dirty_bitmap(bs, lst->value);
-         if (!src) {
-             error_setg(errp, "Dirty bitmap '%s' not found", lst->value);
-             dst = NULL;
-             goto out;
+         switch (lst->value->type) {
+             const char *name, *node;
+         case QTYPE_QSTRING:
+             name = lst->value->u.local;
+             src = bdrv_find_dirty_bitmap(bs, name);
+             if (!src) {
+                 error_setg(errp, "Dirty bitmap '%s' not found", name);
+                 dst = NULL;
+                 goto out;
+             }
+             break;
+         case QTYPE_QDICT:
+             node = lst->value->u.external.node;
+             name = lst->value->u.external.name;
+             src = block_dirty_bitmap_lookup(node, name, NULL, errp);
+             if (!src) {
+                 dst = NULL;
+                 goto out;
+             }
+             break;
+         default:
+             abort();
          }
  
          bdrv_merge_dirty_bitmap(anon, src, NULL, &local_err);
  }
  
  void qmp_block_dirty_bitmap_merge(const char *node, const char *target,
-                                   strList *bitmaps, Error **errp)
+                                   BlockDirtyBitmapMergeSourceList *bitmaps,
+                                   Error **errp)
  {
      do_block_dirty_bitmap_merge(node, target, bitmaps, NULL, errp);
  }
@@@ -3450,16 -3466,11 +3466,16 @@@ static BlockJob *do_drive_backup(DriveB
          backup->compress = false;
      }
  
 -    bs = qmp_get_root_bs(backup->device, errp);
 +    bs = bdrv_lookup_bs(backup->device, backup->device, errp);
      if (!bs) {
          return NULL;
      }
  
 +    if (!bs->drv) {
 +        error_setg(errp, "Device has no medium");
 +        return NULL;
 +    }
 +
      aio_context = bdrv_get_aio_context(bs);
      aio_context_acquire(aio_context);
  
diff --combined qapi/block-core.json
index 3e4042be7fa9784a10e87a369fd8e24599e72a95,dcc935d65559c9d71533a72cec33de26be7d4ce6..1defcde04890f8363d9bf4f78269bc9b7c365fa4
    'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
              '*persistent': 'bool', '*autoload': 'bool', '*disabled': 'bool' } }
  
+ ##
+ # @BlockDirtyBitmapMergeSource:
+ #
+ # @local: name of the bitmap, attached to the same node as target bitmap.
+ #
+ # @external: bitmap with specified node
+ #
+ # Since: 4.1
+ ##
+ { 'alternate': 'BlockDirtyBitmapMergeSource',
+   'data': { 'local': 'str',
+             'external': 'BlockDirtyBitmap' } }
  ##
  # @BlockDirtyBitmapMerge:
  #
- # @node: name of device/node which the bitmap is tracking
+ # @node: name of device/node which the @target bitmap is tracking
  #
  # @target: name of the destination dirty bitmap
  #
- # @bitmaps: name(s) of the source dirty bitmap(s)
+ # @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or fully
+ #           specifed BlockDirtyBitmap elements. The latter are supported
+ #           since 4.1.
  #
  # Since: 4.0
  ##
  { 'struct': 'BlockDirtyBitmapMerge',
-   'data': { 'node': 'str', 'target': 'str', 'bitmaps': ['str'] } }
+   'data': { 'node': 'str', 'target': 'str',
+             'bitmaps': ['BlockDirtyBitmapMergeSource'] } }
  
  ##
  # @block-dirty-bitmap-add:
  #
  # @cor_write: a write due to copy-on-read (since 2.11)
  #
 +# @cluster_alloc_space: an allocation of file space for a cluster (since 4.1)
 +#
  # Since: 2.9
  ##
  { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
              'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
              'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
              'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
 -            'cor_write'] }
 +            'cor_write', 'cluster_alloc_space'] }
  
  ##
  # @BlkdebugInjectErrorOptions: