Block layer patches
Subsystems (2)
The following changes since commit 33e1666b4289313306371fee0740f5c85517e406:
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2016-09-19' into staging (2016-09-19 18:06:52 +0100)
are available in the git repository at:
git://github.com/XanClic/qemu.git tags/pull-block-2016-09-19
for you to fetch changes up to 203bfabbcc0d681ebb4a8f0a0d08b077d4e53eae:
iotest 055: refactor and speed up (2016-09-19 23:13:40 +0200)
----------------------------------------------------------------
Block patches for 2.8
----------------------------------------------------------------
Alberto Garcia (1):
commit: get the overlay node before manipulating the backing chain
Colin Lord (2):
blockdev: prepare iSCSI block driver for dynamic loading
blockdev: Modularize nfs block driver
Marc Mari (2):
blockdev: Add dynamic generation of module_block.h
blockdev: Add dynamic module loading for block drivers
Reda Sallahi (2):
qemu-img: add the 'dd' subcommand
qemu-img: add skip option to dd
Vladimir Sementsov-Ogievskiy (1):
iotest 055: refactor and speed up
Makefile | 10 +- block.c | 62 ++++++- block/Makefile.objs | 4 +- block/commit.c | 3 +- block/iscsi.c | 36 ---- configure | 4 +- include/qemu/module.h | 3 + qemu-img-cmds.hx | 6 + qemu-img.c | 343 ++++++++++++++++++++++++++++++++++++++- qemu-img.texi | 27 +++ scripts/modules/module_block.py | 108 ++++++++++++ tests/qemu-iotests/055 | 52 ++---- tests/qemu-iotests/159 | 70 ++++++++ tests/qemu-iotests/159.out | 87 ++++++++++ tests/qemu-iotests/160 | 72 ++++++++ tests/qemu-iotests/160.out | 51 ++++++ tests/qemu-iotests/170 | 67 ++++++++ tests/qemu-iotests/170.out | 15 ++ tests/qemu-iotests/common.filter | 9 + tests/qemu-iotests/common.rc | 5 +- tests/qemu-iotests/group | 3 + util/module.c | 38 ++--- vl.c | 40 +++++ 23 files changed, 997 insertions(+), 118 deletions(-) create mode 100644 scripts/modules/module_block.py create mode 100755 tests/qemu-iotests/159 create mode 100644 tests/qemu-iotests/159.out create mode 100755 tests/qemu-iotests/160 create mode 100644 tests/qemu-iotests/160.out create mode 100755 tests/qemu-iotests/170 create mode 100644 tests/qemu-iotests/170.out
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v3 2/8] qemu-img: add skip option to dd
From: Reda Sallahi <[email protected]>
This adds the skip option which allows qemu-img dd to skip a number of blocks before copying the input.
A test case was added to test the skip option.
Message-id: [email protected]
--- qemu-img-cmds.hx | 4 +-- qemu-img.c | 50 ++++++++++++++++++++++++++++---- qemu-img.texi | 4 ++- tests/qemu-iotests/160 | 72 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/160.out | 51 ++++++++++++++++++++++++++++++++ tests/qemu-iotests/group | 1 + 6 files changed, 174 insertions(+), 8 deletions(-) create mode 100755 tests/qemu-iotests/160 create mode 100644 tests/qemu-iotests/160.out
qemu-img-cmds.hx +2 -2
@@ -46,9 +46,9 @@ STEXI ETEXI DEF("dd", img_dd, - "dd [--image-opts] [-f fmt] [-O output_fmt] [bs=block_size] [count=blocks] if=input of=output") + "dd [--image-opts] [-f fmt] [-O output_fmt] [bs=block_size] [count=blocks] [skip=blocks] if=input of=output") STEXI -@item dd [--image-opts] [-f @var{fmt}] [-O @var{output_fmt}] [bs=@var{block_size}] [count=@var{blocks}] if=@var{input} of=@var{output} +@item dd [--image-opts] [-f @var{fmt}] [-O @var{output_fmt}] [bs=@var{block_size}] [count=@var{blocks}] [skip=@var{blocks}] if=@var{input} of=@var{output} ETEXI DEF("info", img_info,
qemu-img.c +45 -5
104 lines not on this page · raw message
qemu-img.texi +3 -1
@@ -151,6 +151,8 @@ sets the number of input blocks to copy sets the input file @item of=@var{output} sets the output file +@item skip=@var{blocks} +sets the number of input blocks to skip @end table Command description:
@@ -324,7 +326,7 @@ skipped. This is useful for formats such as @code{rbd} if the target volume has already been created with site specific options that cannot be supplied through qemu-img. -@item dd [-f @var{fmt}] [-O @var{output_fmt}] [bs=@var{block_size}] [count=@var{blocks}] if=@var{input} of=@var{output} +@item dd [-f @var{fmt}] [-O @var{output_fmt}] [bs=@var{block_size}] [count=@var{blocks}] [skip=@var{blocks}] if=@var{input} of=@var{output} Dd copies from @var{input} file to @var{output} file converting it from @var{fmt} format to @var{output_fmt} format.
tests/qemu-iotests/160 new file +72 -0
72 lines not on this page · raw message
tests/qemu-iotests/160.out new file +51 -0
51 lines not on this page · raw message
tests/qemu-iotests/group +1 -0
@@ -158,5 +158,6 @@ 156 rw auto quick 157 auto 159 rw auto quick +160 rw auto quick 162 auto quick 170 rw auto quick
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v3 3/8] blockdev: prepare iSCSI block driver for dynamic loading
In reply to Max ReitzFrom: Colin Lord <[email protected]>
This commit moves the initialization of the QemuOptsList qemu_iscsi_opts struct out of block/iscsi.c in order to allow the iscsi module to be dynamically loaded.
Message-id: [email protected]
--- block/iscsi.c | 36 ------------------------------------ vl.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 36 deletions(-)
block/iscsi.c +0 -36
@@ -2010,45 +2010,9 @@ static BlockDriver bdrv_iscsi = { .bdrv_attach_aio_context = iscsi_attach_aio_context, }; -static QemuOptsList qemu_iscsi_opts = { - .name ="iscsi" , - .head =QTAILQ_HEAD_INITIALIZER (qemu_iscsi_opts.head), - .desc = { - { - .name ="user" , - .type =QEMU_OPT_STRING , - .help ="username for CHAP authentication to target" , - },{ - .name ="password" , - .type =QEMU_OPT_STRING , - .help ="password for CHAP authentication to target" , - },{ - .name ="password-secret" , - .type =QEMU_OPT_STRING , - .help ="ID of the secret providing password for CHAP " -"authentication to target" , - },{ - .name ="header-digest" , - .type =QEMU_OPT_STRING , - .help ="HeaderDigest setting. " -"{CRC32C|CRC32C-NONE|NONE-CRC32C|NONE}" , - },{ - .name ="initiator-name" , - .type =QEMU_OPT_STRING , - .help ="Initiator iqn name to use when connecting" , - },{ - .name ="timeout" , - .type =QEMU_OPT_NUMBER , - .help ="Request timeout in seconds (default 0 = no timeout)" , - }, - {/* end of list */ } - }, -}; -static void iscsi_block_init (void ) {bdrv_register (&bdrv_iscsi); -qemu_add_opts (&qemu_iscsi_opts); }block_init (iscsi_block_init);
vl.c +40 -0
@@ -507,6 +507,43 @@ static QemuOptsList qemu_fw_cfg_opts = { }, }; +#ifdef CONFIG_LIBISCSI +static QemuOptsList qemu_iscsi_opts = { + .name ="iscsi" , + .head =QTAILQ_HEAD_INITIALIZER (qemu_iscsi_opts.head), + .desc = { + { + .name ="user" , + .type =QEMU_OPT_STRING , + .help ="username for CHAP authentication to target" , + },{ + .name ="password" , + .type =QEMU_OPT_STRING , + .help ="password for CHAP authentication to target" , + },{ + .name ="password-secret" , + .type =QEMU_OPT_STRING , + .help ="ID of the secret providing password for CHAP " +"authentication to target" , + },{ + .name ="header-digest" , + .type =QEMU_OPT_STRING , + .help ="HeaderDigest setting. " +"{CRC32C|CRC32C-NONE|NONE-CRC32C|NONE}" , + },{ + .name ="initiator-name" , + .type =QEMU_OPT_STRING , + .help ="Initiator iqn name to use when connecting" , + },{ + .name ="timeout" , + .type =QEMU_OPT_NUMBER , + .help ="Request timeout in seconds (default 0 = no timeout)" , + }, + {/* end of list */ } + }, +}; +#endif +/** * Get machine options *
@@ -3017,6 +3054,9 @@ int main(int argc, char **argv, char **envp)qemu_add_opts (&qemu_icount_opts);qemu_add_opts (&qemu_semihosting_config_opts);qemu_add_opts (&qemu_fw_cfg_opts); +#ifdef CONFIG_LIBISCSI +qemu_add_opts (&qemu_iscsi_opts); +#endif module_call_init (MODULE_INIT_OPTS );runstate_init ();
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v3 1/8] qemu-img: add the 'dd' subcommand
In reply to Max ReitzFrom: Reda Sallahi <[email protected]>
This patch adds a basic dd subcommand analogous to dd(1) to qemu-img.
For the start, this implements the bs, if, of and count options and requires both if and of to be specified (no stdin/stdout if not specified) and doesn't support tty, pipes, etc.
The image format must be specified with -O for the output if the raw format is not the intended one.
Two tests are added to test qemu-img dd.
Message-id: [email protected]
--- qemu-img-cmds.hx | 6 + qemu-img.c | 303 ++++++++++++++++++++++++++++++++++++++- qemu-img.texi | 25 ++++ tests/qemu-iotests/159 | 70 +++++++++ tests/qemu-iotests/159.out | 87 +++++++++++ tests/qemu-iotests/170 | 67 +++++++++ tests/qemu-iotests/170.out | 15 ++ tests/qemu-iotests/common.filter | 9 ++ tests/qemu-iotests/common.rc | 5 +- tests/qemu-iotests/group | 2 + 10 files changed, 584 insertions(+), 5 deletions(-) create mode 100755 tests/qemu-iotests/159 create mode 100644 tests/qemu-iotests/159.out create mode 100755 tests/qemu-iotests/170 create mode 100644 tests/qemu-iotests/170.out
qemu-img-cmds.hx +6 -0
@@ -45,6 +45,12 @@ STEXI @item convert [--object @var{objectdef}] [--image-opts] [-c] [-p] [-q] [-n] [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_id_or_name}] [-l @var{snapshot_param}] [-S @var{sparse_size}] @var{filename} [@var{filename2} [...]] @var{output_filename} ETEXI +DEF("dd", img_dd, + "dd [--image-opts] [-f fmt] [-O output_fmt] [bs=block_size] [count=blocks] if=input of=output") +STEXI +@item dd [--image-opts] [-f @var{fmt}] [-O @var{output_fmt}] [bs=@var{block_size}] [count=@var{blocks}] if=@var{input} of=@var{output} +ETEXI + DEF("info", img_info, "info [--object objectdef] [--image-opts] [-f fmt] [--output=ofmt] [--backing-chain] filename") STEXI
qemu-img.c +302 -1
315 lines not on this page · raw message
qemu-img.texi +25 -0
@@ -139,6 +139,20 @@ Parameters to convert subcommand: Skip the creation of the target volume @end table +Parameters to dd subcommand: + +@table @option + +@item bs=@var{block_size} +defines the block size +@item count=@var{blocks} +sets the number of input blocks to copy +@item if=@var{input} +sets the input file +@item of=@var{output} +sets the output file +@end table + Command description: @table @option
@@ -310,6 +324,17 @@ skipped. This is useful for formats such as @code{rbd} if the target volume has already been created with site specific options that cannot be supplied through qemu-img. +@item dd [-f @var{fmt}] [-O @var{output_fmt}] [bs=@var{block_size}] [count=@var{blocks}] if=@var{input} of=@var{output} + +Dd copies from @var{input} file to @var{output} file converting it from +@var{fmt} format to @var{output_fmt} format. + +The data is by default read and written using blocks of 512 bytes but can be +modified by specifying @var{block_size}. If count=@var{blocks} is specified +dd will stop reading input after reading @var{blocks} input blocks. + +The size syntax is similar to dd(1)'s size syntax. + @item info [-f @var{fmt}] [--output=@var{ofmt}] [--backing-chain] @var{filename} Give information about the disk image @var{filename}. Use it in
tests/qemu-iotests/159 new file +70 -0
70 lines not on this page · raw message
tests/qemu-iotests/159.out new file +87 -0
87 lines not on this page · raw message
tests/qemu-iotests/170 new file +67 -0
67 lines not on this page · raw message
tests/qemu-iotests/170.out new file +15 -0
@@ -0,0 +1,15 @@ +QA output created by 170 + +== Creating image == +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 +No errors were found on the image. +wrote 1048576/1048576 bytes at offset 0 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +== Converting the image with dd == +No errors were found on the image. + +== Compare the images with qemu-img compare == +Images are identical. + +*** done
tests/qemu-iotests/common.filter +9 -0
@@ -44,6 +44,15 @@ _filter_imgfmt() sed -e "s#$IMGFMT#IMGFMT#g" } +# Replace error message when the format is not supported and delete +# the output lines after the first one +_filter_qemu_img_check() +{ + sed -e '/allocated.*fragmented.*compressed clusters/d' \ + -e 's/qemu-img: This image format does not support checks/No errors were found on the image./' \ + -e '/Image end offset: [0-9]\+/d' +} + # Removes \r from messages _filter_win32() {
tests/qemu-iotests/common.rc +1 -4
@@ -234,10 +234,7 @@ _check_test_img() else $QEMU_IMG check "$@" -f $IMGFMT "$TEST_IMG" 2>&1 fi - ) | _filter_testdir | \ - sed -e '/allocated.*fragmented.*compressed clusters/d' \ - -e 's/qemu-img: This image format does not support checks/No errors were found on the image./' \ - -e '/Image end offset: [0-9]\+/d' + ) | _filter_testdir | _filter_qemu_img_check } _img_info()
tests/qemu-iotests/group +2 -0
@@ -157,4 +157,6 @@ 155 rw auto 156 rw auto quick 157 auto +159 rw auto quick 162 auto quick +170 rw auto quick
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v3 5/8] blockdev: Add dynamic module loading for block drivers
In reply to Max ReitzFrom: Marc Mari <[email protected]>
Extend the current module interface to allow for block drivers to be loaded dynamically on request. The only block drivers that can be converted into modules are the drivers that don't perform any init operation except for registering themselves.
In addition, only the protocol drivers are being modularized, as they are the only ones which see significant performance benefits. The format drivers do not generally link to external libraries, so modularizing them is of no benefit from a performance perspective.
All the necessary module information is located in a new structure found in module_block.h
This spoils the purpose of 5505e8b76f (block/dmg: make it modular).
Before this patch, if module build is enabled, block-dmg.so is linked to libbz2, whereas the main binary is not. In downstream, theoretically, it means only the qemu-block-extra package depends on libbz2, while the main QEMU package needn't to. With this patch, we (temporarily) change the case so that the main QEMU depends on libbz2 again.
Message-id: [email protected]
array will not cause a build error]
--- Makefile | 3 --- block.c | 62 +++++++++++++++++++++++++++++++++++++++++++++------ block/Makefile.objs | 3 +-- include/qemu/module.h | 3 +++ util/module.c | 38 +++++++++---------------------- 5 files changed, 70 insertions(+), 39 deletions(-)
Makefile +0 -3
@@ -247,9 +247,6 @@ Makefile: $(version-obj-y) $(version-lobj-y) libqemustub.a: $(stub-obj-y) libqemuutil.a: $(util-obj-y) -block-modules = $(foreach o,$(block-obj-m),"$(basename $(subst /,-,$o))",) NULL -util/module.o-cflags = -D'CONFIG_BLOCK_MODULES=$(block-modules)' - ###################################################################### qemu-img.o: qemu-img-cmds.h
block.c +55 -7
105 lines not on this page · raw message
block/Makefile.objs +1 -2
@@ -1,4 +1,4 @@ -block-obj-y += raw_bsd.o qcow.o vdi.o vmdk.o cloop.o bochs.o vpc.o vvfat.o +block-obj-y += raw_bsd.o qcow.o vdi.o vmdk.o cloop.o bochs.o vpc.o vvfat.o dmg.o block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o qcow2-cache.o block-obj-y += qed.o qed-gencb.o qed-l2-cache.o qed-table.o qed-cluster.o block-obj-y += qed-check.o
@@ -40,7 +40,6 @@ gluster.o-libs := $(GLUSTERFS_LIBS) ssh.o-cflags := $(LIBSSH2_CFLAGS) ssh.o-libs := $(LIBSSH2_LIBS) archipelago.o-libs := $(ARCHIPELAGO_LIBS) -block-obj-m += dmg.o dmg.o-libs := $(BZIP2_LIBS) qcow.o-libs := -lz linux-aio.o-libs := -laio
include/qemu/module.h +3 -0
@@ -52,9 +52,12 @@ typedef enum {#define qapi_init (function) module_init(function, MODULE_INIT_QAPI)#define type_init (function) module_init(function, MODULE_INIT_QOM) +#define block_module_load_one (lib) module_load_one("block-", lib) +void register_module_init (void (*fn)(void ),module_init_type type);void register_dso_module_init (void (*fn)(void ),module_init_type type);void module_call_init (module_init_type type); +void module_load_one (const char *prefix,const char *lib_name);#endif
util/module.c +11 -27
@@ -87,14 +87,11 @@ void register_dso_module_init(void (*fn)(void), module_init_type type)QTAILQ_INSERT_TAIL (&dso_init_list, e, node); } -static void module_load (module_init_type type); -void module_call_init (module_init_type type) {ModuleTypeList *l;ModuleEntry *e; -module_load (type); l =find_type (type); QTAILQ_FOREACH(e, l, node) {
@@ -145,6 +142,7 @@ static int module_load_file(const char *fname) ret = -EINVAL ; }else { QTAILQ_FOREACH(e, &dso_init_list, node) { + e->init ();register_module_init (e->init, e->type); } ret =0 ;
@@ -159,14 +157,10 @@ out: }#endif -static void module_load (module_init_type type) +void module_load_one (const char *prefix,const char *lib_name) {#ifdef CONFIG_MODULES char *fname =NULL ; -const char **mp; -static const char *block_modules[] = { -CONFIG_BLOCK_MODULES - };char *exec_dir;char *dirs[3 ];int i =0 ;
@@ -177,15 +171,6 @@ static void module_load(module_init_type type)return ; } -switch (type) { -case MODULE_INIT_BLOCK : - mp = block_modules; -break ; -default : -/* no other types have dynamic modules for now*/ -return ; - } - exec_dir =qemu_get_exec_dir (); dirs[i++] =g_strdup_printf ("%s" ,CONFIG_QEMU_MODDIR ); dirs[i++] =g_strdup_printf ("%s/.." , exec_dir ? :"" );
@@ -194,16 +179,15 @@ static void module_load(module_init_type type)g_free (exec_dir); exec_dir =NULL ; -for ( ; *mp; mp++) { -for (i =0 ; i <ARRAY_SIZE (dirs); i++) { - fname =g_strdup_printf ("%s/%s%s" , dirs[i], *mp,HOST_DSOSUF ); - ret =module_load_file (fname); -g_free (fname); - fname =NULL ; -/* Try loading until loaded a module file */ -if (!ret) { -break ; - } +for (i =0 ; i <ARRAY_SIZE (dirs); i++) { + fname =g_strdup_printf ("%s/%s%s%s" , + dirs[i], prefix, lib_name,HOST_DSOSUF ); + ret =module_load_file (fname); +g_free (fname); + fname =NULL ; +/* Try loading until loaded a module file */ +if (!ret) { +break ; } }
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v3 6/8] blockdev: Modularize nfs block driver
In reply to Max ReitzFrom: Colin Lord <[email protected]>
Modularizes the nfs block driver so that it gets dynamically loaded.
Message-id: [email protected]
--- block/Makefile.objs | 1 + configure | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
block/Makefile.objs +1 -0
@@ -29,6 +29,7 @@ block-obj-y += crypto.o common-obj-y += stream.o +nfs.o-libs := $(LIBNFS_LIBS) iscsi.o-cflags := $(LIBISCSI_CFLAGS) iscsi.o-libs := $(LIBISCSI_LIBS) curl.o-cflags := $(CURL_CFLAGS)
configure +2 -2
@@ -4578,7 +4578,6 @@ if test "$libnfs" != "no" ; then if $pkg_config --atleast-version=1.9.3 libnfs; then libnfs="yes" libnfs_libs=$($pkg_config --libs libnfs) - LIBS="$LIBS $libnfs_libs" else if test "$libnfs" = "yes" ; then feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
@@ -5351,7 +5350,8 @@ if test "$libiscsi" = "yes" ; then fi if test "$libnfs" = "yes" ; then - echo "CONFIG_LIBNFS=y" >> $config_host_mak + echo "CONFIG_LIBNFS=m" >> $config_host_mak + echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak fi if test "$seccomp" = "yes"; then
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v3 4/8] blockdev: Add dynamic generation of module_block.h
In reply to Max ReitzFrom: Marc Mari <[email protected]>
To simplify the addition of new block modules, add a script that generates module_block.h automatically from the modules' source code.
This script assumes that the QEMU coding style rules are followed.
Message-id: [email protected]
--- Makefile | 7 +++ scripts/modules/module_block.py | 108 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 scripts/modules/module_block.py
Makefile +7 -0
@@ -76,6 +76,8 @@ GENERATED_HEADERS += trace/generated-ust-provider.h GENERATED_SOURCES += trace/generated-ust.c endif +GENERATED_HEADERS += module_block.h + # Don't try to regenerate Makefile or configure # We don't generate any of them Makefile: ;
@@ -352,6 +354,11 @@ ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) libqemuutil.a libqemustub.a ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) libqemuutil.a libqemustub.a $(call LINK, $^) +module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak + $(call quiet-command,$(PYTHON) $< $@ \ + $(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \ + " GEN $@") + clean: # avoid old build problems by removing potentially incorrect old files rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
scripts/modules/module_block.py new file +108 -0
108 lines not on this page · raw message
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v3 7/8] commit: get the overlay node before manipulating the backing chain
In reply to Max ReitzFrom: Alberto Garcia <[email protected]>
The 'block-commit' command has a 'top' parameter to specify the topmost node from which the data is going to be copied.
[E] <- [D] <- [C] <- [B] <- [A]
In this case if [C] is the top node then this is the result:
[E] <- [B] <- [A]
[B] must be modified so its backing image string points to [E] instead of [C]. commit_start() takes care of reopening [B] in read-write mode, and commit_complete() puts it back in read-only mode once the operation has finished.
In order to find [B] (the overlay node) we look for the node that has
[C] (the top node) as its backing image. However in commit_complete() we're doing it after [C] has been removed from the chain, so [B] is never found and remains in read-write mode.
This patch gets the overlay node before the backing chain is manipulated.
Message-id: [email protected]
--- block/commit.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
block/commit.c +1 -2
@@ -83,7 +83,7 @@ static void commit_complete(BlockJob *job, void *opaque)BlockDriverState *active = s->active;BlockDriverState *top =blk_bs (s->top);BlockDriverState *base =blk_bs (s->base); -BlockDriverState *overlay_bs; +BlockDriverState *overlay_bs =bdrv_find_overlay (active, top);int ret = data->ret;if (!block_job_is_cancelled (&s->common) && ret ==0 ) {
@@ -97,7 +97,6 @@ static void commit_complete(BlockJob *job, void *opaque)if (s->base_flags !=bdrv_get_flags (base)) {bdrv_reopen (base, s->base_flags,NULL ); } - overlay_bs =bdrv_find_overlay (active, top);if (overlay_bs && s->orig_overlay_flags !=bdrv_get_flags (overlay_bs)) {bdrv_reopen (overlay_bs, s->orig_overlay_flags,NULL ); }
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v3 8/8] iotest 055: refactor and speed up
In reply to Max ReitzFrom: Vladimir Sementsov-Ogievskiy <[email protected]>
Source disk is created and filled with test data before each test case. Instead initialize it once for the whole unit.
Test disk filling patterns are merged into one pattern.
Also TestSetSpeed used different image_len for source and target (by mistake) - this is automatically fixed here.
Message-id: [email protected]
--- tests/qemu-iotests/055 | 52 +++++++++++++++++--------------------------------- 1 file changed, 18 insertions(+), 34 deletions(-)
tests/qemu-iotests/055 +18 -34
@@ -29,17 +29,24 @@ test_img = os.path.join(iotests.test_dir, 'test.img') target_img = os.path.join(iotests.test_dir, 'target.img') blockdev_target_img = os.path.join(iotests.test_dir, 'blockdev-target.img') -class TestSingleDrive(iotests.QMPTestCase): - image_len = 64 * 1024 * 1024 # MB +image_len = 64 * 1024 * 1024 # MB + +def setUpModule(): + qemu_img('create', '-f', iotests.imgfmt, test_img, str(image_len)) + qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x11 0 64k', test_img) + qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x00 64k 128k', test_img) + qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x22 162k 32k', test_img) + qemu_io('-f', iotests.imgfmt, '-c', 'write -P0xd5 1M 32k', test_img) + qemu_io('-f', iotests.imgfmt, '-c', 'write -P0xdc 32M 124k', test_img) + qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x33 67043328 64k', test_img) +def tearDownModule(): + os.remove(test_img) + + +class TestSingleDrive(iotests.QMPTestCase): def setUp(self): - # Write data to the image so we can compare later - qemu_img('create', '-f', iotests.imgfmt, test_img, str(TestSingleDrive.image_len)) - qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x5d 0 64k', test_img) - qemu_io('-f', iotests.imgfmt, '-c', 'write -P0xd5 1M 32k', test_img) - qemu_io('-f', iotests.imgfmt, '-c', 'write -P0xdc 32M 124k', test_img) - qemu_io('-f', iotests.imgfmt, '-c', 'write -P0xdc 67043328 64k', test_img) - qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(TestSingleDrive.image_len)) + qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(image_len)) self.vm = iotests.VM().add_drive(test_img).add_drive(blockdev_target_img) if iotests.qemu_default_machine == 'pc':
@@ -48,7 +55,6 @@ class TestSingleDrive(iotests.QMPTestCase): def tearDown(self): self.vm.shutdown() - os.remove(test_img) os.remove(blockdev_target_img) try: os.remove(target_img)
@@ -155,19 +161,14 @@ class TestSingleDrive(iotests.QMPTestCase): self.assert_qmp(result, 'error/class', 'GenericError') class TestSetSpeed(iotests.QMPTestCase): - image_len = 80 * 1024 * 1024 # MB - def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, test_img, str(TestSetSpeed.image_len)) - qemu_io('-f', iotests.imgfmt, '-c', 'write -P1 0 512', test_img) - qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(TestSingleDrive.image_len)) + qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(image_len)) self.vm = iotests.VM().add_drive(test_img).add_drive(blockdev_target_img) self.vm.launch() def tearDown(self): self.vm.shutdown() - os.remove(test_img) os.remove(blockdev_target_img) try: os.remove(target_img)
@@ -243,15 +244,8 @@ class TestSetSpeed(iotests.QMPTestCase): self.do_test_set_speed_invalid('blockdev-backup', 'drive1') class TestSingleTransaction(iotests.QMPTestCase): - image_len = 64 * 1024 * 1024 # MB - def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, test_img, str(TestSingleTransaction.image_len)) - qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x5d 0 64k', test_img) - qemu_io('-f', iotests.imgfmt, '-c', 'write -P0xd5 1M 32k', test_img) - qemu_io('-f', iotests.imgfmt, '-c', 'write -P0xdc 32M 124k', test_img) - qemu_io('-f', iotests.imgfmt, '-c', 'write -P0xdc 67043328 64k', test_img) - qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(TestSingleDrive.image_len)) + qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(image_len)) self.vm = iotests.VM().add_drive(test_img).add_drive(blockdev_target_img) if iotests.qemu_default_machine == 'pc':
@@ -260,7 +254,6 @@ class TestSingleTransaction(iotests.QMPTestCase): def tearDown(self): self.vm.shutdown() - os.remove(test_img) os.remove(blockdev_target_img) try: os.remove(target_img)
@@ -454,17 +447,8 @@ class TestDriveCompression(iotests.QMPTestCase): fmt_supports_compression = [{'type': 'qcow2', 'args': ()}, {'type': 'vmdk', 'args': ('-o', 'subformat=streamOptimized')}] - def setUp(self): - # Write data to the image so we can compare later - qemu_img('create', '-f', iotests.imgfmt, test_img, str(TestDriveCompression.image_len)) - qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x11 0 64k', test_img) - qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x00 64k 128k', test_img) - qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x22 162k 32k', test_img) - qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x33 67043328 64k', test_img) - def tearDown(self): self.vm.shutdown() - os.remove(test_img) os.remove(blockdev_target_img) try: os.remove(target_img)
Signature · 1 line
2.9.3
Quoted 6 lines · Max Reitz
The following changes since commit
33e1666b4289313306371fee0740f5c85517e406:Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2016-09-19' into staging (2016-09-19 18:06:52 +0100)
are available in the git repository at:
Quoted 9 lines
git://github.com/XanClic/qemu.gittags/pull-block-2016-09-19for you to fetch changes up to
203bfabbcc0d681ebb4a8f0a0d08b077d4e53eae:iotest 055: refactor and speed up (2016-09-19 23:13:40 +0200)
----------------------------------------------------------------
Block patches for 2.8
This still has the same w32 build failure:
CC block.o/home/petmay01/linaro/qemu-for-merges/block.c: In function ‘bdrv_find_format’:/home/petmay01/linaro/qemu-for-merges/block.c:270:19: error:
comparison of unsigned expression < 0 is always false [-Werror=type-limits]
for (i = 0; i < ARRAY_SIZE(block_driver_modules); ++i) {
^/home/petmay01/linaro/qemu-for-merges/block.c: In function ‘bdrv_find_protocol’:/home/petmay01/linaro/qemu-for-merges/block.c:542:19: error:
comparison of unsigned expression < 0 is always false [-Werror=type-limits]
for (i = 0; i < ARRAY_SIZE(block_driver_modules); ++i) {
^cc1: all warnings being treated as errors
thanks
-- PMM
Quoted 11 lines · Peter Maydell
Quoted 10 lines · Max Reitz
The following changes since commit
33e1666b4289313306371fee0740f5c85517e406:Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2016-09-19' into staging (2016-09-19 18:06:52 +0100)
are available in the git repository at:
git://github.com/XanClic/qemu.gittags/pull-block-2016-09-19for you to fetch changes up to
203bfabbcc0d681ebb4a8f0a0d08b077d4e53eae:
Quoted 8 lines
Quoted 5 lines
iotest 055: refactor and speed up (2016-09-19 23:13:40 +0200)
----------------------------------------------------------------
Block patches for 2.8This still has the same w32 build failure:
Hm, interesting. I only tested w64 and this v3 fixed the issue there for some reason... I'll guarantee a v4 will work for both Linux and Windows 32 Bit, at least on my machine. :-/
Sorry again!
Max
Quoted 18 lines
CC block.o
/home/petmay01/linaro/qemu-for-merges/block.c: In function ‘bdrv_find_format’:/home/petmay01/linaro/qemu-for-merges/block.c:270:19: error:
comparison of unsigned expression < 0 is always false [-Werror=type-limits]for (i = 0; i < ARRAY_SIZE(block_driver_modules); ++i) { ^
/home/petmay01/linaro/qemu-for-merges/block.c: In function ‘bdrv_find_protocol’:/home/petmay01/linaro/qemu-for-merges/block.c:542:19: error:
comparison of unsigned expression < 0 is always false [-Werror=type-limits]for (i = 0; i < ARRAY_SIZE(block_driver_modules); ++i) { ^cc1: all warnings being treated as errors
thanks
-- PMM