|
|
357786 |
From 360e16997de84bddd37f5262f33d98b96b8aae2f Mon Sep 17 00:00:00 2001
|
|
|
357786 |
From: John Snow <jsnow@redhat.com>
|
|
|
357786 |
Date: Mon, 10 Sep 2018 18:17:50 +0200
|
|
|
357786 |
Subject: [PATCH 12/25] block/stream: add block job creation flags
|
|
|
357786 |
|
|
|
357786 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
357786 |
Message-id: <20180910181803.11781-13-jsnow@redhat.com>
|
|
|
357786 |
Patchwork-id: 82089
|
|
|
357786 |
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 12/25] block/stream: add block job creation flags
|
|
|
357786 |
Bugzilla: 1626061
|
|
|
357786 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
357786 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
357786 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
357786 |
|
|
|
357786 |
Add support for taking and passing forward job creation flags.
|
|
|
357786 |
|
|
|
357786 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
357786 |
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
|
|
357786 |
Reviewed-by: Jeff Cody <jcody@redhat.com>
|
|
|
357786 |
Message-id: 20180906130225.5118-4-jsnow@redhat.com
|
|
|
357786 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
357786 |
(cherry picked from commit 764cffd288722a4799e7cae0eb679d80fd636fdc)
|
|
|
357786 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
357786 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
357786 |
---
|
|
|
357786 |
block/stream.c | 5 +++--
|
|
|
357786 |
blockdev.c | 3 ++-
|
|
|
357786 |
include/block/block_int.h | 5 ++++-
|
|
|
357786 |
3 files changed, 9 insertions(+), 4 deletions(-)
|
|
|
357786 |
|
|
|
357786 |
diff --git a/block/stream.c b/block/stream.c
|
|
|
357786 |
index 67e1e72..700eb23 100644
|
|
|
357786 |
--- a/block/stream.c
|
|
|
357786 |
+++ b/block/stream.c
|
|
|
357786 |
@@ -214,7 +214,8 @@ static const BlockJobDriver stream_job_driver = {
|
|
|
357786 |
|
|
|
357786 |
void stream_start(const char *job_id, BlockDriverState *bs,
|
|
|
357786 |
BlockDriverState *base, const char *backing_file_str,
|
|
|
357786 |
- int64_t speed, BlockdevOnError on_error, Error **errp)
|
|
|
357786 |
+ int creation_flags, int64_t speed,
|
|
|
357786 |
+ BlockdevOnError on_error, Error **errp)
|
|
|
357786 |
{
|
|
|
357786 |
StreamBlockJob *s;
|
|
|
357786 |
BlockDriverState *iter;
|
|
|
357786 |
@@ -236,7 +237,7 @@ void stream_start(const char *job_id, BlockDriverState *bs,
|
|
|
357786 |
BLK_PERM_GRAPH_MOD,
|
|
|
357786 |
BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE_UNCHANGED |
|
|
|
357786 |
BLK_PERM_WRITE,
|
|
|
357786 |
- speed, JOB_DEFAULT, NULL, NULL, errp);
|
|
|
357786 |
+ speed, creation_flags, NULL, NULL, errp);
|
|
|
357786 |
if (!s) {
|
|
|
357786 |
goto fail;
|
|
|
357786 |
}
|
|
|
357786 |
diff --git a/blockdev.c b/blockdev.c
|
|
|
357786 |
index 5d38e17..c4a1801 100644
|
|
|
357786 |
--- a/blockdev.c
|
|
|
357786 |
+++ b/blockdev.c
|
|
|
357786 |
@@ -3280,6 +3280,7 @@ void qmp_block_stream(bool has_job_id, const char *job_id, const char *device,
|
|
|
357786 |
AioContext *aio_context;
|
|
|
357786 |
Error *local_err = NULL;
|
|
|
357786 |
const char *base_name = NULL;
|
|
|
357786 |
+ int job_flags = JOB_DEFAULT;
|
|
|
357786 |
|
|
|
357786 |
if (!has_on_error) {
|
|
|
357786 |
on_error = BLOCKDEV_ON_ERROR_REPORT;
|
|
|
357786 |
@@ -3342,7 +3343,7 @@ void qmp_block_stream(bool has_job_id, const char *job_id, const char *device,
|
|
|
357786 |
base_name = has_backing_file ? backing_file : base_name;
|
|
|
357786 |
|
|
|
357786 |
stream_start(has_job_id ? job_id : NULL, bs, base_bs, base_name,
|
|
|
357786 |
- has_speed ? speed : 0, on_error, &local_err);
|
|
|
357786 |
+ job_flags, has_speed ? speed : 0, on_error, &local_err);
|
|
|
357786 |
if (local_err) {
|
|
|
357786 |
error_propagate(errp, local_err);
|
|
|
357786 |
goto out;
|
|
|
357786 |
diff --git a/include/block/block_int.h b/include/block/block_int.h
|
|
|
357786 |
index 07517cf..341cbe8 100644
|
|
|
357786 |
--- a/include/block/block_int.h
|
|
|
357786 |
+++ b/include/block/block_int.h
|
|
|
357786 |
@@ -929,6 +929,8 @@ int is_windows_drive(const char *filename);
|
|
|
357786 |
* flatten the whole backing file chain onto @bs.
|
|
|
357786 |
* @backing_file_str: The file name that will be written to @bs as the
|
|
|
357786 |
* the new backing file if the job completes. Ignored if @base is %NULL.
|
|
|
357786 |
+ * @creation_flags: Flags that control the behavior of the Job lifetime.
|
|
|
357786 |
+ * See @BlockJobCreateFlags
|
|
|
357786 |
* @speed: The maximum speed, in bytes per second, or 0 for unlimited.
|
|
|
357786 |
* @on_error: The action to take upon error.
|
|
|
357786 |
* @errp: Error object.
|
|
|
357786 |
@@ -942,7 +944,8 @@ int is_windows_drive(const char *filename);
|
|
|
357786 |
*/
|
|
|
357786 |
void stream_start(const char *job_id, BlockDriverState *bs,
|
|
|
357786 |
BlockDriverState *base, const char *backing_file_str,
|
|
|
357786 |
- int64_t speed, BlockdevOnError on_error, Error **errp);
|
|
|
357786 |
+ int creation_flags, int64_t speed,
|
|
|
357786 |
+ BlockdevOnError on_error, Error **errp);
|
|
|
357786 |
|
|
|
357786 |
/**
|
|
|
357786 |
* commit_start:
|
|
|
357786 |
--
|
|
|
357786 |
1.8.3.1
|
|
|
357786 |
|