From 1748253be11cbf12961274d4586671ce3803b006 Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Wed, 4 Sep 2019 11:23:30 +0100 Subject: [PATCH 2/6] migration: add qemu_file_update_transfer interface RH-Author: Juan Quintela Message-id: <20190904112332.16160-3-quintela@redhat.com> Patchwork-id: 90281 O-Subject: [RHEL-AV-8.1 qemu-kvm PATCH v2 2/4] migration: add qemu_file_update_transfer interface Bugzilla: 1734316 RH-Acked-by: Dr. David Alan Gilbert RH-Acked-by: Peter Xu RH-Acked-by: Danilo de Paula From: Ivan Ren Add qemu_file_update_transfer for just update bytes_xfer for speed limitation. This will be used for further migration feature such as multifd migration. Signed-off-by: Ivan Ren Reviewed-by: Wei Yang Reviewed-by: Juan Quintela Message-Id: <1564464816-21804-2-git-send-email-ivanren@tencent.com> Signed-off-by: Dr. David Alan Gilbert (cherry picked from commit 5d7d2558631b4421826c60046c606584c58ab76c) Signed-off-by: Danilo C. L. de Paula --- migration/qemu-file.c | 5 +++++ migration/qemu-file.h | 1 + 2 files changed, 6 insertions(+) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 0431585..18f4805 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -615,6 +615,11 @@ void qemu_file_reset_rate_limit(QEMUFile *f) f->bytes_xfer = 0; } +void qemu_file_update_transfer(QEMUFile *f, int64_t len) +{ + f->bytes_xfer += len; +} + void qemu_put_be16(QEMUFile *f, unsigned int v) { qemu_put_byte(f, v >> 8); diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 13baf89..5de9fa2 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -147,6 +147,7 @@ int qemu_peek_byte(QEMUFile *f, int offset); void qemu_file_skip(QEMUFile *f, int size); void qemu_update_position(QEMUFile *f, size_t size); void qemu_file_reset_rate_limit(QEMUFile *f); +void qemu_file_update_transfer(QEMUFile *f, int64_t len); void qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate); int64_t qemu_file_get_rate_limit(QEMUFile *f); void qemu_file_set_error(QEMUFile *f, int ret); -- 1.8.3.1