Blame SOURCES/kvm-block-mirror-add-block-job-creation-flags.patch

383d26
From 504f6ad36108eb4d710cd1e29694bb4a2bcdb8bd Mon Sep 17 00:00:00 2001
383d26
From: John Snow <jsnow@redhat.com>
383d26
Date: Mon, 10 Sep 2018 18:17:49 +0200
383d26
Subject: [PATCH 11/25] block/mirror: add block job creation flags
383d26
383d26
RH-Author: John Snow <jsnow@redhat.com>
383d26
Message-id: <20180910181803.11781-12-jsnow@redhat.com>
383d26
Patchwork-id: 82088
383d26
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 11/25] block/mirror: add block job creation flags
383d26
Bugzilla: 1626061
383d26
RH-Acked-by: Max Reitz <mreitz@redhat.com>
383d26
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
383d26
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
383d26
383d26
Add support for taking and passing forward job creation flags.
383d26
383d26
Signed-off-by: John Snow <jsnow@redhat.com>
383d26
Reviewed-by: Max Reitz <mreitz@redhat.com>
383d26
Reviewed-by: Jeff Cody <jcody@redhat.com>
383d26
Message-id: 20180906130225.5118-3-jsnow@redhat.com
383d26
Signed-off-by: Max Reitz <mreitz@redhat.com>
383d26
(cherry picked from commit bbb6798d0caa79cd4e899b33777c577d0bd04399)
383d26
Signed-off-by: John Snow <jsnow@redhat.com>
383d26
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
383d26
---
383d26
 block/mirror.c            | 5 +++--
383d26
 blockdev.c                | 3 ++-
383d26
 include/block/block_int.h | 5 ++++-
383d26
 3 files changed, 9 insertions(+), 4 deletions(-)
383d26
383d26
diff --git a/block/mirror.c b/block/mirror.c
383d26
index 0ab0822..a80c359 100644
383d26
--- a/block/mirror.c
383d26
+++ b/block/mirror.c
383d26
@@ -1270,7 +1270,8 @@ fail:
383d26
 
383d26
 void mirror_start(const char *job_id, BlockDriverState *bs,
383d26
                   BlockDriverState *target, const char *replaces,
383d26
-                  int64_t speed, uint32_t granularity, int64_t buf_size,
383d26
+                  int creation_flags, int64_t speed,
383d26
+                  uint32_t granularity, int64_t buf_size,
383d26
                   MirrorSyncMode mode, BlockMirrorBackingMode backing_mode,
383d26
                   BlockdevOnError on_source_error,
383d26
                   BlockdevOnError on_target_error,
383d26
@@ -1285,7 +1286,7 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
383d26
     }
383d26
     is_none_mode = mode == MIRROR_SYNC_MODE_NONE;
383d26
     base = mode == MIRROR_SYNC_MODE_TOP ? backing_bs(bs) : NULL;
383d26
-    mirror_start_job(job_id, bs, JOB_DEFAULT, target, replaces,
383d26
+    mirror_start_job(job_id, bs, creation_flags, target, replaces,
383d26
                      speed, granularity, buf_size, backing_mode,
383d26
                      on_source_error, on_target_error, unmap, NULL, NULL,
383d26
                      &mirror_job_driver, is_none_mode, base, false,
383d26
diff --git a/blockdev.c b/blockdev.c
383d26
index 20dbcf5..5d38e17 100644
383d26
--- a/blockdev.c
383d26
+++ b/blockdev.c
383d26
@@ -3746,6 +3746,7 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
383d26
                                    const char *filter_node_name,
383d26
                                    Error **errp)
383d26
 {
383d26
+    int job_flags = JOB_DEFAULT;
383d26
 
383d26
     if (!has_speed) {
383d26
         speed = 0;
383d26
@@ -3795,7 +3796,7 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
383d26
      * and will allow to check whether the node still exist at mirror completion
383d26
      */
383d26
     mirror_start(job_id, bs, target,
383d26
-                 has_replaces ? replaces : NULL,
383d26
+                 has_replaces ? replaces : NULL, job_flags,
383d26
                  speed, granularity, buf_size, sync, backing_mode,
383d26
                  on_source_error, on_target_error, unmap, filter_node_name,
383d26
                  errp);
383d26
diff --git a/include/block/block_int.h b/include/block/block_int.h
383d26
index 25ad363..07517cf 100644
383d26
--- a/include/block/block_int.h
383d26
+++ b/include/block/block_int.h
383d26
@@ -1000,6 +1000,8 @@ void commit_active_start(const char *job_id, BlockDriverState *bs,
383d26
  * @target: Block device to write to.
383d26
  * @replaces: Block graph node name to replace once the mirror is done. Can
383d26
  *            only be used when full mirroring is selected.
383d26
+ * @creation_flags: Flags that control the behavior of the Job lifetime.
383d26
+ *                  See @BlockJobCreateFlags
383d26
  * @speed: The maximum speed, in bytes per second, or 0 for unlimited.
383d26
  * @granularity: The chosen granularity for the dirty bitmap.
383d26
  * @buf_size: The amount of data that can be in flight at one time.
383d26
@@ -1020,7 +1022,8 @@ void commit_active_start(const char *job_id, BlockDriverState *bs,
383d26
  */
383d26
 void mirror_start(const char *job_id, BlockDriverState *bs,
383d26
                   BlockDriverState *target, const char *replaces,
383d26
-                  int64_t speed, uint32_t granularity, int64_t buf_size,
383d26
+                  int creation_flags, int64_t speed,
383d26
+                  uint32_t granularity, int64_t buf_size,
383d26
                   MirrorSyncMode mode, BlockMirrorBackingMode backing_mode,
383d26
                   BlockdevOnError on_source_error,
383d26
                   BlockdevOnError on_target_error,
383d26
-- 
383d26
1.8.3.1
383d26