yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

26ba25
From dca12aacc8c49d23415968098f888aaefb52f747 Mon Sep 17 00:00:00 2001
26ba25
From: John Snow <jsnow@redhat.com>
26ba25
Date: Tue, 25 Sep 2018 22:34:17 +0100
26ba25
Subject: [PATCH 14/28] block/mirror: add block job creation flags
26ba25
26ba25
RH-Author: John Snow <jsnow@redhat.com>
26ba25
Message-id: <20180925223431.24791-12-jsnow@redhat.com>
26ba25
Patchwork-id: 82268
26ba25
O-Subject: [RHEL8/rhel qemu-kvm PATCH 11/25] block/mirror: add block job creation flags
26ba25
Bugzilla: 1632939
26ba25
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
26ba25
RH-Acked-by: Max Reitz <mreitz@redhat.com>
26ba25
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
26ba25
26ba25
Add support for taking and passing forward job creation flags.
26ba25
26ba25
Signed-off-by: John Snow <jsnow@redhat.com>
26ba25
Reviewed-by: Max Reitz <mreitz@redhat.com>
26ba25
Reviewed-by: Jeff Cody <jcody@redhat.com>
26ba25
Message-id: 20180906130225.5118-3-jsnow@redhat.com
26ba25
Signed-off-by: Max Reitz <mreitz@redhat.com>
26ba25
(cherry picked from commit a1999b33488daba68a1bcd7c6fdf314ddeacc6a2)
26ba25
Signed-off-by: John Snow <jsnow@redhat.com>
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 block/mirror.c            | 5 +++--
26ba25
 blockdev.c                | 3 ++-
26ba25
 include/block/block_int.h | 5 ++++-
26ba25
 3 files changed, 9 insertions(+), 4 deletions(-)
26ba25
26ba25
diff --git a/block/mirror.c b/block/mirror.c
26ba25
index 2604f61..9bed603 100644
26ba25
--- a/block/mirror.c
26ba25
+++ b/block/mirror.c
26ba25
@@ -1265,7 +1265,8 @@ fail:
26ba25
 
26ba25
 void mirror_start(const char *job_id, BlockDriverState *bs,
26ba25
                   BlockDriverState *target, const char *replaces,
26ba25
-                  int64_t speed, uint32_t granularity, int64_t buf_size,
26ba25
+                  int creation_flags, int64_t speed,
26ba25
+                  uint32_t granularity, int64_t buf_size,
26ba25
                   MirrorSyncMode mode, BlockMirrorBackingMode backing_mode,
26ba25
                   BlockdevOnError on_source_error,
26ba25
                   BlockdevOnError on_target_error,
26ba25
@@ -1280,7 +1281,7 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
26ba25
     }
26ba25
     is_none_mode = mode == MIRROR_SYNC_MODE_NONE;
26ba25
     base = mode == MIRROR_SYNC_MODE_TOP ? backing_bs(bs) : NULL;
26ba25
-    mirror_start_job(job_id, bs, JOB_DEFAULT, target, replaces,
26ba25
+    mirror_start_job(job_id, bs, creation_flags, target, replaces,
26ba25
                      speed, granularity, buf_size, backing_mode,
26ba25
                      on_source_error, on_target_error, unmap, NULL, NULL,
26ba25
                      &mirror_job_driver, is_none_mode, base, false,
26ba25
diff --git a/blockdev.c b/blockdev.c
26ba25
index 4f96aa7..a265dc7 100644
26ba25
--- a/blockdev.c
26ba25
+++ b/blockdev.c
26ba25
@@ -3700,6 +3700,7 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
26ba25
                                    const char *filter_node_name,
26ba25
                                    Error **errp)
26ba25
 {
26ba25
+    int job_flags = JOB_DEFAULT;
26ba25
 
26ba25
     if (!has_speed) {
26ba25
         speed = 0;
26ba25
@@ -3749,7 +3750,7 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
26ba25
      * and will allow to check whether the node still exist at mirror completion
26ba25
      */
26ba25
     mirror_start(job_id, bs, target,
26ba25
-                 has_replaces ? replaces : NULL,
26ba25
+                 has_replaces ? replaces : NULL, job_flags,
26ba25
                  speed, granularity, buf_size, sync, backing_mode,
26ba25
                  on_source_error, on_target_error, unmap, filter_node_name,
26ba25
                  errp);
26ba25
diff --git a/include/block/block_int.h b/include/block/block_int.h
26ba25
index 25ad363..07517cf 100644
26ba25
--- a/include/block/block_int.h
26ba25
+++ b/include/block/block_int.h
26ba25
@@ -1000,6 +1000,8 @@ void commit_active_start(const char *job_id, BlockDriverState *bs,
26ba25
  * @target: Block device to write to.
26ba25
  * @replaces: Block graph node name to replace once the mirror is done. Can
26ba25
  *            only be used when full mirroring is selected.
26ba25
+ * @creation_flags: Flags that control the behavior of the Job lifetime.
26ba25
+ *                  See @BlockJobCreateFlags
26ba25
  * @speed: The maximum speed, in bytes per second, or 0 for unlimited.
26ba25
  * @granularity: The chosen granularity for the dirty bitmap.
26ba25
  * @buf_size: The amount of data that can be in flight at one time.
26ba25
@@ -1020,7 +1022,8 @@ void commit_active_start(const char *job_id, BlockDriverState *bs,
26ba25
  */
26ba25
 void mirror_start(const char *job_id, BlockDriverState *bs,
26ba25
                   BlockDriverState *target, const char *replaces,
26ba25
-                  int64_t speed, uint32_t granularity, int64_t buf_size,
26ba25
+                  int creation_flags, int64_t speed,
26ba25
+                  uint32_t granularity, int64_t buf_size,
26ba25
                   MirrorSyncMode mode, BlockMirrorBackingMode backing_mode,
26ba25
                   BlockdevOnError on_source_error,
26ba25
                   BlockdevOnError on_target_error,
26ba25
-- 
26ba25
1.8.3.1
26ba25