|
|
a83cc2 |
From 6f827f890e68c3b8bda80822edc09369e93da01f Mon Sep 17 00:00:00 2001
|
|
|
a83cc2 |
From: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
a83cc2 |
Date: Thu, 29 Jul 2021 07:42:29 -0400
|
|
|
a83cc2 |
Subject: [PATCH 17/39] iothread: generalize
|
|
|
a83cc2 |
iothread_set_param/iothread_get_param
|
|
|
a83cc2 |
|
|
|
a83cc2 |
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
a83cc2 |
RH-MergeRequest: 32: Synchronize with RHEL-AV 8.5 release 27 to RHEL 9
|
|
|
a83cc2 |
RH-Commit: [9/15] 7c624847cfc636bdfa0d4f35062500a7f9e8437f (mrezanin/centos-src-qemu-kvm)
|
|
|
a83cc2 |
RH-Bugzilla: 1957194
|
|
|
a83cc2 |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
a83cc2 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
a83cc2 |
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
a83cc2 |
RH-Acked-by: Andrew Jones <drjones@redhat.com>
|
|
|
a83cc2 |
|
|
|
a83cc2 |
Changes in preparation for next patches where we add a new
|
|
|
a83cc2 |
parameter not related to the poll mechanism.
|
|
|
a83cc2 |
|
|
|
a83cc2 |
Let's add two new generic functions (iothread_set_param and
|
|
|
a83cc2 |
iothread_get_param) that we use to set and get IOThread
|
|
|
a83cc2 |
parameters.
|
|
|
a83cc2 |
|
|
|
a83cc2 |
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
a83cc2 |
Message-id: 20210721094211.69853-2-sgarzare@redhat.com
|
|
|
a83cc2 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
a83cc2 |
(cherry picked from commit 0445409d7497bededa1047f0d8298b0d4bb3b1a3)
|
|
|
a83cc2 |
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
a83cc2 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
a83cc2 |
---
|
|
|
a83cc2 |
iothread.c | 27 +++++++++++++++++++++++----
|
|
|
a83cc2 |
1 file changed, 23 insertions(+), 4 deletions(-)
|
|
|
a83cc2 |
|
|
|
a83cc2 |
diff --git a/iothread.c b/iothread.c
|
|
|
a83cc2 |
index 7f086387be..a12de6e455 100644
|
|
|
a83cc2 |
--- a/iothread.c
|
|
|
a83cc2 |
+++ b/iothread.c
|
|
|
a83cc2 |
@@ -220,7 +220,7 @@ static PollParamInfo poll_shrink_info = {
|
|
|
a83cc2 |
"poll-shrink", offsetof(IOThread, poll_shrink),
|
|
|
a83cc2 |
};
|
|
|
a83cc2 |
|
|
|
a83cc2 |
-static void iothread_get_poll_param(Object *obj, Visitor *v,
|
|
|
a83cc2 |
+static void iothread_get_param(Object *obj, Visitor *v,
|
|
|
a83cc2 |
const char *name, void *opaque, Error **errp)
|
|
|
a83cc2 |
{
|
|
|
a83cc2 |
IOThread *iothread = IOTHREAD(obj);
|
|
|
a83cc2 |
@@ -230,7 +230,7 @@ static void iothread_get_poll_param(Object *obj, Visitor *v,
|
|
|
a83cc2 |
visit_type_int64(v, name, field, errp);
|
|
|
a83cc2 |
}
|
|
|
a83cc2 |
|
|
|
a83cc2 |
-static void iothread_set_poll_param(Object *obj, Visitor *v,
|
|
|
a83cc2 |
+static bool iothread_set_param(Object *obj, Visitor *v,
|
|
|
a83cc2 |
const char *name, void *opaque, Error **errp)
|
|
|
a83cc2 |
{
|
|
|
a83cc2 |
IOThread *iothread = IOTHREAD(obj);
|
|
|
a83cc2 |
@@ -239,17 +239,36 @@ static void iothread_set_poll_param(Object *obj, Visitor *v,
|
|
|
a83cc2 |
int64_t value;
|
|
|
a83cc2 |
|
|
|
a83cc2 |
if (!visit_type_int64(v, name, &value, errp)) {
|
|
|
a83cc2 |
- return;
|
|
|
a83cc2 |
+ return false;
|
|
|
a83cc2 |
}
|
|
|
a83cc2 |
|
|
|
a83cc2 |
if (value < 0) {
|
|
|
a83cc2 |
error_setg(errp, "%s value must be in range [0, %" PRId64 "]",
|
|
|
a83cc2 |
info->name, INT64_MAX);
|
|
|
a83cc2 |
- return;
|
|
|
a83cc2 |
+ return false;
|
|
|
a83cc2 |
}
|
|
|
a83cc2 |
|
|
|
a83cc2 |
*field = value;
|
|
|
a83cc2 |
|
|
|
a83cc2 |
+ return true;
|
|
|
a83cc2 |
+}
|
|
|
a83cc2 |
+
|
|
|
a83cc2 |
+static void iothread_get_poll_param(Object *obj, Visitor *v,
|
|
|
a83cc2 |
+ const char *name, void *opaque, Error **errp)
|
|
|
a83cc2 |
+{
|
|
|
a83cc2 |
+
|
|
|
a83cc2 |
+ iothread_get_param(obj, v, name, opaque, errp);
|
|
|
a83cc2 |
+}
|
|
|
a83cc2 |
+
|
|
|
a83cc2 |
+static void iothread_set_poll_param(Object *obj, Visitor *v,
|
|
|
a83cc2 |
+ const char *name, void *opaque, Error **errp)
|
|
|
a83cc2 |
+{
|
|
|
a83cc2 |
+ IOThread *iothread = IOTHREAD(obj);
|
|
|
a83cc2 |
+
|
|
|
a83cc2 |
+ if (!iothread_set_param(obj, v, name, opaque, errp)) {
|
|
|
a83cc2 |
+ return;
|
|
|
a83cc2 |
+ }
|
|
|
a83cc2 |
+
|
|
|
a83cc2 |
if (iothread->ctx) {
|
|
|
a83cc2 |
aio_context_set_poll_params(iothread->ctx,
|
|
|
a83cc2 |
iothread->poll_max_ns,
|
|
|
a83cc2 |
--
|
|
|
a83cc2 |
2.27.0
|
|
|
a83cc2 |
|