From 85f49cad879adfb5c3cbdc47ca3c3b50eb8f40bc Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Tue, 6 May 2014 21:08:43 +0800 Subject: qemu-img: Convert by cluster size if target is compressed If target block driver forces compression, qemu-img convert needs to write by cluster size as well as "-c" option. Particularly, this applies for converting to VMDK streamOptimized format. Signed-off-by: Fam Zheng Signed-off-by: Stefan Hajnoczi --- include/block/block.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/block/block.h b/include/block/block.h index 467fb2b..27d8598 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -34,6 +34,10 @@ typedef struct BlockDriverInfo { * opened with BDRV_O_UNMAP flag for this to work. */ bool can_write_zeroes_with_unmap; + /* + * True if this block driver only supports compressed writes + */ + bool needs_compressed_writes; } BlockDriverInfo; typedef struct BlockFragInfo { -- cgit v1.1 From b1e6fc0817dca14a3581d7b0979a5885608981f2 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Tue, 6 May 2014 12:11:42 +0200 Subject: block: Fix open flags with BDRV_O_SNAPSHOT The immediately visible effect of this patch is that it fixes committing a temporary snapshot to its backing file. Previously, it would fail with a "permission denied" error because bdrv_inherited_flags() forced the backing file to be read-only, ignoring the r/w reopen of bdrv_commit(). The bigger problem this revealed is that the original open flags must actually only be applied to the temporary snapshot, and the original image file must be treated as a backing file of the temporary snapshot and get the right flags for that. Reported-by: Jan Kiszka Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Signed-off-by: Stefan Hajnoczi --- include/block/block.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/block/block.h b/include/block/block.h index 27d8598..1b119aa 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -195,7 +195,7 @@ int bdrv_open_image(BlockDriverState **pbs, const char *filename, QDict *options, const char *bdref_key, int flags, bool allow_none, Error **errp); int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp); -void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp); +void bdrv_append_temp_snapshot(BlockDriverState *bs, int flags, Error **errp); int bdrv_open(BlockDriverState **pbs, const char *filename, const char *reference, QDict *options, int flags, BlockDriver *drv, Error **errp); -- cgit v1.1 From 5a007547df76446ab891df93ebc55749716609bf Mon Sep 17 00:00:00 2001 From: Sangho Park Date: Thu, 8 May 2014 12:47:10 +0400 Subject: glib: fix g_poll early timeout on windows g_poll has a problem on Windows when using timeouts < 10ms, in glib/gpoll.c: /* If not, and we have a significant timeout, poll again with * timeout then. Note that this will return indication for only * one event, or only for messages. We ignore timeouts less than * ten milliseconds as they are mostly pointless on Windows, the * MsgWaitForMultipleObjectsEx() call will timeout right away * anyway. */ if (retval == 0 && (timeout == INFINITE || timeout >= 10)) retval = poll_rest (poll_msgs, handles, nhandles, fds, nfds, timeout); so whenever g_poll is called with timeout < 10ms it does a quick poll instead of wait, this causes significant performance degradation of QEMU, thus we should use WaitForMultipleObjectsEx directly Signed-off-by: Stanislav Vorobiov Signed-off-by: Stefan Hajnoczi --- include/glib-compat.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/glib-compat.h b/include/glib-compat.h index 8d25900..1280fb2 100644 --- a/include/glib-compat.h +++ b/include/glib-compat.h @@ -24,7 +24,14 @@ static inline guint g_timeout_add_seconds(guint interval, GSourceFunc function, } #endif -#if !GLIB_CHECK_VERSION(2, 20, 0) +#ifdef _WIN32 +/* + * g_poll has a problem on Windows when using + * timeouts < 10ms, so use wrapper. + */ +#define g_poll(fds, nfds, timeout) g_poll_fixed(fds, nfds, timeout) +gint g_poll_fixed(GPollFD *fds, guint nfds, gint timeout); +#elif !GLIB_CHECK_VERSION(2, 20, 0) /* * Glib before 2.20.0 doesn't implement g_poll, so wrap it to compile properly * on older systems. -- cgit v1.1