Re: [Qemu-block] [PULL v2 39/40] iotests: Add tests for the x-blockdev-del command

2015-11-10 Thread Stefan Hajnoczi
On Tue, Nov 10, 2015 at 2:09 PM, Kevin Wolf wrote: > From: Alberto Garcia > > Signed-off-by: Alberto Garcia > Message-id: > 57c3b0d4d0c73ddadd19e5bded9492c359cc4568.1446475331.git.be...@igalia.com > Reviewed-by: Max Reitz

Re: [Qemu-block] [PULL v2 39/40] iotests: Add tests for the x-blockdev-del command

2015-11-10 Thread Kevin Wolf
Am 10.11.2015 um 15:59 hat Stefan Hajnoczi geschrieben: > On Tue, Nov 10, 2015 at 2:09 PM, Kevin Wolf wrote: > > From: Alberto Garcia > > > > Signed-off-by: Alberto Garcia > > Message-id: > >

[Qemu-block] [PATCH] iotests: Check for quorum support in test 139

2015-11-10 Thread Alberto Garcia
The quorum driver is always built in, but it is disabled during run-time if there's no SHA256 support available (see commit e94867e). This patch skips the quorum test in iotest 139 in that case. Signed-off-by: Alberto Garcia --- tests/qemu-iotests/139 | 2 ++ 1 file changed,

Re: [Qemu-block] [PATCH v4 00/21] Extended I/O accounting

2015-11-10 Thread Stefan Hajnoczi
On Wed, Oct 28, 2015 at 05:32:57PM +0200, Alberto Garcia wrote: > Here's v4 of the series that implements extended I/O accounting for > block devices. > > Since part of Max's BlockBackend series has already been merged, this > series can now be applied cleanly on top of the master branch without

Re: [Qemu-block] [Qemu-devel] [PULL v2 00/40] Block layer patches

2015-11-10 Thread Peter Maydell
On 10 November 2015 at 14:09, Kevin Wolf wrote: > The following changes since commit a8b4f9585a0bf5186fca793ce2c5d754cd8ec49a: > > Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2015-11-10' > into staging (2015-11-10 09:39:24 +) > > are available in the git

Re: [Qemu-block] [PATCH v4 10/21] block: New option to define the intervals for collecting I/O statistics

2015-11-10 Thread Eric Blake
On 10/28/2015 09:33 AM, Alberto Garcia wrote: > The BlockAcctStats structure contains a list of BlockAcctTimedStats. > Each one of these collects statistics about the minimum, maximum and > average latencies of all I/O operations in a certain interval of time. > > This patch adds a new

Re: [Qemu-block] [PATCH 1/4] hw/ide: Remove superfluous return statements

2015-11-10 Thread John Snow
On 11/10/2015 03:16 PM, Thomas Huth wrote: > The "return;" statements at the end of functions do not make > much sense, so let's remove them. > > Cc: John Snow > Cc: qemu-block@nongnu.org > Signed-off-by: Thomas Huth > --- > hw/ide/atapi.c | 1 - >

Re: [Qemu-block] [PATCH v6 4/4] hmp: add monitor command to add/remove a child

2015-11-10 Thread Wen Congyang
On 11/09/2015 10:54 PM, Alberto Garcia wrote: > On Fri 16 Oct 2015 10:57:46 AM CEST, Wen Congyang wrote: > >> +.name = "blockdev_change", >> +.args_type = "op:s,parent:B,child:B?,node:?", >> +.params = "operation parent [child] [node]", > [...] >> +/* >> +

Re: [Qemu-block] [PATCH] mirror: Improve zero-write and discard with fragmented image

2015-11-10 Thread Paolo Bonzini
On 10/11/2015 07:14, Fam Zheng wrote: > On Mon, 11/09 17:29, Kevin Wolf wrote: >> Am 09.11.2015 um 17:18 hat Paolo Bonzini geschrieben: >>> >>> >>> On 09/11/2015 17:04, Kevin Wolf wrote: Am 06.11.2015 um 11:22 hat Fam Zheng geschrieben: > The "pnum < nb_sectors" condition in deciding

Re: [Qemu-block] [PATCH] mirror: Improve zero-write and discard with fragmented image

2015-11-10 Thread Paolo Bonzini
On 10/11/2015 11:12, Kevin Wolf wrote: > > For full mirroring, this strategy will probably make the first > > incremental iteration more expensive. > > You mean because we issue smaller, interleaved write and write_zeroes > requests now instead of only large writes? That's probably right, but >

[Qemu-block] [PATCH v3 2/2] mirror: Improve zero-write and discard with fragmented image

2015-11-10 Thread Fam Zheng
The "pnum < nb_sectors" condition in deciding whether to actually copy data is unnecessarily strict, and the qiov initialization is unnecessarily too, for both bdrv_aio_write_zeroes and bdrv_aio_discard branches. Reorganize mirror_iteration flow so that we: 1) Find the contiguous

Re: [Qemu-block] [PATCH v3] virtio-blk: trivial code optimization

2015-11-10 Thread Stefan Hajnoczi
On Tue, Nov 10, 2015 at 02:35:19PM +0800, Gonglei wrote: > On 2015/11/9 21:57, Stefan Hajnoczi wrote: > > On Mon, Nov 09, 2015 at 05:03:30PM +0800, arei.gong...@huawei.com wrote: > >> From: Gonglei > >> > >> 1. avoid possible superflous checking > >> 2. make code more

Re: [Qemu-block] [PATCH] mirror: Improve zero-write and discard with fragmented image

2015-11-10 Thread Kevin Wolf
Am 10.11.2015 um 10:01 hat Paolo Bonzini geschrieben: > > > On 10/11/2015 07:14, Fam Zheng wrote: > > On Mon, 11/09 17:29, Kevin Wolf wrote: > >> Am 09.11.2015 um 17:18 hat Paolo Bonzini geschrieben: > >>> > >>> > >>> On 09/11/2015 17:04, Kevin Wolf wrote: > Am 06.11.2015 um 11:22 hat Fam

[Qemu-block] [PATCH v3 1/2] block: Introduce coroutine lock to dirty bitmap

2015-11-10 Thread Fam Zheng
Typically, what a dirty bit consumer does is 1) get the next dirty sectors; 2) do something with the sectors; 3) clear the dirty bits; 4) goto 1). This works as long as 2) is simple and atomic in the coroutine sense. Anything sophisticated requires either moving 3) before 2) or using locks,

[Qemu-block] [PATCH v3 0/2] mirror: Improve zero write and discard

2015-11-10 Thread Fam Zheng
The first patch adds a lock between bdrv_set_dirty{,_bitmap} and non-atomic (coroutine) readers, The second patch makes use of it and fixes mirror thin writing. Fam Zheng (2): block: Introduce coroutine lock to dirty bitmap mirror: Improve zero-write and discard with fragmented image

Re: [Qemu-block] [Qemu-devel] [PATCH v6 3/4] qmp: add monitor command to add/remove a child

2015-11-10 Thread Markus Armbruster
Wen Congyang writes: > On 11/09/2015 10:42 PM, Alberto Garcia wrote: >> Sorry again for the late review, here are my comments: >> >> On Fri 16 Oct 2015 10:57:45 AM CEST, Wen Congyang wrote: >>> +void qmp_x_blockdev_change(ChangeOperation op, const char *parent, >>> +

[Qemu-block] [PATCH v4] virtio-blk: trivial code optimization

2015-11-10 Thread arei.gonglei
From: Gonglei 1. avoid possible superflous checking 2. make code more robustness Signed-off-by: Gonglei --- v4: address possible integer underover [Stefan] please review again, thanks --- hw/block/virtio-blk.c | 28

[Qemu-block] [PATCH v11 19/28] qapi: Change munging of CamelCase enum values

2015-11-10 Thread Eric Blake
When munging enum values, the fact that we were passing the entire prefix + value through camel_to_upper() meant that enum values spelled with CamelCase could be turned into CAMEL_CASE. However, this provides a potential collision (both OneTwo and One-Two would munge into ONE_TWO). By changing

[Qemu-block] [PATCH v11 21/28] qapi: Convert qtype_code into qapi enum type

2015-11-10 Thread Eric Blake
What's more meta than using qapi to define qapi? :) Convert qtype_code into a full-fledged[*] builtin qapi enum type, so that a subsequent patch can then use it as the discriminator type of qapi alternate types. Doing so is easiest when renaming it to qapi conventions, as QTypeCode.

[Qemu-block] [PATCH v11 18/28] qerror: more error_setg() usage

2015-11-10 Thread Eric Blake
A few uses of error_set(ERROR_CLASS_GENERIC_ERROR) have snuck in since c6bd8c706. Nuke them. Signed-off-by: Eric Blake --- v11: new patch --- block.c | 3 +-- docs/writing-qmp-commands.txt | 20 +--- hw/i386/pc.c | 2

[Qemu-block] [PULL v2 40/40] qcow2: Fix qcow2_get_cluster_offset() for zero clusters

2015-11-10 Thread Kevin Wolf
When searching for contiguous zero clusters, we only need to check the cluster type. Before this patch, an increasing offset (L2E_OFFSET_MASK) was expected, so that the function never returned more than a single zero cluster in practice. This patch fixes it to actually return as many contiguous

[Qemu-block] [PULL v2 34/40] qemu-iotests: fix cleanup of background processes

2015-11-10 Thread Kevin Wolf
From: Jeff Cody Commit 934659c switched the iotests to run qemu and qemu-nbd from a bash subshell, in order to catch segfaults. Unfortunately, this means the process PID cannot be captured via '$!'. We stopped killing qemu and qemu-nbd processes, leaving a lot of orphaned,

[Qemu-block] [PULL v2 38/40] block: Add 'x-blockdev-del' QMP command

2015-11-10 Thread Kevin Wolf
From: Alberto Garcia This command is still experimental, hence the name. This is the companion to 'blockdev-add'. It allows deleting a BlockBackend with its associated BlockDriverState tree, or a BlockDriverState that is not attached to any backend. In either case, the

[Qemu-block] [PULL v2 33/40] qemu-io: Correct error messages

2015-11-10 Thread Kevin Wolf
From: John Snow Reported-by: Max Reitz Signed-off-by: John Snow Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- qemu-io-cmds.c | 53

[Qemu-block] [PULL v2 35/40] qemu-iotests: fix -valgrind option for check

2015-11-10 Thread Kevin Wolf
From: Jeff Cody Commit 934659c switched the iotests to run qemu-io from a bash subshell, in order to catch segfaults. This method is incompatible with the current valgrind_qemu_io() bash function. Move the valgrind usage into the exec subshell in _qemu_io_wrapper(), while

[Qemu-block] [PULL v2 37/40] block: Add blk_get_refcnt()

2015-11-10 Thread Kevin Wolf
From: Alberto Garcia This function returns the reference count of a given BlockBackend. For convenience, it returns 0 if the BlockBackend pointer is NULL. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz Message-id:

Re: [Qemu-block] [PATCH v9 11/15] qmp: Introduce blockdev-change-medium

2015-11-10 Thread Kevin Wolf
Am 06.11.2015 um 16:27 hat Max Reitz geschrieben: > Introduce a new QMP command 'blockdev-change-medium' which is intended > to replace the 'change' command for block devices. The existing function > qmp_change_blockdev() is accordingly renamed to > qmp_blockdev_change_medium(). > >

[Qemu-block] [PULL v2 10/40] blockdev: Implement change with basic operations

2015-11-10 Thread Kevin Wolf
From: Max Reitz Implement 'change' on block devices by calling blockdev-open-tray, blockdev-remove-medium, blockdev-insert-medium (a variation of that which does not need a node-name) and blockdev-close-tray. Signed-off-by: Max Reitz Signed-off-by: Kevin

[Qemu-block] [PULL v2 05/40] blockdev: Add blockdev-open-tray

2015-11-10 Thread Kevin Wolf
From: Max Reitz Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- blockdev.c | 36 qapi/block-core.json | 32 qmp-commands.hx | 48

[Qemu-block] [PULL v2 02/40] block: Add blk_remove_bs()

2015-11-10 Thread Kevin Wolf
From: Max Reitz This function removes the BlockDriverState associated with the given BlockBackend from that BB and sets the BDS pointer in the BB to NULL. Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- block/block-backend.c

[Qemu-block] [PULL v2 22/40] commit: reopen overlay_bs before base

2015-11-10 Thread Kevin Wolf
From: Alberto Garcia 'block-commit' needs write access to two different nodes of the chain: - 'base', because that's where the data is written to. - the overlay of 'top', because it needs to update the backing file string to point to 'base' after the operation. Both images

[Qemu-block] [PULL v2 13/40] hmp: Use blockdev-change-medium for change command

2015-11-10 Thread Kevin Wolf
From: Max Reitz Use separate code paths for the two overloaded functions of the 'change' HMP command, and invoke the 'blockdev-change-medium' QMP command if used on a block device (by calling qmp_blockdev_change_medium()). Signed-off-by: Max Reitz

[Qemu-block] [PULL v2 03/40] block: Make bdrv_states public

2015-11-10 Thread Kevin Wolf
From: Max Reitz When inserting a BDS tree into a BB, we will need to add the root BDS to this list. Since we will want to do that in the blockdev-insert-medium implementation in blockdev.c, we will need access to it there. This patch is not exactly elegant, but bdrv_states

[Qemu-block] [PULL v2 00/40] Block layer patches

2015-11-10 Thread Kevin Wolf
The following changes since commit a8b4f9585a0bf5186fca793ce2c5d754cd8ec49a: Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2015-11-10' into staging (2015-11-10 09:39:24 +) are available in the git repository at: git://repo.or.cz/qemu/kevin.git tags/for-upstream for you

[Qemu-block] [PULL v2 11/40] block: Inquire tray state before tray-moved events

2015-11-10 Thread Kevin Wolf
From: Max Reitz blk_dev_change_media_cb() is called for all potential tray movements; however, it is possible to request closing the tray but nothing actually happening (on a floppy disk drive without a medium). Thus, the actual tray status should be inquired before sending a

[Qemu-block] [PULL v2 16/40] iotests: Add test for change-related QMP commands

2015-11-10 Thread Kevin Wolf
From: Max Reitz Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- tests/qemu-iotests/118 | 720 + tests/qemu-iotests/118.out | 5 + tests/qemu-iotests/group | 1 + 3 files

[Qemu-block] [PULL v2 18/40] block: rename BlockdevSnapshot to BlockdevSnapshotSync

2015-11-10 Thread Kevin Wolf
From: Alberto Garcia We will introduce the 'blockdev-snapshot' command that will require its own struct for the parameters, so we need to rename this one in order to avoid name clashes. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake

[Qemu-block] [PULL v2 04/40] block: Add functions for inheriting a BBRS

2015-11-10 Thread Kevin Wolf
From: Max Reitz In order to open a BDS which inherits a BB's root state, blk_get_open_flags_from_root_state() is used to inquire the flags to be passed to bdrv_open(), and blk_apply_root_state() is used to apply the remaining state after the BDS has been opened.

[Qemu-block] [PULL v2 07/40] blockdev: Add blockdev-remove-medium

2015-11-10 Thread Kevin Wolf
From: Max Reitz Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- blockdev.c | 51 +++ qapi/block-core.json | 16 qmp-commands.hx | 45

[Qemu-block] [PULL v2 17/40] block: check for existing device IDs in external_snapshot_prepare()

2015-11-10 Thread Kevin Wolf
From: Alberto Garcia The 'snapshot-node-name' parameter of blockdev-snapshot-sync allows setting the node name of the image that is going to be created. Before creating the image, external_snapshot_prepare() checks that the name is not already being used. The check is however

[Qemu-block] [PULL v2 21/40] block: add tests for the 'blockdev-snapshot' command

2015-11-10 Thread Kevin Wolf
From: Alberto Garcia Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz Reviewed-by: Jeff Cody Signed-off-by: Kevin Wolf --- tests/qemu-iotests/085 | 102

[Qemu-block] [PULL v2 19/40] block: support passing 'backing': '' to 'blockdev-add'

2015-11-10 Thread Kevin Wolf
From: Alberto Garcia Passing an empty string allows opening an image but not its backing file. This was already described in the API documentation, only the implementation was missing. This is useful for creating snapshots using images opened with blockdev-add, since they are

[Qemu-block] [PULL v2 06/40] blockdev: Add blockdev-close-tray

2015-11-10 Thread Kevin Wolf
From: Max Reitz Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- blockdev.c | 23 +++ qapi/block-core.json | 16 qmp-commands.hx | 35

[Qemu-block] [PULL v2 20/40] block: add a 'blockdev-snapshot' QMP command

2015-11-10 Thread Kevin Wolf
From: Alberto Garcia One of the limitations of the 'blockdev-snapshot-sync' command is that it does not allow passing BlockdevOptions to the newly created snapshots, so they are always opened using the default values. Extending the command to allow passing options is not a

[Qemu-block] [PULL v2 23/40] qemu-iotests: Test the reopening of overlay_bs in 'block-commit'

2015-11-10 Thread Kevin Wolf
From: Alberto Garcia The 'block-commit' command needs the overlay image of 'top' to be opened in read-write mode in order to update the backing file string. If 'top' is not the active layer or its backing file then its overlay needs to be reopened during the block job. This is

[Qemu-block] [PULL v2 15/40] hmp: Add read-only-mode option to change command

2015-11-10 Thread Kevin Wolf
From: Max Reitz Expose the new read-only-mode option of 'blockdev-change-medium' for the 'change' HMP command. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- hmp-commands.hx | 20

[Qemu-block] [PULL v2 29/40] block: Remove inner quotation marks in iotest 085

2015-11-10 Thread Kevin Wolf
From: Alberto Garcia This patch removes the inner quotation marks in all cases like this: cmd=" ... "${variable}" ... " Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf ---

[Qemu-block] [PULL v2 26/40] throttle: Check for pending requests in throttle_group_unregister_bs()

2015-11-10 Thread Kevin Wolf
From: Alberto Garcia throttle_group_unregister_bs() removes a BlockDriverState from its throttling group and destroys the timers. This means that there must be no pending throttled requests at that point (because it would be impossible to complete them), so the caller has to

[Qemu-block] [PULL v2 14/40] blockdev: read-only-mode for blockdev-change-medium

2015-11-10 Thread Kevin Wolf
From: Max Reitz Add an option to qmp_blockdev_change_medium() which allows changing the read-only status of the block device whose medium is changed. Some drives do not have a inherently fixed read-only status; for instance, floppy disks can be set read-only or writable

[Qemu-block] [PULL v2 24/40] qcow2: avoid misaligned 64bit bswap

2015-11-10 Thread Kevin Wolf
From: John Snow If we create a buffer directly on the stack by using 12 bytes, there's no guarantee the 64bit value we want to swap will be aligned, which could cause errors with undefined behavior. Spotted with clang -fsanitize=undefined and observed in iotests 15, 26, 44,

[Qemu-block] [PULL v2 27/40] throttle: Use bs->throttle_state instead of bs->io_limits_enabled

2015-11-10 Thread Kevin Wolf
From: Alberto Garcia There are two ways to check for I/O limits in a BlockDriverState: - bs->throttle_state: if this pointer is not NULL, it means that this BDS is member of a throttling group, its ThrottleTimers structure has been initialized and its I/O limits are ready

[Qemu-block] [PULL v2 31/40] qemu-io: fix cvtnum lval types

2015-11-10 Thread Kevin Wolf
From: John Snow cvtnum() returns int64_t: we should not be storing this result inside of an int. In a few cases, we need an extra sprinkling of error handling where we expect to pass this number on towards a function that expects something smaller than int64_t. Reported-by:

[Qemu-block] [PULL v2 30/40] block: test 'blockdev-snapshot' using a file BDS as the overlay

2015-11-10 Thread Kevin Wolf
From: Alberto Garcia This test checks that it is not possible to create a snapshot if the requested overlay node is a BDS which does not support backing images. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake Signed-off-by: Kevin

[Qemu-block] [PULL v2 28/40] block: Disallow snapshots if the overlay doesn't support backing files

2015-11-10 Thread Kevin Wolf
From: Alberto Garcia This addresses scenarios like this one: { 'execute': 'blockdev-add', 'arguments': { 'options': { 'driver': 'qcow2', 'node-name': 'new0', 'file': { 'driver': 'file', 'filename':

[Qemu-block] [PULL v2 25/40] qemu-img: add check for zero-length job len

2015-11-10 Thread Kevin Wolf
From: John Snow The mirror job doesn't update its total length until it has already started running, so we should translate a zero-length job-len as meaning 0%. Otherwise, we may get divide-by-zero faults. Signed-off-by: John Snow Reviewed-by: Jeff Cody

[Qemu-block] [PULL v2 36/40] mirror: block all operations on the target image during the job

2015-11-10 Thread Kevin Wolf
From: Alberto Garcia There's nothing preventing the target image from being used by other operations during the 'drive-mirror' job, so we should block them all until the job is done. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz

Re: [Qemu-block] [PATCH] docs: update bitmaps.md

2015-11-10 Thread Eric Blake
On 11/10/2015 04:00 PM, John Snow wrote: > Include new error handling scenarios for 2.5. > > Signed-off-by: John Snow > --- > docs/bitmaps.md | 157 > > 1 file changed, 157 insertions(+) > > diff --git

Re: [Qemu-block] [PATCH] docs: update bitmaps.md

2015-11-10 Thread John Snow
On 11/10/2015 06:09 PM, Eric Blake wrote: > On 11/10/2015 04:00 PM, John Snow wrote: >> Include new error handling scenarios for 2.5. >> >> Signed-off-by: John Snow >> --- >> docs/bitmaps.md | 157 >> >> 1 file

Re: [Qemu-block] [PATCH v11 00/14] block: incremental backup transactions using BlockJobTxn

2015-11-10 Thread Stefan Hajnoczi
On Thu, Nov 05, 2015 at 06:13:06PM -0500, John Snow wrote: > Welcome to the Incremental Backup Transactions Newsletter! > > What's new? > > I replaced the per-action "transactional-cancel" parameter with > a per-transaction paremeter named "completion-mode" which is implemented > as an enum in

[Qemu-block] [PATCH] nand: fix address overflow

2015-11-10 Thread Rabin Vincent
The shifts of the address mask and value shift beyond 32 bits when there are 5 address cycles. Signed-off-by: Rabin Vincent --- hw/block/nand.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/block/nand.c b/hw/block/nand.c index

[Qemu-block] [PATCH v10 00/15] blockdev: BlockBackend and media

2015-11-10 Thread Max Reitz
I'm sorry for having singlehandedly stalled the block pull request twice now, and I sure hope everything is going to be fine this time. v9 was missing a change to patch 13: While it did (probably?) fix cocoa.m in patch 11 for patch 11, patch 13 changed the signature of the function in question

[Qemu-block] [PATCH v10 13/15] blockdev: read-only-mode for blockdev-change-medium

2015-11-10 Thread Max Reitz
Add an option to qmp_blockdev_change_medium() which allows changing the read-only status of the block device whose medium is changed. Some drives do not have a inherently fixed read-only status; for instance, floppy disks can be set read-only or writable independently of the drive. Some users may