[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/42] migration: use qemu_file_set_error
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 10/42] migration: use qemu_file_set_error |
Date: |
Fri, 22 Feb 2013 17:36:16 +0100 |
Remove the return value of buffered_flush, pass it via the error code
of s->file. Once this is done, the error can be retrieved simply
via migrate_fd_close's call to qemu_fclose.
Reviewed-by: Orit Wasserman <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
migration.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/migration.c b/migration.c
index c5a7f29..939c3f7 100644
--- a/migration.c
+++ b/migration.c
@@ -518,7 +518,7 @@ int64_t migrate_xbzrle_cache_size(void)
/* migration thread support */
-static ssize_t buffered_flush(MigrationState *s)
+static void buffered_flush(MigrationState *s)
{
size_t offset = 0;
ssize_t ret = 0;
@@ -545,9 +545,8 @@ static ssize_t buffered_flush(MigrationState *s)
s->buffer_size -= offset;
if (ret < 0) {
- return ret;
+ qemu_file_set_error(s->file, ret);
}
- return offset;
}
static int buffered_put_buffer(void *opaque, const uint8_t *buf,
@@ -586,25 +585,15 @@ static int buffered_put_buffer(void *opaque, const
uint8_t *buf,
static int buffered_close(void *opaque)
{
MigrationState *s = opaque;
- ssize_t ret = 0;
- int ret2;
DPRINTF("closing\n");
s->xfer_limit = INT_MAX;
while (!qemu_file_get_error(s->file) && s->buffer_size) {
- ret = buffered_flush(s);
- if (ret < 0) {
- break;
- }
- }
-
- ret2 = migrate_fd_close(s);
- if (ret >= 0) {
- ret = ret2;
+ buffered_flush(s);
}
s->complete = true;
- return ret;
+ return migrate_fd_close(s);
}
static int buffered_get_fd(void *opaque)
@@ -750,7 +739,8 @@ static void *buffered_file_thread(void *opaque)
g_usleep((initial_time + BUFFER_DELAY - current_time)*1000);
sleep_time += qemu_get_clock_ms(rt_clock) - current_time;
}
- ret = buffered_flush(s);
+ buffered_flush(s);
+ ret = qemu_file_get_error(s->file);
}
if (ret < 0) {
--
1.8.1.2
- [Qemu-devel] [PATCH 17/42] block-migration: small preparatory changes for locking, (continued)
- [Qemu-devel] [PATCH 17/42] block-migration: small preparatory changes for locking, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 37/42] migration: use qemu_ftell to compute bandwidth, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 35/42] migration: use QEMUFile for migration channel lifetime, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 07/42] migration: use qemu_file_set_error to pass error codes back to qemu_savevm_state, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 29/42] migration: use qemu_file_rate_limit consistently, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 33/42] qemu-file: add writable socket QEMUFile, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 30/42] migration: merge qemu_popen_cmd with qemu_popen, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 19/42] block-migration: add lock, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 36/42] migration: use QEMUFile for writing outgoing migration data, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 32/42] qemu-file: check exit status when closing a pipe QEMUFile, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 10/42] migration: use qemu_file_set_error,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 38/42] migration: small changes around rate-limiting, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 34/42] qemu-file: simplify and export qemu_ftell, Paolo Bonzini, 2013/02/22