Paolo Bonzini <pbonz...@redhat.com> wrote: > Rate limiting is now simply a byte counter; client call > qemu_file_rate_limit() manually to determine if they have to exit. > So it is possible and simple to move the functionality to QEMUFile. > > This makes the remaining functionality of s->file redundant; > in the next patch we can remove it and write directly to s->migration_file. > > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
Reviewed-by: Juan Quintela <quint...@redhat.com> Nice!!! > qemu_put_buffer(s->migration_file, buf, size); > - if (qemu_file_get_error(s->migration_file)) { > - return qemu_file_get_error(s->migration_file); > - } > - > - s->bytes_xfer += size; > - return size; > + return qemu_file_get_error(s->migration_file); > } You fix here the problem that I pointed in a previous patch, so feel free not to fix it in the previous one. If anyone reading this, just thinking aloud, this function is called as if (f->is_write && f->buf_index > 0) { ret = f->ops->put_buffer(f->opaque, f->buf, f->buf_offset, f->buf_index); if (ret >= 0) { f->buf_offset += f->buf_index; } f->buf_index = 0; So the change from "size" to "0" on the non-error case don't matter.