[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 14/16] qemu-file: remove shutdown member
From: |
Juan Quintela |
Subject: |
[PULL 14/16] qemu-file: remove shutdown member |
Date: |
Fri, 5 May 2023 02:48:10 +0200 |
The first thing that we do after setting the shutdown value is set the
error as -EIO if there is not a previous error.
So this value is redundant. Just remove it and use
qemu_file_get_error() in the places that it was tested.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20230504113841.23130-7-quintela@redhat.com>
---
migration/qemu-file.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index a4ea808b15..11b510aa29 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -63,8 +63,6 @@ struct QEMUFile {
int last_error;
Error *last_error_obj;
- /* has the file has been shutdown */
- bool shutdown;
};
/*
@@ -78,8 +76,6 @@ int qemu_file_shutdown(QEMUFile *f)
{
int ret = 0;
- f->shutdown = true;
-
/*
* We must set qemufile error before the real shutdown(), otherwise
* there can be a race window where we thought IO all went though
@@ -294,7 +290,7 @@ void qemu_fflush(QEMUFile *f)
return;
}
- if (f->shutdown) {
+ if (qemu_file_get_error(f)) {
return;
}
if (f->iovcnt > 0) {
@@ -397,7 +393,7 @@ static ssize_t coroutine_mixed_fn qemu_fill_buffer(QEMUFile
*f)
f->buf_index = 0;
f->buf_size = pending;
- if (f->shutdown) {
+ if (qemu_file_get_error(f)) {
return 0;
}
@@ -486,7 +482,7 @@ static int add_to_iovec(QEMUFile *f, const uint8_t *buf,
size_t size,
} else {
if (f->iovcnt >= MAX_IOV_SIZE) {
/* Should only happen if a previous fflush failed */
- assert(f->shutdown || !qemu_file_is_writable(f));
+ assert(qemu_file_get_error(f) || !qemu_file_is_writable(f));
return 1;
}
if (may_free) {
--
2.40.0
- [PULL 05/16] migration: Rename xbzrle_enabled xbzrle_started, (continued)
- [PULL 05/16] migration: Rename xbzrle_enabled xbzrle_started, Juan Quintela, 2023/05/04
- [PULL 04/16] migration: Put zero_pages in alphabetical order, Juan Quintela, 2023/05/04
- [PULL 06/16] migration: Make RAM_SAVE_FLAG_HOOK a normal case entry, Juan Quintela, 2023/05/04
- [PULL 07/16] migration/rdma: simplify ram_control_load_hook(), Juan Quintela, 2023/05/04
- [PULL 08/16] migration/rdma: We can calculate the rioc from the QEMUFile, Juan Quintela, 2023/05/04
- [PULL 09/16] migration/rdma: It makes no sense to recive that flag without RDMA, Juan Quintela, 2023/05/04
- [PULL 10/16] migration/rdma: Check for postcopy sooner, Juan Quintela, 2023/05/04
- [PULL 13/16] qemu-file: No need to check for shutdown in qemu_file_rate_limit, Juan Quintela, 2023/05/04
- [PULL 12/16] migration: qemu_file_total_transferred() function is monotonic, Juan Quintela, 2023/05/04
- [PULL 11/16] migration: max_postcopy_bandwidth is a size parameter, Juan Quintela, 2023/05/04
- [PULL 14/16] qemu-file: remove shutdown member,
Juan Quintela <=
- [PULL 15/16] qemu-file: Make total_transferred an uint64_t, Juan Quintela, 2023/05/04
- [PULL 16/16] qemu-file: Make ram_control_save_page() use accessors for rate_limit, Juan Quintela, 2023/05/04
- Re: [PULL 00/16] Migration 20230505 patches, Richard Henderson, 2023/05/05