]> git.proxmox.com Git - pve-qemu-kvm.git/blobdiff - debian/patches/backup-modify-job-api.patch
update to qemu 2.2.0-rc2
[pve-qemu-kvm.git] / debian / patches / backup-modify-job-api.patch
index afeba0a4f67c164864e6e759ecc15f6751a4bd74..53aa7be58b5ff6e3da55b00ba77b79cb062b4ff0 100644 (file)
@@ -1,7 +1,7 @@
 Index: new/block/backup.c
 ===================================================================
---- new.orig/block/backup.c    2013-12-05 08:18:53.000000000 +0100
-+++ new/block/backup.c 2013-12-05 13:16:21.000000000 +0100
+--- new.orig/block/backup.c    2014-11-20 07:55:31.000000000 +0100
++++ new/block/backup.c 2014-11-20 08:56:23.000000000 +0100
 @@ -39,6 +39,7 @@
      BlockDriverState *target;
      MirrorSyncMode sync_mode;
@@ -10,19 +10,20 @@ Index: new/block/backup.c
      BlockdevOnError on_source_error;
      BlockdevOnError on_target_error;
      CoRwlock flush_rwlock;
-@@ -136,13 +137,21 @@
+@@ -136,14 +137,21 @@
              goto out;
          }
  
 +        int64_t start_sec = start * BACKUP_SECTORS_PER_CLUSTER;
          if (buffer_is_zero(iov.iov_base, iov.iov_len)) {
 -            ret = bdrv_co_write_zeroes(job->target,
--                                       start * BACKUP_SECTORS_PER_CLUSTER, n);
+-                                       start * BACKUP_SECTORS_PER_CLUSTER,
+-                                       n, BDRV_REQ_MAY_UNMAP);
 +            if (job->dump_cb) {
 +                ret = job->dump_cb(job->common.opaque, job->target, start_sec, n, NULL);
 +            }
 +            if (job->target) {
-+                ret = bdrv_co_write_zeroes(job->target, start_sec, n);
++                ret = bdrv_co_write_zeroes(job->target, start_sec, n, BDRV_REQ_MAY_UNMAP);
 +            }
          } else {
 -            ret = bdrv_co_writev(job->target,
@@ -37,7 +38,7 @@ Index: new/block/backup.c
          }
          if (ret < 0) {
              trace_backup_do_cow_write_fail(job, start, ret);
-@@ -199,7 +208,9 @@
+@@ -205,7 +213,9 @@
  {
      BackupBlockJob *s = container_of(job, BackupBlockJob, common);
  
@@ -48,7 +49,7 @@ Index: new/block/backup.c
  }
  
  static const BlockJobDriver backup_job_driver = {
-@@ -215,9 +226,11 @@
+@@ -221,9 +231,11 @@
      if (read) {
          return block_job_error_action(&job->common, job->common.bs,
                                        job->on_source_error, true, error);
@@ -57,11 +58,11 @@ Index: new/block/backup.c
          return block_job_error_action(&job->common, job->target,
                                        job->on_target_error, false, error);
 +    } else {
-+        return BDRV_ACTION_REPORT;
++        return BLOCK_ERROR_ACTION_REPORT;
      }
  }
  
-@@ -242,9 +255,11 @@
+@@ -264,9 +276,11 @@
  
      job->bitmap = hbitmap_alloc(end, 0);
  
@@ -76,25 +77,23 @@ Index: new/block/backup.c
  
      bdrv_add_before_write_notifier(bs, &before_write);
  
-@@ -337,8 +352,10 @@
+@@ -359,7 +373,9 @@
  
      hbitmap_free(job->bitmap);
  
 -    bdrv_iostatus_disable(target);
--    bdrv_unref(target);
 +    if (target) {
 +        bdrv_iostatus_disable(target);
-+        bdrv_unref(target);
 +    }
  
-     block_job_completed(&job->common, ret);
- }
-@@ -347,13 +364,15 @@
+     data = g_malloc(sizeof(*data));
+     data->ret = ret;
+@@ -370,13 +386,15 @@
                    int64_t speed, MirrorSyncMode sync_mode,
                    BlockdevOnError on_source_error,
                    BlockdevOnError on_target_error,
 +                  BackupDumpFunc *dump_cb,
-                   BlockDriverCompletionFunc *cb, void *opaque,
+                   BlockCompletionFunc *cb, void *opaque,
 +                  bool paused,
                    Error **errp)
  {
@@ -106,7 +105,7 @@ Index: new/block/backup.c
      assert(cb);
  
      if ((on_source_error == BLOCKDEV_ON_ERROR_STOP ||
-@@ -376,10 +395,12 @@
+@@ -399,10 +417,12 @@
          return;
      }
  
@@ -121,10 +120,10 @@ Index: new/block/backup.c
      qemu_coroutine_enter(job->common.co, job);
 Index: new/blockdev.c
 ===================================================================
---- new.orig/blockdev.c        2013-12-05 08:18:53.000000000 +0100
-+++ new/blockdev.c     2013-12-05 13:07:43.000000000 +0100
-@@ -1932,7 +1932,7 @@
-     }
+--- new.orig/blockdev.c        2014-11-20 07:55:31.000000000 +0100
++++ new/blockdev.c     2014-11-20 08:48:02.000000000 +0100
+@@ -2223,7 +2223,7 @@
+     bdrv_set_aio_context(target_bs, aio_context);
  
      backup_start(bs, target_bs, speed, sync, on_source_error, on_target_error,
 -                 block_job_cb, bs, &local_err);
@@ -134,25 +133,25 @@ Index: new/blockdev.c
          error_propagate(errp, local_err);
 Index: new/include/block/block_int.h
 ===================================================================
---- new.orig/include/block/block_int.h 2013-12-05 08:18:53.000000000 +0100
-+++ new/include/block/block_int.h      2013-12-05 13:16:53.000000000 +0100
-@@ -54,6 +54,9 @@
- #define BLOCK_OPT_LAZY_REFCOUNTS    "lazy_refcounts"
- #define BLOCK_OPT_ADAPTER_TYPE      "adapter_type"
+--- new.orig/include/block/block_int.h 2014-11-20 07:55:31.000000000 +0100
++++ new/include/block/block_int.h      2014-11-20 08:52:59.000000000 +0100
+@@ -57,6 +57,9 @@
+ #define BLOCK_OPT_REDUNDANCY        "redundancy"
+ #define BLOCK_OPT_NOCOW             "nocow"
  
 +typedef int BackupDumpFunc(void *opaque, BlockDriverState *bs,
 +                           int64_t sector_num, int n_sectors, unsigned char *buf);
 +
  typedef struct BdrvTrackedRequest {
      BlockDriverState *bs;
-     int64_t sector_num;
-@@ -427,7 +430,9 @@
+     int64_t offset;
+@@ -583,7 +586,9 @@
                    int64_t speed, MirrorSyncMode sync_mode,
                    BlockdevOnError on_source_error,
                    BlockdevOnError on_target_error,
 +                  BackupDumpFunc *dump_cb,
-                   BlockDriverCompletionFunc *cb, void *opaque,
+                   BlockCompletionFunc *cb, void *opaque,
 +                  bool paused,
                    Error **errp);
  
- #endif /* BLOCK_INT_H */
+ void blk_dev_change_media_cb(BlockBackend *blk, bool load);