From 972214001120e4cf2f4ac35b6ccbd1777b11e060 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Thu, 22 Jan 2015 15:01:38 +0100 Subject: qemu-file: Add fast ftell code path For ftell we flush the output buffer to ensure that we don't have anything lingering in our internal buffers. This is a very safe thing to do. However, with the dynamic size measurement that the dynamic vmstate description will bring this would turn out quite slow. Instead, we can fast path this specific measurement and just take the internal buffers into account when telling the kernel our position. I'm sure I overlooked some corner cases where this doesn't work, so instead of tuning the safe, existing version, this patch adds a fast variant of ftell that gets used by the dynamic vmstate description code which isn't critical when it fails. Signed-off-by: Alexander Graf Reviewed-by: Eric Blake Signed-off-by: Amit Shah Signed-off-by: Juan Quintela --- include/migration/qemu-file.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h index d843c0010c..a923cec2a6 100644 --- a/include/migration/qemu-file.h +++ b/include/migration/qemu-file.h @@ -121,6 +121,7 @@ QEMUFile *qemu_bufopen(const char *mode, QEMUSizedBuffer *input); int qemu_get_fd(QEMUFile *f); int qemu_fclose(QEMUFile *f); int64_t qemu_ftell(QEMUFile *f); +int64_t qemu_ftell_fast(QEMUFile *f); void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size); void qemu_put_byte(QEMUFile *f, int v); /* -- cgit v1.2.3