diff options
author | Markus Armbruster <armbru@redhat.com> | 2023-09-28 15:20:07 +0200 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2023-10-11 11:17:04 +0200 |
commit | 446e559c433184b797bf3f3e1b4366c908a4fb6d (patch) | |
tree | bded027c9e58d1c66c4f7898770e355437ec1c08 | |
parent | 557c34ca60d863047320a178ebcd06ba8d30c057 (diff) |
migration/rdma: Convert qemu_rdma_write() to Error
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>
Reviewed-by: Li Zhijian <lizhijian@fujitsu.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20230928132019.2544702-42-armbru@redhat.com>
-rw-r--r-- | migration/rdma.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/migration/rdma.c b/migration/rdma.c index 369d30c895..9f45f6a91d 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -2359,9 +2359,8 @@ static inline bool qemu_rdma_buffer_mergeable(RDMAContext *rdma, */ static int qemu_rdma_write(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; @@ -2369,9 +2368,8 @@ static int qemu_rdma_write(RDMAContext *rdma, /* If we cannot merge it, we flush the current buffer first. */ if (!qemu_rdma_buffer_mergeable(rdma, current_addr, len)) { - ret = qemu_rdma_write_flush(rdma, &err); + ret = qemu_rdma_write_flush(rdma, errp); if (ret < 0) { - error_report_err(err); return -1; } rdma->current_length = 0; @@ -2388,10 +2386,7 @@ static int qemu_rdma_write(RDMAContext *rdma, /* flush it if buffer is too large */ if (rdma->current_length >= RDMA_MERGE_MAX) { - if (qemu_rdma_write_flush(rdma, &err) < 0) { - error_report_err(err); - return -1; - } + return qemu_rdma_write_flush(rdma, errp); } return 0; @@ -3290,6 +3285,7 @@ static int qemu_rdma_save_page(QEMUFile *f, ram_addr_t block_offset, ram_addr_t offset, size_t size) { QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); + Error *err = NULL; RDMAContext *rdma; int ret; @@ -3315,9 +3311,9 @@ static int qemu_rdma_save_page(QEMUFile *f, ram_addr_t block_offset, * 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(rdma, block_offset, offset, size); + ret = qemu_rdma_write(rdma, block_offset, offset, size, &err); if (ret < 0) { - error_report("rdma migration: write error"); + error_report_err(err); goto err; } |