yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
26ba25
From c9f61825124efe29eb8d77e72a6c93961cb4c389 Mon Sep 17 00:00:00 2001
26ba25
From: John Snow <jsnow@redhat.com>
26ba25
Date: Tue, 25 Sep 2018 22:34:18 +0100
26ba25
Subject: [PATCH 15/28] block/stream: add block job creation flags
26ba25
26ba25
RH-Author: John Snow <jsnow@redhat.com>
26ba25
Message-id: <20180925223431.24791-13-jsnow@redhat.com>
26ba25
Patchwork-id: 82263
26ba25
O-Subject: [RHEL8/rhel qemu-kvm PATCH 12/25] block/stream: 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-4-jsnow@redhat.com
26ba25
Signed-off-by: Max Reitz <mreitz@redhat.com>
26ba25
(cherry picked from commit cf6320df581e6cbde6a95075266859a8f9ba9d55)
26ba25
Signed-off-by: John Snow <jsnow@redhat.com>
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 block/stream.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/stream.c b/block/stream.c
26ba25
index 67e1e72..700eb23 100644
26ba25
--- a/block/stream.c
26ba25
+++ b/block/stream.c
26ba25
@@ -214,7 +214,8 @@ static const BlockJobDriver stream_job_driver = {
26ba25
 
26ba25
 void stream_start(const char *job_id, BlockDriverState *bs,
26ba25
                   BlockDriverState *base, const char *backing_file_str,
26ba25
-                  int64_t speed, BlockdevOnError on_error, Error **errp)
26ba25
+                  int creation_flags, int64_t speed,
26ba25
+                  BlockdevOnError on_error, Error **errp)
26ba25
 {
26ba25
     StreamBlockJob *s;
26ba25
     BlockDriverState *iter;
26ba25
@@ -236,7 +237,7 @@ void stream_start(const char *job_id, BlockDriverState *bs,
26ba25
                          BLK_PERM_GRAPH_MOD,
26ba25
                          BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE_UNCHANGED |
26ba25
                          BLK_PERM_WRITE,
26ba25
-                         speed, JOB_DEFAULT, NULL, NULL, errp);
26ba25
+                         speed, creation_flags, NULL, NULL, errp);
26ba25
     if (!s) {
26ba25
         goto fail;
26ba25
     }
26ba25
diff --git a/blockdev.c b/blockdev.c
26ba25
index a265dc7..90a50d0 100644
26ba25
--- a/blockdev.c
26ba25
+++ b/blockdev.c
26ba25
@@ -3234,6 +3234,7 @@ void qmp_block_stream(bool has_job_id, const char *job_id, const char *device,
26ba25
     AioContext *aio_context;
26ba25
     Error *local_err = NULL;
26ba25
     const char *base_name = NULL;
26ba25
+    int job_flags = JOB_DEFAULT;
26ba25
 
26ba25
     if (!has_on_error) {
26ba25
         on_error = BLOCKDEV_ON_ERROR_REPORT;
26ba25
@@ -3296,7 +3297,7 @@ void qmp_block_stream(bool has_job_id, const char *job_id, const char *device,
26ba25
     base_name = has_backing_file ? backing_file : base_name;
26ba25
 
26ba25
     stream_start(has_job_id ? job_id : NULL, bs, base_bs, base_name,
26ba25
-                 has_speed ? speed : 0, on_error, &local_err);
26ba25
+                 job_flags, has_speed ? speed : 0, on_error, &local_err);
26ba25
     if (local_err) {
26ba25
         error_propagate(errp, local_err);
26ba25
         goto out;
26ba25
diff --git a/include/block/block_int.h b/include/block/block_int.h
26ba25
index 07517cf..341cbe8 100644
26ba25
--- a/include/block/block_int.h
26ba25
+++ b/include/block/block_int.h
26ba25
@@ -929,6 +929,8 @@ int is_windows_drive(const char *filename);
26ba25
  * flatten the whole backing file chain onto @bs.
26ba25
  * @backing_file_str: The file name that will be written to @bs as the
26ba25
  * the new backing file if the job completes. Ignored if @base is %NULL.
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
  * @errp: Error object.
26ba25
@@ -942,7 +944,8 @@ int is_windows_drive(const char *filename);
26ba25
  */
26ba25
 void stream_start(const char *job_id, BlockDriverState *bs,
26ba25
                   BlockDriverState *base, const char *backing_file_str,
26ba25
-                  int64_t speed, BlockdevOnError on_error, Error **errp);
26ba25
+                  int creation_flags, int64_t speed,
26ba25
+                  BlockdevOnError on_error, Error **errp);
26ba25
 
26ba25
 /**
26ba25
  * commit_start:
26ba25
-- 
26ba25
1.8.3.1
26ba25