yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

26ba25
From 80f064aafcf344ba6c87b948b7bc8f9c13cd8ab1 Mon Sep 17 00:00:00 2001
26ba25
From: John Snow <jsnow@redhat.com>
26ba25
Date: Tue, 25 Sep 2018 22:34:16 +0100
26ba25
Subject: [PATCH 13/28] block/commit: add block job creation flags
26ba25
26ba25
RH-Author: John Snow <jsnow@redhat.com>
26ba25
Message-id: <20180925223431.24791-11-jsnow@redhat.com>
26ba25
Patchwork-id: 82264
26ba25
O-Subject: [RHEL8/rhel qemu-kvm PATCH 10/25] block/commit: 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-2-jsnow@redhat.com
26ba25
Signed-off-by: Max Reitz <mreitz@redhat.com>
26ba25
(cherry picked from commit 5360782d0827854383097d560715d8d8027ee590)
26ba25
Signed-off-by: John Snow <jsnow@redhat.com>
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 block/commit.c            | 5 +++--
26ba25
 blockdev.c                | 7 ++++---
26ba25
 include/block/block_int.h | 5 ++++-
26ba25
 3 files changed, 11 insertions(+), 6 deletions(-)
26ba25
26ba25
diff --git a/block/commit.c b/block/commit.c
26ba25
index 25b3cb8..c737664 100644
26ba25
--- a/block/commit.c
26ba25
+++ b/block/commit.c
26ba25
@@ -254,7 +254,8 @@ static BlockDriver bdrv_commit_top = {
26ba25
 };
26ba25
 
26ba25
 void commit_start(const char *job_id, BlockDriverState *bs,
26ba25
-                  BlockDriverState *base, BlockDriverState *top, int64_t speed,
26ba25
+                  BlockDriverState *base, BlockDriverState *top,
26ba25
+                  int creation_flags, int64_t speed,
26ba25
                   BlockdevOnError on_error, const char *backing_file_str,
26ba25
                   const char *filter_node_name, Error **errp)
26ba25
 {
26ba25
@@ -272,7 +273,7 @@ void commit_start(const char *job_id, BlockDriverState *bs,
26ba25
     }
26ba25
 
26ba25
     s = block_job_create(job_id, &commit_job_driver, NULL, bs, 0, BLK_PERM_ALL,
26ba25
-                         speed, JOB_DEFAULT, NULL, NULL, errp);
26ba25
+                         speed, creation_flags, NULL, NULL, errp);
26ba25
     if (!s) {
26ba25
         return;
26ba25
     }
26ba25
diff --git a/blockdev.c b/blockdev.c
26ba25
index 0bdd3b5..4f96aa7 100644
26ba25
--- a/blockdev.c
26ba25
+++ b/blockdev.c
26ba25
@@ -3325,6 +3325,7 @@ void qmp_block_commit(bool has_job_id, const char *job_id, const char *device,
26ba25
      * BlockdevOnError change for blkmirror makes it in
26ba25
      */
26ba25
     BlockdevOnError on_error = BLOCKDEV_ON_ERROR_REPORT;
26ba25
+    int job_flags = JOB_DEFAULT;
26ba25
 
26ba25
     if (!has_speed) {
26ba25
         speed = 0;
26ba25
@@ -3406,15 +3407,15 @@ void qmp_block_commit(bool has_job_id, const char *job_id, const char *device,
26ba25
             goto out;
26ba25
         }
26ba25
         commit_active_start(has_job_id ? job_id : NULL, bs, base_bs,
26ba25
-                            JOB_DEFAULT, speed, on_error,
26ba25
+                            job_flags, speed, on_error,
26ba25
                             filter_node_name, NULL, NULL, false, &local_err);
26ba25
     } else {
26ba25
         BlockDriverState *overlay_bs = bdrv_find_overlay(bs, top_bs);
26ba25
         if (bdrv_op_is_blocked(overlay_bs, BLOCK_OP_TYPE_COMMIT_TARGET, errp)) {
26ba25
             goto out;
26ba25
         }
26ba25
-        commit_start(has_job_id ? job_id : NULL, bs, base_bs, top_bs, speed,
26ba25
-                     on_error, has_backing_file ? backing_file : NULL,
26ba25
+        commit_start(has_job_id ? job_id : NULL, bs, base_bs, top_bs, job_flags,
26ba25
+                     speed, on_error, has_backing_file ? backing_file : NULL,
26ba25
                      filter_node_name, &local_err);
26ba25
     }
26ba25
     if (local_err != NULL) {
26ba25
diff --git a/include/block/block_int.h b/include/block/block_int.h
26ba25
index b05cf11..25ad363 100644
26ba25
--- a/include/block/block_int.h
26ba25
+++ b/include/block/block_int.h
26ba25
@@ -951,6 +951,8 @@ void stream_start(const char *job_id, BlockDriverState *bs,
26ba25
  * @bs: Active block device.
26ba25
  * @top: Top block device to be committed.
26ba25
  * @base: Block device that will be written into, and become the new top.
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
  * @on_error: The action to take upon error.
26ba25
  * @backing_file_str: String to use as the backing file in @top's overlay
26ba25
@@ -961,7 +963,8 @@ void stream_start(const char *job_id, BlockDriverState *bs,
26ba25
  *
26ba25
  */
26ba25
 void commit_start(const char *job_id, BlockDriverState *bs,
26ba25
-                  BlockDriverState *base, BlockDriverState *top, int64_t speed,
26ba25
+                  BlockDriverState *base, BlockDriverState *top,
26ba25
+                  int creation_flags, int64_t speed,
26ba25
                   BlockdevOnError on_error, const char *backing_file_str,
26ba25
                   const char *filter_node_name, Error **errp);
26ba25
 /**
26ba25
-- 
26ba25
1.8.3.1
26ba25