yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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