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