From c6a99f54a3ebbfef97f70027c5bd129d5c5db4ae Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 24 Jan 2013 11:53:27 +0100 Subject: [PATCH] improve backup patches --- ...-add-backup-related-monitor-commands.patch | 6 ++-- ...004-introduce-new-vma-archive-format.patch | 34 ++++++++++--------- ...0005-add-regression-tests-for-backup.patch | 2 +- .../0006-add-vm-state-to-backups.patch | 4 +-- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/debian/patches/0003-add-backup-related-monitor-commands.patch b/debian/patches/0003-add-backup-related-monitor-commands.patch index 41f3918..0a17a01 100644 --- a/debian/patches/0003-add-backup-related-monitor-commands.patch +++ b/debian/patches/0003-add-backup-related-monitor-commands.patch @@ -1,4 +1,4 @@ -From cd593564217e6ae808cc8555845b14eabac95bd0 Mon Sep 17 00:00:00 2001 +From 2c23d119338c45005ebe37b55e54e75a71e5bafd Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 13 Nov 2012 11:27:56 +0100 Subject: [PATCH v3 3/6] add backup related monitor commands @@ -44,7 +44,7 @@ index a5f85e6..c9c20c9 100644 + #endif /* QEMU_BACKUP_H */ diff --git a/blockdev.c b/blockdev.c -index e73fd6e..ba28654 100644 +index e73fd6e..30f63bd 100644 --- a/blockdev.c +++ b/blockdev.c @@ -20,6 +20,7 @@ @@ -175,7 +175,7 @@ index e73fd6e..ba28654 100644 + if (job) { + job_count++; + if (!bcb->completed) { -+ block_job_cancel(job); ++ block_job_cancel_sync(job); + /* make sure we call the complete callback */ + if (!job->co) { + block_job_completed(job, -1); diff --git a/debian/patches/0004-introduce-new-vma-archive-format.patch b/debian/patches/0004-introduce-new-vma-archive-format.patch index 3210080..4952162 100644 --- a/debian/patches/0004-introduce-new-vma-archive-format.patch +++ b/debian/patches/0004-introduce-new-vma-archive-format.patch @@ -1,4 +1,4 @@ -From 2b6ca0c6087ed51bc8318731713bb3aa83f606db Mon Sep 17 00:00:00 2001 +From 7592ded4c7222255085ac7cad534a9e592931f30 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 13 Nov 2012 11:11:38 +0100 Subject: [PATCH v3 4/6] introduce new vma archive format @@ -12,10 +12,10 @@ Signed-off-by: Dietmar Maurer blockdev.c | 6 +- docs/specs/vma_spec.txt | 24 ++ vma-reader.c | 801 ++++++++++++++++++++++++++++++++++++++++ - vma-writer.c | 933 +++++++++++++++++++++++++++++++++++++++++++++++ + vma-writer.c | 935 +++++++++++++++++++++++++++++++++++++++++++++++ vma.c | 561 ++++++++++++++++++++++++++++ vma.h | 145 ++++++++ - 8 files changed, 2471 insertions(+), 4 deletions(-) + 8 files changed, 2473 insertions(+), 4 deletions(-) create mode 100644 docs/specs/vma_spec.txt create mode 100644 vma-reader.c create mode 100644 vma-writer.c @@ -57,7 +57,7 @@ index cb46be5..b5732e2 100644 block-obj-$(CONFIG_POSIX) += event_notifier-posix.o aio-posix.o block-obj-$(CONFIG_WIN32) += event_notifier-win32.o aio-win32.o diff --git a/blockdev.c b/blockdev.c -index ba28654..a030a13 100644 +index 30f63bd..5ffd246 100644 --- a/blockdev.c +++ b/blockdev.c @@ -21,6 +21,7 @@ @@ -921,10 +921,10 @@ index 0000000..2217a94 + diff --git a/vma-writer.c b/vma-writer.c new file mode 100644 -index 0000000..08c4ee3 +index 0000000..6ecbaf4 --- /dev/null +++ b/vma-writer.c -@@ -0,0 +1,933 @@ +@@ -0,0 +1,935 @@ +/* + * VMA: Virtual Machine Archive + * @@ -1144,8 +1144,6 @@ index 0000000..08c4ee3 +{ + VmaWriter *vmaw = opaque; + -+ qemu_aio_set_fd_handler(vmaw->fd, NULL, NULL, NULL, NULL); -+ + DPRINTF("vma_co_continue_write\n"); + qemu_coroutine_enter(vmaw->co_writer, NULL); +} @@ -1170,21 +1168,23 @@ index 0000000..08c4ee3 + + assert(vmaw->co_writer == NULL); + ++ vmaw->co_writer = qemu_coroutine_self(); ++ ++ qemu_aio_set_fd_handler(vmaw->fd, NULL, vma_co_continue_write, ++ vma_co_write_finished, vmaw); ++ ++ DPRINTF("vma_co_write wait until writable\n"); ++ qemu_coroutine_yield(); ++ DPRINTF("vma_co_write starting %zd\n", bytes); ++ + while (done < bytes) { -+ /* Note: we limit maximal write size - else VM gets slow */ -+ ret = write(vmaw->fd, buf + done, -+ (bytes - done) > 4096 ? 4096 : bytes - done); ++ ret = write(vmaw->fd, buf + done, bytes - done); + if (ret > 0) { + done += ret; + DPRINTF("vma_co_write written %zd %zd\n", done, ret); + } else if (ret < 0) { + if (errno == EAGAIN || errno == EWOULDBLOCK) { + DPRINTF("vma_co_write yield %zd\n", done); -+ -+ vmaw->co_writer = qemu_coroutine_self(); -+ qemu_aio_set_fd_handler(vmaw->fd, NULL, vma_co_continue_write, -+ vma_co_write_finished, vmaw); -+ + qemu_coroutine_yield(); + DPRINTF("vma_co_write restart %zd\n", done); + } else { @@ -1198,6 +1198,8 @@ index 0000000..08c4ee3 + } + } + ++ qemu_aio_set_fd_handler(vmaw->fd, NULL, NULL, NULL, NULL); ++ + vmaw->co_writer = NULL; + + qemu_co_mutex_unlock(&vmaw->writer_lock); diff --git a/debian/patches/0005-add-regression-tests-for-backup.patch b/debian/patches/0005-add-regression-tests-for-backup.patch index e4c9de1..9fe68f9 100644 --- a/debian/patches/0005-add-regression-tests-for-backup.patch +++ b/debian/patches/0005-add-regression-tests-for-backup.patch @@ -1,4 +1,4 @@ -From 43cf41bbbb32384d4a51e37868be363a11eda35b Mon Sep 17 00:00:00 2001 +From e550dd634d38dda15d8663a5d97883c9145b95fd Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 14 Nov 2012 09:57:04 +0100 Subject: [PATCH v3 5/6] add regression tests for backup diff --git a/debian/patches/0006-add-vm-state-to-backups.patch b/debian/patches/0006-add-vm-state-to-backups.patch index 7bdc9f6..94fd723 100644 --- a/debian/patches/0006-add-vm-state-to-backups.patch +++ b/debian/patches/0006-add-vm-state-to-backups.patch @@ -1,4 +1,4 @@ -From 6f87d124089c383af873d9774d3b47597dc7d5e9 Mon Sep 17 00:00:00 2001 +From 66ecb72361ea3e2e1243ee87527919621c85f4ff Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 29 Nov 2012 10:46:49 +0100 Subject: [PATCH v3 6/6] add vm state to backups @@ -12,7 +12,7 @@ Signed-off-by: Dietmar Maurer 3 files changed, 200 insertions(+), 5 deletions(-) diff --git a/blockdev.c b/blockdev.c -index a030a13..d5878c5 100644 +index 5ffd246..6bddbd3 100644 --- a/blockdev.c +++ b/blockdev.c @@ -22,6 +22,8 @@ -- 2.39.2