[Qemu-block] [PATCH v3 01/21] qcow2: Add .bdrv_join_options callback

2015-12-04 Thread Kevin Wolf
qcow2 accepts a few driver-specific options that overlap semantically (e.g. "overlap-check" is an alias of "overlap-check.template", and any missing cache size option is derived from the given ones). When bdrv_reopen() merges the set of updated options with left out options that should be kept at

[Qemu-block] [PATCH v3 08/21] block: Keep "driver" in bs->options

2015-12-04 Thread Kevin Wolf
Instead of passing a separate drv argument to bdrv_open_common(), just make sure that a "driver" option is set in the QDict. This also means that a "driver" entry is consistently present in bs->options now. This is another step towards keeping all options in the QDict (which is the represenation

[Qemu-block] [PATCH v3 02/21] block: Fix reopen with semantically overlapping options

2015-12-04 Thread Kevin Wolf
This fixes bdrv_reopen() calls like the following one: qemu-io -c 'open -o overlap-check.template=all /tmp/test.qcow2' \ -c 'reopen -o overlap-check=none' The approach taken so far would result in an options QDict that has both "overlap-check.template=all" and "overlap-check=none", which

[Qemu-block] [PATCH v3 00/21] block: Cache mode for children etc.

2015-12-04 Thread Kevin Wolf
This is part three (or four, depending on whether you count the bdrv_swap removal) of what I had sent earlier as "[PATCH 00/34] block: Cache mode for children, reopen overhaul and more". Most of the patches were actually already reviewed in v1. This part contains the remaining functional changes

[Qemu-block] [PATCH v3 03/21] mirror: Error out when a BDS would get two BBs

2015-12-04 Thread Kevin Wolf
bdrv_replace_in_backing_chain() asserts that not both old and new BlockDdriverState have a BlockBackend attached to them because both would have to end up pointing to the new BDS and we don't support more than one BB per BDS yet. Before we can safely allow references to existing nodes as backing

[Qemu-block] [PATCH v3 04/21] block: Allow references for backing files

2015-12-04 Thread Kevin Wolf
For bs->file, using references to existing BDSes has been possible for a while already. This patch enables the same for bs->backing. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- block.c | 48

[Qemu-block] [PATCH v3 10/21] block: reopen: Document option precedence and refactor accordingly

2015-12-04 Thread Kevin Wolf
The interesting part of reopening an image is from which sources the effective options should be taken, i.e. which options take precedence over which other options. This patch documents the precedence that will be implemented in the following patches. It also refactors bdrv_reopen_queue(), so

Re: [Qemu-block] [PATCH v2 03/21] mirror: Error out when a BDS would get two BBs

2015-12-04 Thread Kevin Wolf
Am 30.11.2015 um 15:51 hat Alberto Garcia geschrieben: > On Mon 23 Nov 2015 04:59:42 PM CET, Kevin Wolf wrote: > > > @@ -370,11 +371,22 @@ static void mirror_exit(BlockJob *job, void *opaque) > > if (s->to_replace) { > > to_replace = s->to_replace; > > } > > + > > +

[Qemu-block] [PATCH v3 11/21] block: Add infrastructure for option inheritance

2015-12-04 Thread Kevin Wolf
Options are not actually inherited from the parent node yet, but this commit lays the grounds for doing so. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- block.c | 52 ---

[Qemu-block] [PATCH v3 19/21] qemu-iotests: Try setting cache mode for children

2015-12-04 Thread Kevin Wolf
This is a basic test for specifying cache modes for child nodes on the command line. It doesn't take much time and works without O_DIRECT support. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- tests/qemu-iotests/051 | 10 +++-

[Qemu-block] [PATCH v3 07/21] block: Pass driver-specific options to .bdrv_refresh_filename()

2015-12-04 Thread Kevin Wolf
In order to decide whether a blkdebug: filename can be produced or a json: one is necessary, blkdebug checked whether bs->options had more options than just "config", "x-image" or "image" (the latter including nested options). That doesn't work well when generic block layer options are present.

[Qemu-block] [PATCH v3 14/21] blockdev: Set 'format' indicates non-empty drive

2015-12-04 Thread Kevin Wolf
Creating an empty drive while specifying 'format' doesn't make sense. The specified format driver would simply be ignored. Make a set 'format' option an indication that a non-empty drive should be created. This makes 'format' consistent with 'driver' and allows using it with a block driver that

[Qemu-block] [PATCH v3 16/21] block: reopen: Extract QemuOpts for generic block layer options

2015-12-04 Thread Kevin Wolf
This patch adds a QemuOpts for generic block layer options to bdrv_reopen_prepare(). The only two options that currently exist (node-name and driver) cannot be changed, so the only thing we do is putting them right back into the QDict so that we check at the end that they are indeed unchanged. We

[Qemu-block] [PATCH v3 15/21] qemu-iotests: Remove cache mode test without medium

2015-12-04 Thread Kevin Wolf
Specifying the cache mode for a driver without a medium is not a useful thing to do: As long as there is no medium, the cache mode doesn't make a difference, and once the 'change' command is used to insert a medium, it ignores the old cache mode and makes the new medium use cache=writethrough.

[Qemu-block] [PATCH v3 12/21] block: Split out parse_json_protocol()

2015-12-04 Thread Kevin Wolf
The next patch distinguishes options that were explicitly set and options that were derived. bdrv_fill_option() added options of both types: Options given by json: syntax should be counted as explicit, but the rest is derived. In preparation for the distinction, move json: parse to a separate

[Qemu-block] [PATCH v3 20/21] qemu-iotests: Test cache mode option inheritance

2015-12-04 Thread Kevin Wolf
This is doing a more complete test on setting cache modes both while opening an image (i.e. in a -drive command line) and in reopen situations. It checks that reopen can specify options for child nodes and that cache modes are correctly inherited from parent nodes where they are not specified.

[Qemu-block] [PATCH v3 21/21] qemu-iotests: Test reopen with node-name/driver options

2015-12-04 Thread Kevin Wolf
'node-name' and 'driver' should not be changed during a reopen operation. It is, however, valid to specify them with the same value as they already had. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- tests/qemu-iotests/133 | 90

[Qemu-block] [PATCH] xen_disk: treat "vhd" as "vpc"

2015-12-04 Thread Stefano Stabellini
The Xen toolstack uses "vhd" to specify a disk in VHD format, however the name of the driver in QEMU is "vpc". Replace "vhd" with "vpc", so that QEMU can find the right driver to use for it. Signed-off-by: Stefano Stabellini diff --git a/hw/block/xen_disk.c

[Qemu-block] [PATCH v3 06/21] block: Exclude nested options only for children in append_open_options()

2015-12-04 Thread Kevin Wolf
Some drivers have nested options (e.g. blkdebug rule arrays), which don't belong to a child node and shouldn't be removed. Don't remove all options with "." in their name, but check for the complete prefixes of actually existing child nodes. Signed-off-by: Kevin Wolf ---

[Qemu-block] [PATCH v3 05/21] block: Consider all block layer options in append_open_options

2015-12-04 Thread Kevin Wolf
The code already special-cased "node-name", which is currently the only option passed in the QDict that isn't driver-specific. Generalise the code to take all general block layer options into consideration. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake

[Qemu-block] [PATCH v3 09/21] block: Allow specifying child options in reopen

2015-12-04 Thread Kevin Wolf
If the child was defined in the same context (-drive argument or blockdev-add QMP command) as its parent, a reopen of the parent should work the same and allow changing options of the child. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by:

[Qemu-block] [PATCH v3 13/21] block: Introduce bs->explicit_options

2015-12-04 Thread Kevin Wolf
bs->options doesn't only contain options that the user explicitly requested, but also option that were derived from flags, the filename or inherited from the parent node. For reopen, it is important to know the difference because reopening the parent can change inherited values in child nodes,

Re: [Qemu-block] [Qemu-devel] [PATCH for-2.6 0/2] Preparation for PCI devices convert to realize()

2015-12-04 Thread John Snow
On 12/04/2015 02:47 AM, Cao jin wrote: > Hi, > As you know, there are many PCI devices still using .init() as its > initialization function, I am planning to do the "convert to realize()" > work, and PCI bridge devices are chosen first. > The supporting functions should be

Re: [Qemu-block] [PATCH v2 7/8] block: Move some bdrv_*_all() functions to BB

2015-12-04 Thread Max Reitz
On 01.12.2015 17:01, Kevin Wolf wrote: > Am 10.11.2015 um 04:27 hat Max Reitz geschrieben: >> Move bdrv_drain_all(), bdrv_commit_all(), bdrv_flush_all() and >> bdrv_invalidate_cache_all() to BB. >> >> The only operation left is bdrv_close_all(), which cannot be moved to >> the BB because it should

Re: [Qemu-block] [PATCH v3 06/21] block: Exclude nested options only for children in append_open_options()

2015-12-04 Thread Max Reitz
On 04.12.2015 14:35, Kevin Wolf wrote: > Some drivers have nested options (e.g. blkdebug rule arrays), which > don't belong to a child node and shouldn't be removed. Don't remove all > options with "." in their name, but check for the complete prefixes of > actually existing child nodes. > >

Re: [Qemu-block] [PATCH v3 17/21] block: Move cache options into options QDict

2015-12-04 Thread Max Reitz
On 04.12.2015 14:35, Kevin Wolf wrote: > This adds the cache mode options to the QDict, so that they can be > specified for child nodes (e.g. backing.cache.direct=off). > > The cache modes are not removed from the flags at this point; instead, > options and flags are kept in sync. If the user

Re: [Qemu-block] [PATCH v3 14/21] blockdev: Set 'format' indicates non-empty drive

2015-12-04 Thread Max Reitz
On 04.12.2015 14:35, Kevin Wolf wrote: > Creating an empty drive while specifying 'format' doesn't make sense. > The specified format driver would simply be ignored. > > Make a set 'format' option an indication that a non-empty drive should > be created. This makes 'format' consistent with

[Qemu-block] [PULL v2 3/4] tests: Use proper functions types instead of void (*fn)

2015-12-04 Thread Andreas Färber
From: Markus Armbruster We have several function parameters declared as void (*fn). This is just a stupid way to write void *, and the only purpose writing it like that could serve is obscuring the sin of bypassing the type system without need. The original sin is commit