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