From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, "Daniel P. Berrangé" <berrange@redhat.com>,
"Juan Quintela" <quintela@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Hailiang Zhang" <zhang.zhanghailiang@huawei.com>,
"Fam Zheng" <fam@euphon.net>,
"Hailiang Zhang" <zhanghailiang@xfusion.com>
Subject: [PATCH v2 11/21] migration: stop passing 'opaque' parameter to QEMUFile hooks
Date: Mon, 20 Jun 2022 12:01:55 +0100 [thread overview]
Message-ID: <20220620110205.1357829-12-berrange@redhat.com> (raw)
In-Reply-To: <20220620110205.1357829-1-berrange@redhat.com>
The only user of the hooks is RDMA which provides a QIOChannel backed
impl of QEMUFile. It can thus use the qemu_file_get_ioc() method.
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
migration/qemu-file.c | 8 ++++----
migration/qemu-file.h | 14 ++++++--------
migration/rdma.c | 19 ++++++++++---------
3 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index 6bbdb60d4d..006880abd3 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -266,7 +266,7 @@ void ram_control_before_iterate(QEMUFile *f, uint64_t flags)
int ret = 0;
if (f->hooks && f->hooks->before_ram_iterate) {
- ret = f->hooks->before_ram_iterate(f, f->opaque, flags, NULL);
+ ret = f->hooks->before_ram_iterate(f, flags, NULL);
if (ret < 0) {
qemu_file_set_error(f, ret);
}
@@ -278,7 +278,7 @@ void ram_control_after_iterate(QEMUFile *f, uint64_t flags)
int ret = 0;
if (f->hooks && f->hooks->after_ram_iterate) {
- ret = f->hooks->after_ram_iterate(f, f->opaque, flags, NULL);
+ ret = f->hooks->after_ram_iterate(f, flags, NULL);
if (ret < 0) {
qemu_file_set_error(f, ret);
}
@@ -290,7 +290,7 @@ void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data)
int ret = -EINVAL;
if (f->hooks && f->hooks->hook_ram_load) {
- ret = f->hooks->hook_ram_load(f, f->opaque, flags, data);
+ ret = f->hooks->hook_ram_load(f, flags, data);
if (ret < 0) {
qemu_file_set_error(f, ret);
}
@@ -310,7 +310,7 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
uint64_t *bytes_sent)
{
if (f->hooks && f->hooks->save_page) {
- int ret = f->hooks->save_page(f, f->opaque, block_offset,
+ int ret = f->hooks->save_page(f, block_offset,
offset, size, bytes_sent);
if (ret != RAM_SAVE_CONTROL_NOT_SUPP) {
f->rate_limit_used += size;
diff --git a/migration/qemu-file.h b/migration/qemu-file.h
index 901f2cf697..277f1d5a62 100644
--- a/migration/qemu-file.h
+++ b/migration/qemu-file.h
@@ -65,11 +65,9 @@ typedef ssize_t (QEMUFileWritevBufferFunc)(void *opaque, struct iovec *iov,
/*
* This function provides hooks around different
* stages of RAM migration.
- * 'opaque' is the backend specific data in QEMUFile
* 'data' is call specific data associated with the 'flags' value
*/
-typedef int (QEMURamHookFunc)(QEMUFile *f, void *opaque, uint64_t flags,
- void *data);
+typedef int (QEMURamHookFunc)(QEMUFile *f, uint64_t flags, void *data);
/*
* Constants used by ram_control_* hooks
@@ -84,11 +82,11 @@ typedef int (QEMURamHookFunc)(QEMUFile *f, void *opaque, uint64_t flags,
* This function allows override of where the RAM page
* is saved (such as RDMA, for example.)
*/
-typedef size_t (QEMURamSaveFunc)(QEMUFile *f, void *opaque,
- ram_addr_t block_offset,
- ram_addr_t offset,
- size_t size,
- uint64_t *bytes_sent);
+typedef size_t (QEMURamSaveFunc)(QEMUFile *f,
+ ram_addr_t block_offset,
+ ram_addr_t offset,
+ size_t size,
+ uint64_t *bytes_sent);
/*
* Return a QEMUFile for comms in the opposite direction
diff --git a/migration/rdma.c b/migration/rdma.c
index 6e7756bee7..83265513d9 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -3256,11 +3256,11 @@ qio_channel_rdma_shutdown(QIOChannel *ioc,
* sent. Usually, this will not be more than a few bytes of
* the protocol because most transfers are sent asynchronously.
*/
-static size_t qemu_rdma_save_page(QEMUFile *f, void *opaque,
+static size_t qemu_rdma_save_page(QEMUFile *f,
ram_addr_t block_offset, ram_addr_t offset,
size_t size, uint64_t *bytes_sent)
{
- QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(opaque);
+ QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(qemu_file_get_ioc(f));
RDMAContext *rdma;
int ret;
@@ -3872,14 +3872,15 @@ rdma_block_notification_handle(QIOChannelRDMA *rioc, const char *name)
return 0;
}
-static int rdma_load_hook(QEMUFile *f, void *opaque, uint64_t flags, void *data)
+static int rdma_load_hook(QEMUFile *f, uint64_t flags, void *data)
{
+ QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(qemu_file_get_ioc(f));
switch (flags) {
case RAM_CONTROL_BLOCK_REG:
- return rdma_block_notification_handle(opaque, data);
+ return rdma_block_notification_handle(rioc, data);
case RAM_CONTROL_HOOK:
- return qemu_rdma_registration_handle(f, opaque);
+ return qemu_rdma_registration_handle(f, rioc);
default:
/* Shouldn't be called with any other values */
@@ -3887,10 +3888,10 @@ static int rdma_load_hook(QEMUFile *f, void *opaque, uint64_t flags, void *data)
}
}
-static int qemu_rdma_registration_start(QEMUFile *f, void *opaque,
+static int qemu_rdma_registration_start(QEMUFile *f,
uint64_t flags, void *data)
{
- QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(opaque);
+ QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(qemu_file_get_ioc(f));
RDMAContext *rdma;
RCU_READ_LOCK_GUARD();
@@ -3916,10 +3917,10 @@ static int qemu_rdma_registration_start(QEMUFile *f, void *opaque,
* Inform dest that dynamic registrations are done for now.
* First, flush writes, if any.
*/
-static int qemu_rdma_registration_stop(QEMUFile *f, void *opaque,
+static int qemu_rdma_registration_stop(QEMUFile *f,
uint64_t flags, void *data)
{
- QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(opaque);
+ QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(qemu_file_get_ioc(f));
RDMAContext *rdma;
RDMAControlHeader head = { .len = 0, .repeat = 1 };
int ret = 0;
--
2.36.1
next prev parent reply other threads:[~2022-06-20 11:14 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-20 11:01 [PATCH v2 00/21] migration: remove QEMUFileOps concept and assume use of QIOChannel Daniel P. Berrangé
2022-06-20 11:01 ` [PATCH v2 01/21] io: add a QIOChannelNull equivalent to /dev/null Daniel P. Berrangé
2022-06-20 12:44 ` Juan Quintela
2022-06-20 11:01 ` [PATCH v2 02/21] migration: switch to use QIOChannelNull for dummy channel Daniel P. Berrangé
2022-06-20 12:45 ` Juan Quintela
2022-06-20 11:01 ` [PATCH v2 03/21] migration: remove unreachble RDMA code in save_hook impl Daniel P. Berrangé
2022-06-20 15:11 ` Juan Quintela
2022-06-20 11:01 ` [PATCH v2 04/21] migration: rename rate limiting fields in QEMUFile Daniel P. Berrangé
2022-06-20 15:11 ` Juan Quintela
2022-06-20 11:01 ` [PATCH v2 05/21] migration: rename 'pos' field in QEMUFile to 'bytes_processed' Daniel P. Berrangé
2022-06-20 15:12 ` Juan Quintela
2022-06-20 11:01 ` [PATCH v2 06/21] migration: rename qemu_ftell to qemu_file_total_transferred Daniel P. Berrangé
2022-06-20 15:13 ` Juan Quintela
2022-06-20 11:01 ` [PATCH v2 07/21] migration: rename qemu_update_position to qemu_file_credit_transfer Daniel P. Berrangé
2022-06-20 15:14 ` Juan Quintela
2022-06-20 11:01 ` [PATCH v2 08/21] migration: rename qemu_file_update_transfer to qemu_file_acct_rate_limit Daniel P. Berrangé
2022-06-20 14:36 ` Dr. David Alan Gilbert
2022-06-20 15:15 ` Juan Quintela
2022-06-20 11:01 ` [PATCH v2 09/21] migration: introduce a QIOChannel impl for BlockDriverState VMState Daniel P. Berrangé
2022-06-20 15:17 ` Juan Quintela
2022-06-21 15:40 ` Juan Quintela
2022-06-21 15:42 ` Daniel P. Berrangé
2022-06-20 11:01 ` [PATCH v2 10/21] migration: convert savevm to use QIOChannelBlock for VMState Daniel P. Berrangé
2022-06-20 15:19 ` Juan Quintela
2022-06-20 11:01 ` Daniel P. Berrangé [this message]
2022-06-20 15:20 ` [PATCH v2 11/21] migration: stop passing 'opaque' parameter to QEMUFile hooks Juan Quintela
2022-06-20 11:01 ` [PATCH v2 12/21] migration: hardcode assumption that QEMUFile is backed with QIOChannel Daniel P. Berrangé
2022-06-20 15:21 ` Juan Quintela
2022-06-20 11:01 ` [PATCH v2 13/21] migration: introduce new constructors for QEMUFile Daniel P. Berrangé
2022-06-20 15:27 ` Juan Quintela
2022-06-20 11:01 ` [PATCH v2 14/21] migration: remove unused QEMUFileGetFD typedef / qemu_get_fd method Daniel P. Berrangé
2022-06-20 15:28 ` Juan Quintela
2022-06-20 11:01 ` [PATCH v2 15/21] migration: remove the QEMUFileOps 'shut_down' callback Daniel P. Berrangé
2022-06-20 15:36 ` Juan Quintela
2022-06-20 11:02 ` [PATCH v2 16/21] migration: remove the QEMUFileOps 'set_blocking' callback Daniel P. Berrangé
2022-06-20 15:39 ` Juan Quintela
2022-06-20 11:02 ` [PATCH v2 17/21] migration: remove the QEMUFileOps 'close' callback Daniel P. Berrangé
2022-06-20 15:40 ` Juan Quintela
2022-06-20 11:02 ` [PATCH v2 18/21] migration: remove the QEMUFileOps 'get_buffer' callback Daniel P. Berrangé
2022-06-20 15:40 ` Juan Quintela
2022-06-27 12:04 ` Dr. David Alan Gilbert
2022-06-20 11:02 ` [PATCH v2 19/21] migration: remove the QEMUFileOps 'writev_buffer' callback Daniel P. Berrangé
2022-06-20 15:43 ` Juan Quintela
2022-06-20 11:02 ` [PATCH v2 20/21] migration: remove the QEMUFileOps 'get_return_path' callback Daniel P. Berrangé
2022-06-20 15:45 ` Juan Quintela
2022-06-20 11:02 ` [PATCH v2 21/21] migration: remove the QEMUFileOps abstraction Daniel P. Berrangé
2022-06-20 15:47 ` Juan Quintela
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220620110205.1357829-12-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=fam@euphon.net \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@redhat.com \
--cc=zhang.zhanghailiang@huawei.com \
--cc=zhanghailiang@xfusion.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).