0727d3
From 2952487c7e5ed14796fbffae0b964a35790d6850 Mon Sep 17 00:00:00 2001
0727d3
From: Juan Quintela <quintela@redhat.com>
0727d3
Date: Wed, 18 May 2022 02:52:24 -0300
0727d3
Subject: [PATCH 14/37] multifd: Remove send_write() method
0727d3
MIME-Version: 1.0
0727d3
Content-Type: text/plain; charset=UTF-8
0727d3
Content-Transfer-Encoding: 8bit
0727d3
0727d3
RH-Author: Leonardo Brás <leobras@redhat.com>
0727d3
RH-MergeRequest: 191: MSG_ZEROCOPY + Multifd @ rhel8.7
0727d3
RH-Commit: [14/26] 5fa59ffa09099fbc6da84e9a192ca71af52cc98f
0727d3
RH-Bugzilla: 2072049
0727d3
RH-Acked-by: Peter Xu <peterx@redhat.com>
0727d3
RH-Acked-by: Daniel P. Berrangé <berrange@redhat.com>
0727d3
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
0727d3
0727d3
Everything use now iov's.
0727d3
0727d3
Signed-off-by: Juan Quintela <quintela@redhat.com>
0727d3
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
0727d3
(cherry picked from commit 468fcb5dd0c965e1af0da9efab09b1462631da18)
0727d3
Signed-off-by: Leonardo Bras <leobras@redhat.com>
0727d3
---
0727d3
 migration/multifd-zlib.c | 17 -----------------
0727d3
 migration/multifd-zstd.c | 17 -----------------
0727d3
 migration/multifd.c      | 20 ++------------------
0727d3
 migration/multifd.h      |  2 --
0727d3
 4 files changed, 2 insertions(+), 54 deletions(-)
0727d3
0727d3
diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c
0727d3
index 96475e096e..8ed29b9633 100644
0727d3
--- a/migration/multifd-zlib.c
0727d3
+++ b/migration/multifd-zlib.c
0727d3
@@ -154,22 +154,6 @@ static int zlib_send_prepare(MultiFDSendParams *p, Error **errp)
0727d3
     return 0;
0727d3
 }
0727d3
 
0727d3
-/**
0727d3
- * zlib_send_write: do the actual write of the data
0727d3
- *
0727d3
- * Do the actual write of the comprresed buffer.
0727d3
- *
0727d3
- * Returns 0 for success or -1 for error
0727d3
- *
0727d3
- * @p: Params for the channel that we are using
0727d3
- * @used: number of pages used
0727d3
- * @errp: pointer to an error
0727d3
- */
0727d3
-static int zlib_send_write(MultiFDSendParams *p, uint32_t used, Error **errp)
0727d3
-{
0727d3
-    return qio_channel_writev_all(p->c, p->iov, p->iovs_num, errp);
0727d3
-}
0727d3
-
0727d3
 /**
0727d3
  * zlib_recv_setup: setup receive side
0727d3
  *
0727d3
@@ -312,7 +296,6 @@ static MultiFDMethods multifd_zlib_ops = {
0727d3
     .send_setup = zlib_send_setup,
0727d3
     .send_cleanup = zlib_send_cleanup,
0727d3
     .send_prepare = zlib_send_prepare,
0727d3
-    .send_write = zlib_send_write,
0727d3
     .recv_setup = zlib_recv_setup,
0727d3
     .recv_cleanup = zlib_recv_cleanup,
0727d3
     .recv_pages = zlib_recv_pages
0727d3
diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c
0727d3
index 4e60cdbc54..25e1f517b5 100644
0727d3
--- a/migration/multifd-zstd.c
0727d3
+++ b/migration/multifd-zstd.c
0727d3
@@ -165,22 +165,6 @@ static int zstd_send_prepare(MultiFDSendParams *p, Error **errp)
0727d3
     return 0;
0727d3
 }
0727d3
 
0727d3
-/**
0727d3
- * zstd_send_write: do the actual write of the data
0727d3
- *
0727d3
- * Do the actual write of the comprresed buffer.
0727d3
- *
0727d3
- * Returns 0 for success or -1 for error
0727d3
- *
0727d3
- * @p: Params for the channel that we are using
0727d3
- * @used: number of pages used
0727d3
- * @errp: pointer to an error
0727d3
- */
0727d3
-static int zstd_send_write(MultiFDSendParams *p, uint32_t used, Error **errp)
0727d3
-{
0727d3
-    return qio_channel_writev_all(p->c, p->iov, p->iovs_num, errp);
0727d3
-}
0727d3
-
0727d3
 /**
0727d3
  * zstd_recv_setup: setup receive side
0727d3
  *
0727d3
@@ -325,7 +309,6 @@ static MultiFDMethods multifd_zstd_ops = {
0727d3
     .send_setup = zstd_send_setup,
0727d3
     .send_cleanup = zstd_send_cleanup,
0727d3
     .send_prepare = zstd_send_prepare,
0727d3
-    .send_write = zstd_send_write,
0727d3
     .recv_setup = zstd_recv_setup,
0727d3
     .recv_cleanup = zstd_recv_cleanup,
0727d3
     .recv_pages = zstd_recv_pages
0727d3
diff --git a/migration/multifd.c b/migration/multifd.c
0727d3
index 5004f394aa..1e1551d78b 100644
0727d3
--- a/migration/multifd.c
0727d3
+++ b/migration/multifd.c
0727d3
@@ -100,22 +100,6 @@ static int nocomp_send_prepare(MultiFDSendParams *p, Error **errp)
0727d3
     return 0;
0727d3
 }
0727d3
 
0727d3
-/**
0727d3
- * nocomp_send_write: do the actual write of the data
0727d3
- *
0727d3
- * For no compression we just have to write the data.
0727d3
- *
0727d3
- * Returns 0 for success or -1 for error
0727d3
- *
0727d3
- * @p: Params for the channel that we are using
0727d3
- * @used: number of pages used
0727d3
- * @errp: pointer to an error
0727d3
- */
0727d3
-static int nocomp_send_write(MultiFDSendParams *p, uint32_t used, Error **errp)
0727d3
-{
0727d3
-    return qio_channel_writev_all(p->c, p->iov, p->iovs_num, errp);
0727d3
-}
0727d3
-
0727d3
 /**
0727d3
  * nocomp_recv_setup: setup receive side
0727d3
  *
0727d3
@@ -173,7 +157,6 @@ static MultiFDMethods multifd_nocomp_ops = {
0727d3
     .send_setup = nocomp_send_setup,
0727d3
     .send_cleanup = nocomp_send_cleanup,
0727d3
     .send_prepare = nocomp_send_prepare,
0727d3
-    .send_write = nocomp_send_write,
0727d3
     .recv_setup = nocomp_recv_setup,
0727d3
     .recv_cleanup = nocomp_recv_cleanup,
0727d3
     .recv_pages = nocomp_recv_pages
0727d3
@@ -687,7 +670,8 @@ static void *multifd_send_thread(void *opaque)
0727d3
             }
0727d3
 
0727d3
             if (used) {
0727d3
-                ret = multifd_send_state->ops->send_write(p, used, &local_err);
0727d3
+                ret = qio_channel_writev_all(p->c, p->iov, p->iovs_num,
0727d3
+                                             &local_err);
0727d3
                 if (ret != 0) {
0727d3
                     break;
0727d3
                 }
0727d3
diff --git a/migration/multifd.h b/migration/multifd.h
0727d3
index c3f18af364..7496f951a7 100644
0727d3
--- a/migration/multifd.h
0727d3
+++ b/migration/multifd.h
0727d3
@@ -164,8 +164,6 @@ typedef struct {
0727d3
     void (*send_cleanup)(MultiFDSendParams *p, Error **errp);
0727d3
     /* Prepare the send packet */
0727d3
     int (*send_prepare)(MultiFDSendParams *p, Error **errp);
0727d3
-    /* Write the send packet */
0727d3
-    int (*send_write)(MultiFDSendParams *p, uint32_t used, Error **errp);
0727d3
     /* Setup for receiving side */
0727d3
     int (*recv_setup)(MultiFDRecvParams *p, Error **errp);
0727d3
     /* Cleanup for receiving side */
0727d3
-- 
0727d3
2.35.3
0727d3