thebeanogamer / rpms / qemu-kvm

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