Re: [Qemu-block] [Qemu-devel] [PATCH 2/3] virtio-blk: Use blk_drain() to drain IO requests

2015-06-12 Thread Christian Borntraeger
Am 11.06.2015 um 04:51 schrieb Fam Zheng: On Wed, 06/10 14:38, Alexander Yarygin wrote: Each call of the virtio_blk_reset() function calls blk_drain_all(), which works for all existing BlockDriverStates, while draining only one is needed. This patch replaces blk_drain_all() by blk_drain() in

[Qemu-block] [PATCH 2/3] timer: Use a single definition of NSEC_PER_SEC for the whole codebase

2015-06-12 Thread Alberto Garcia
Signed-off-by: Alberto Garcia be...@igalia.com --- hw/ppc/ppc.c | 2 -- hw/ppc/spapr_rtc.c | 3 +-- hw/timer/mc146818rtc.c | 1 - hw/usb/hcd-ehci.c | 2 +- include/qemu/timer.h | 2 +- tests/rtl8139-test.c | 10 +- tests/test-throttle.c | 8

[Qemu-block] [PATCH 3/3] util: Infrastructure for computing recent averages

2015-06-12 Thread Alberto Garcia
This module computes the average of a set of values within a time window, keeping also track of the minimum and maximum values. In order to produce more accurate results it works internally by creating two time windows of the same period, offsetted by half of that period. Values are accounted on

[Qemu-block] [PATCH 0/3] Add infrastructure to compute timed averages

2015-06-12 Thread Alberto Garcia
This series adds a new module that can be used to compute the average of a set of values in a certain period of time. This will be used by the accounting code to obtain statistics such as the min / max / average latency of I/O commands. This is based on BenoƮt's code, originally written last

[Qemu-block] [PATCH 1/3] timer: Move NANOSECONDS_PER_SECONDS to timer.h

2015-06-12 Thread Alberto Garcia
We want to be able to reuse this define by making it common to multiple QEMU modules. This also makes it an integer since there's no need for it to be a float. Signed-off-by: Alberto Garcia be...@igalia.com --- include/qemu/throttle.h | 2 -- include/qemu/timer.h| 2 ++ 2 files changed, 2

Re: [Qemu-block] [Qemu-devel] [PATCH v9 0/8] Block Throttle Group Support

2015-06-12 Thread Stefan Hajnoczi
On Mon, Jun 08, 2015 at 06:17:40PM +0200, Alberto Garcia wrote: V9: - Make test-throttle.c call bdrv_init() to make sure that throttle_groups_init() gets called and the mutex is initialized. This was breaking the tests in Mac OS X. V8:

[Qemu-block] [PATCH 4/4] hw/arm/virt: Make block devices default to virtio

2015-06-12 Thread Peter Maydell
Now we have virtio-pci, we can make the virt board's default block device type be IF_VIRTIO. This allows users to use simplified command lines that don't have to explicitly create virtio-pci-blk devices; the -hda c very short options now also work. This means we also need to set no_cdrom to avoid

Re: [Qemu-block] [PATCH 3/3] block: Let bdrv_drain_all() to call aio_poll() for each AioContext

2015-06-12 Thread Stefan Hajnoczi
On Wed, Jun 10, 2015 at 02:38:17PM +0300, Alexander Yarygin wrote: After the commit 9b536adc (block: acquire AioContext in bdrv_drain_all()) the aio_poll() function got called for every BlockDriverState, in assumption that every device may have its own AioContext. If we have thousands of disks

Re: [Qemu-block] [PATCH v2 10/13] queue.h: Add QLIST_FIX_HEAD_PTR()

2015-06-12 Thread Max Reitz
On 10.06.2015 15:47, Kevin Wolf wrote: If the head of a list has been moved to a different memory location, the le_prev link in the first list entry has to be fixed up. Provide a macro that implements this fixup. Signed-off-by: Kevin Wolf kw...@redhat.com --- include/qemu/queue.h | 6 ++

[Qemu-block] [PULL 01/25] iotests: remove assertIsNotNone call

2015-06-12 Thread Kevin Wolf
From: John Snow js...@redhat.com RHEL6 doesn't have Python 2.7, so replace this call with assertNotEqual(x, None) which will work just as well. Reported-by: Kevin Wolf kw...@redhat.com Signed-off-by: John Snow js...@redhat.com Reviewed-by: Stefan Hajnoczi stefa...@redhat.com Signed-off-by: Kevin

[Qemu-block] [PULL 07/25] vmdk: Use vmdk_find_index_in_cluster everywhere

2015-06-12 Thread Kevin Wolf
From: Fam Zheng f...@redhat.com Signed-off-by: Fam Zheng f...@redhat.com Reviewed-by: Max Reitz mre...@redhat.com Signed-off-by: Kevin Wolf kw...@redhat.com --- block/vmdk.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index

[Qemu-block] [PULL 03/25] qcow2: Set MIN_L2_CACHE_SIZE to 2

2015-06-12 Thread Kevin Wolf
From: Max Reitz mre...@redhat.com The L2 cache must cover at least two L2 tables, because during COW two L2 tables are accessed simultaneously. Reported-by: Alexander Graf ag...@suse.de Cc: qemu-stable qemu-sta...@nongnu.org Signed-off-by: Max Reitz mre...@redhat.com Tested-by: Alexander Graf

[Qemu-block] [PULL 06/25] vmdk: Fix index_in_cluster calculation in vmdk_co_get_block_status

2015-06-12 Thread Kevin Wolf
From: Fam Zheng f...@redhat.com It has the similar issue with b1649fae49a8. Since the calculation is repeated for a few times already, introduce a function so it can be reused. Signed-off-by: Fam Zheng f...@redhat.com Reviewed-by: Max Reitz mre...@redhat.com Signed-off-by: Kevin Wolf

[Qemu-block] [PULL 15/25] check-qdict: Test cases for new functions

2015-06-12 Thread Kevin Wolf
This adds test cases for the following new QDict functions: * qdict_array_entries() * qdict_set_default_str() * qdict_copy_default() Signed-off-by: Kevin Wolf kw...@redhat.com Reviewed-by: Eric Blake ebl...@redhat.com Reviewed-by: Max Reitz mre...@redhat.com --- tests/check-qdict.c | 67

[Qemu-block] [PULL 13/25] qdict: Add qdict_array_entries()

2015-06-12 Thread Kevin Wolf
This counts the entries in a flattened array in a QDict without actually splitting the QDict into a QList. bdrv_open_image() doesn't take a QList, but rather a QDict and a key prefix string, so this is more convenient for block drivers which have a dynamically sized list of child nodes (e.g.

[Qemu-block] [PULL 14/25] qdict: Add qdict_{set,copy}_default()

2015-06-12 Thread Kevin Wolf
In the block layer functions that determine options for a child block device, it's a common pattern to either copy options from the parent's options or to set a default string if the option isn't explicitly set yet for the child. Provide convenience functions so that it becomes a one-liner for

[Qemu-block] [PULL 25/25] block: Fix reopen flag inheritance

2015-06-12 Thread Kevin Wolf
When reopening an image, the block layer already takes care to reopen bs-file as well with recalculated inherited flags. The same must happen for any other child (most notably missing before this patch: backing files). If bs-file (or any other child) didn't originally inherit from bs, e.g.

[Qemu-block] [PULL 00/25] Block layer core and image format patches

2015-06-12 Thread Kevin Wolf
The following changes since commit 4cb618abc1818586c08011ff0a84a015787b1672: Merge remote-tracking branch 'remotes/lalrae/tags/mips-20150612' into staging (2015-06-12 12:49:40 +0100) are available in the git repository at: git://repo.or.cz/qemu/kevin.git tags/for-upstream for you

[Qemu-block] [PULL 02/25] qemu-iotests: Fix 128 if sudo required

2015-06-12 Thread Kevin Wolf
From: Fam Zheng f...@redhat.com If passwordless sudo works, use it in the qemu-io cmd. Signed-off-by: Fam Zheng f...@redhat.com Reviewed-by: Stefan Hajnoczi stefa...@redhat.com Signed-off-by: Kevin Wolf kw...@redhat.com --- tests/qemu-iotests/128 | 4 +++- 1 file changed, 3 insertions(+), 1

[Qemu-block] [PULL 10/25] block: Change bitmap truncate conditional to assertion

2015-06-12 Thread Kevin Wolf
From: John Snow js...@redhat.com This is an artifact of an older version that had both all-bitmap and single-bitmap truncate functions, and some info got lost in the shuffle. Bitmaps can only be frozen during a backup operation, and a backup operation should prevent a resize operation, so just

[Qemu-block] [PULL 04/25] iotests: qcow2 COW with minimal L2 cache size

2015-06-12 Thread Kevin Wolf
From: Max Reitz mre...@redhat.com This adds a test case to test 103 for performing a COW operation in a qcow2 image using an L2 cache with minimal size (which should be at least two clusters so the COW can access both source and destination simultaneously). Signed-off-by: Max Reitz

[Qemu-block] [PULL 17/25] vmdk: Use bdrv_open_image()

2015-06-12 Thread Kevin Wolf
Besides standardising on a single interface for opening child nodes, this patch allows the user to specify options to individual extent nodes. Overriding file names isn't possible with this yet, so it's of limited usefulness, but still a step forward. Signed-off-by: Kevin Wolf kw...@redhat.com

[Qemu-block] [PULL 18/25] block: Use macro for cache option names

2015-06-12 Thread Kevin Wolf
Signed-off-by: Kevin Wolf kw...@redhat.com Reviewed-by: Eric Blake ebl...@redhat.com Reviewed-by: Max Reitz mre...@redhat.com Reviewed-by: Jeff Cody jc...@redhat.com Reviewed-by: Alberto Garcia be...@igalia.com --- blockdev.c| 24 include/block/block.h | 8

[Qemu-block] [PULL 08/25] raw-posix: Fix .bdrv_co_get_block_status() for unaligned image size

2015-06-12 Thread Kevin Wolf
Image files with an unaligned image size have a final hole that starts at EOF, i.e. in the middle of a sector. Currently, *pnum == 0 is returned when checking the status of this sector. In qemu-img, this triggers an assertion failure. In order to fix this, one type for the sector that contains

[Qemu-block] [PULL 19/25] block: Use QemuOpts in bdrv_open_common()

2015-06-12 Thread Kevin Wolf
Instead of manually parsing options and then deleting them from the options QDict, just use QemuOpts like most other places that deal with block device options. More options will be added there and then QemuOpts is a lot more manageable than open-coding everything. Signed-off-by: Kevin Wolf

[Qemu-block] [PULL 23/25] block: Add list of children to BlockDriverState

2015-06-12 Thread Kevin Wolf
This allows iterating over all children of a given BDS, not only including bs-file and bs-backing_hd, but also driver-specific ones like VMDK extents or Quorum children. For bdrv_swap(), the list of children of the swapped BDS stays at that BDS (because that's where the pointers stay as well).

[Qemu-block] [PULL 11/25] block: driver should override flags in bdrv_open()

2015-06-12 Thread Kevin Wolf
From: Max Reitz mre...@redhat.com The BDRV_O_PROTOCOL flag should have an impact only if no driver is specified explicitly. Therefore, if bdrv_open() is called with an explicit block driver argument (either through the options QDict or through the drv parameter) and that block driver is a

[Qemu-block] [PULL 16/25] quorum: Use bdrv_open_image()

2015-06-12 Thread Kevin Wolf
Besides standardising on a single interface for opening child nodes, this simplifies the .bdrv_open() implementation of the quorum block driver by using block layer functionality for handling BlockdevRefs. Signed-off-by: Kevin Wolf kw...@redhat.com Reviewed-by: Eric Blake ebl...@redhat.com

[Qemu-block] [PULL 22/25] queue.h: Add QLIST_FIX_HEAD_PTR()

2015-06-12 Thread Kevin Wolf
If the head of a list has been moved to a different memory location, the le_prev link in the first list entry has to be fixed up. Provide a macro that implements this fixup. Signed-off-by: Kevin Wolf kw...@redhat.com Reviewed-by: Eric Blake ebl...@redhat.com Reviewed-by: Max Reitz

[Qemu-block] [PULL 21/25] block: Drain requests before swapping nodes in bdrv_swap()

2015-06-12 Thread Kevin Wolf
bdrv_swap() requires that there are no requests in flight on either of the two devices. The request coroutine would work on the wrong BlockDriverState object (with bs-opaque even being interpreted as a different type potentially) and all sorts of bad things would result from this. The currently

[Qemu-block] [PULL 20/25] block: Move flag inheritance to bdrv_open_inherit()

2015-06-12 Thread Kevin Wolf
Instead of letting every caller of bdrv_open() determine the right flags for its child node manually and pass them to the function, pass the parent node and the role of the newly opened child (like backing file, protocol layer, etc.). Signed-off-by: Kevin Wolf kw...@redhat.com Reviewed-by: Eric

[Qemu-block] [PULL 24/25] block: Add BlockDriverState.inherits_from

2015-06-12 Thread Kevin Wolf
Currently, the block layer assumes that any block node can have only one parent, and if it has a parent, that it inherits some options/flags from this parent. This is not true any more: With references used in block device creation, a single node can be used by multiple parents, or it can be

[Qemu-block] [PATCH 1/4] block: Warn if an if=something drive was also connected manually

2015-06-12 Thread Peter Maydell
Improve the diagnosis of command line errors where the user requested an automatic connection of a drive (via if=something, or by not setting if= and using the board-default-if). We already fail this case if the board actually handles if=something, but if the board did not auto-connect the drive

[Qemu-block] [PATCH 2/4] qdev-properties-system: Change set_pointer's parse callback to use Error

2015-06-12 Thread Peter Maydell
Instead of having set_pointer() call a parse callback which returns an error number that we then convert to an Error string with error_set_from_qdev_prop_error(), make the parse callback take an Error** and set the error itself. This will allow parse routines to provide more helpful error messages

Re: [Qemu-block] [PATCH v2 11/13] block: Add list of children to BlockDriverState

2015-06-12 Thread Max Reitz
On 10.06.2015 15:47, Kevin Wolf wrote: This allows iterating over all children of a given BDS, not only including bs-file and bs-backing_hd, but also driver-specific ones like VMDK extents or Quorum children. For bdrv_swap(), the list of children of the swapped BDS stays at that BDS (because

[Qemu-block] [PATCH 0/4] block: Improve warnings for doubly-connected drives

2015-06-12 Thread Peter Maydell
This patchset attempts to improve the warning and error messages for bad user command lines that attempt to connect a drive up to two devices. The motivation here is patch #4, which changes the default interface for the virt board to virtio. That will break some existing command lines which forgot

Re: [Qemu-block] [PATCH v2 07/13] block: Use QemuOpts in bdrv_open_common()

2015-06-12 Thread Max Reitz
On 10.06.2015 15:47, Kevin Wolf wrote: Instead of manually parsing options and then deleting them from the options QDict, just use QemuOpts like most other places that deal with block device options. More options will be added there and then QemuOpts is a lot more managable than open-coding