[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 40/52] migration/rdma: Convert qemu_rdma_write() to Error
From: |
Markus Armbruster |
Subject: |
[PATCH 40/52] migration/rdma: Convert qemu_rdma_write() to Error |
Date: |
Mon, 18 Sep 2023 16:41:54 +0200 |
Just for consistency with qemu_rdma_write_one() and
qemu_rdma_write_flush(), and for slightly simpler code.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
migration/rdma.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/migration/rdma.c b/migration/rdma.c
index 9b8cbadfcd..5bb78a6ad8 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -2320,9 +2320,8 @@ static inline bool qemu_rdma_buffer_mergable(RDMAContext
*rdma,
*/
static int qemu_rdma_write(QEMUFile *f, RDMAContext *rdma,
uint64_t block_offset, uint64_t offset,
- uint64_t len)
+ uint64_t len, Error **errp)
{
- Error *err = NULL;
uint64_t current_addr = block_offset + offset;
uint64_t index = rdma->current_index;
uint64_t chunk = rdma->current_chunk;
@@ -2330,9 +2329,8 @@ static int qemu_rdma_write(QEMUFile *f, RDMAContext *rdma,
/* If we cannot merge it, we flush the current buffer first. */
if (!qemu_rdma_buffer_mergable(rdma, current_addr, len)) {
- ret = qemu_rdma_write_flush(f, rdma, &err);
+ ret = qemu_rdma_write_flush(f, rdma, errp);
if (ret < 0) {
- error_report_err(err);
return -1;
}
rdma->current_length = 0;
@@ -2349,10 +2347,7 @@ static int qemu_rdma_write(QEMUFile *f, RDMAContext
*rdma,
/* flush it if buffer is too large */
if (rdma->current_length >= RDMA_MERGE_MAX) {
- if (qemu_rdma_write_flush(f, rdma, &err) < 0) {
- error_report_err(err);
- return -1;
- }
+ return qemu_rdma_write_flush(f, rdma, errp);
}
return 0;
@@ -3248,6 +3243,7 @@ static size_t qemu_rdma_save_page(QEMUFile *f,
size_t size, uint64_t *bytes_sent)
{
QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(qemu_file_get_ioc(f));
+ Error *err = NULL;
RDMAContext *rdma;
int ret;
@@ -3273,9 +3269,9 @@ static size_t qemu_rdma_save_page(QEMUFile *f,
* is full, or the page doesn't belong to the current chunk,
* an actual RDMA write will occur and a new chunk will be formed.
*/
- ret = qemu_rdma_write(f, rdma, block_offset, offset, size);
+ ret = qemu_rdma_write(f, rdma, block_offset, offset, size, &err);
if (ret < 0) {
- error_report("rdma migration: write error");
+ error_report_err(err);
goto err;
}
--
2.41.0
- Re: [PATCH 30/52] migration/rdma: Delete inappropriate error_report() in macro ERROR(), (continued)
- [PATCH 14/52] migration/rdma: Use bool for two RDMAContext flags, Markus Armbruster, 2023/09/18
- [PATCH 09/52] migration/rdma: Put @errp parameter last, Markus Armbruster, 2023/09/18
- [PATCH 03/52] migration/rdma: Clean up rdma_delete_block()'s return type, Markus Armbruster, 2023/09/18
- [PATCH 40/52] migration/rdma: Convert qemu_rdma_write() to Error,
Markus Armbruster <=
- [PATCH 28/52] migration/rdma: Check negative error values the same way everywhere, Markus Armbruster, 2023/09/18
- [PATCH 37/52] migration/rdma: Convert qemu_rdma_reg_whole_ram_blocks() to Error, Markus Armbruster, 2023/09/18
- [PATCH 07/52] migration/rdma: Give qio_channel_rdma_source_funcs internal linkage, Markus Armbruster, 2023/09/18
- [PATCH 47/52] migration/rdma: Don't report received completion events as error, Markus Armbruster, 2023/09/18