[Qemu-block] [PATCH] qemu-img: add the 'dd' subcommand

2016-07-13 Thread Reda Sallahi
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

[Qemu-block] [PATCH v9 11/17] block: Simplify drive-mirror

2016-07-13 Thread Eric Blake
Now that we can support boxed commands, use it to greatly reduce the number of parameters (and likelihood of getting out of sync) when adjusting drive-mirror parameters. Signed-off-by: Eric Blake Reviewed-by: John Snow --- v9: s/box/boxed/, trivial enough

[Qemu-block] [PATCH v9 10/17] block: Simplify block_set_io_throttle

2016-07-13 Thread Eric Blake
Now that we can support boxed commands, use it to greatly reduce the number of parameters (and likelihood of getting out of sync) when adjusting throttle parameters. Signed-off-by: Eric Blake Reviewed-by: Alberto Garcia --- v9: s/box/boxed/, trivial enough

Re: [Qemu-block] [PATCH v5 02/10] HBitmap: Introduce "meta" bitmap to track bit changes

2016-07-13 Thread John Snow
On 06/22/2016 11:22 AM, Max Reitz wrote: > On 03.06.2016 06:32, Fam Zheng wrote: >> Upon each bit toggle, the corresponding bit in the meta bitmap will be >> set. >> >> Signed-off-by: Fam Zheng >> Reviewed-by: John Snow >> --- >> block/dirty-bitmap.c | 2

Re: [Qemu-block] [PATCH 3/3] iotests: Test format probes

2016-07-13 Thread Colin Lord
On 07/12/2016 05:17 PM, John Snow wrote: > > > On 07/11/2016 03:50 PM, Colin Lord wrote: >> Adds a new iotest for testing that the format probing functions work as >> expected. This is done by booting up a vm with a disk image without >> specifying the image format. Then the format is checked

Re: [Qemu-block] [PATCH for 2.7 resend] linux-aio: share one LinuxAioState within an AioContext

2016-07-13 Thread Paolo Bonzini
Ping. On 04/07/2016 18:33, Paolo Bonzini wrote: > This has better performance because it executes fewer system calls > and does not use a bottom half per disk. > > Originally proposed by Ming Lei. > > Acked-by: Stefan Hajnoczi > Signed-off-by: Paolo Bonzini

[Qemu-block] [PULL v2 33/34] vvfat: Fix qcow write target driver specification

2016-07-13 Thread Kevin Wolf
From: Max Reitz First, bdrv_open_child() expects all options for the child to be prefixed by the child's name (and a separating dot). Second, bdrv_open_child() does not take ownership of the QDict passed to it but only extracts all options for the child, so if a QDict is

[Qemu-block] [PULL v2 30/34] qemu-iotests: Test naming of throttling groups

2016-07-13 Thread Kevin Wolf
From: Alberto Garcia Throttling groups are named using the 'group' parameter of the block_set_io_throttle command and the throttling.group command-line option. If that parameter is unspecified the groups get the name of the block device. This patch adds a new test to check the

[Qemu-block] [PULL v2 27/34] Improve block job rate limiting for small bandwidth values

2016-07-13 Thread Kevin Wolf
From: Sascha Silbe ratelimit_calculate_delay() previously reset the accounting every time slice, no matter how much data had been processed before. This had (at least) two consequences: 1. The minimum speed is rather large, e.g. 5 MiB/s for commit and stream. Not

[Qemu-block] [PULL v2 31/34] hmp: use snapshot name to determine whether a snapshot is 'fully available'

2016-07-13 Thread Kevin Wolf
From: Lin Ma Currently qemu uses snapshot id to determine whether a snapshot is fully available, It causes incorrect output in some scenario. For instance: (qemu) info block drive_image1 (#block113): /opt/vms/SLES12-SP1-JeOS-x86_64-GM/disk0.qcow2 (qcow2) Cache mode:

[Qemu-block] [PULL v2 25/34] qemu-io: Use correct range limitations

2016-07-13 Thread Kevin Wolf
From: Max Reitz create_iovec() has a comment lamenting the lack of SIZE_T_MAX. Since there actually is a SIZE_MAX, use it. Two places use INT_MAX for checking the upper bound of a sector count that is used as an argument for a blk_*() function (blk_discard() and

[Qemu-block] [PULL v2 23/34] qemu-img: Use strerror() for generic resize error

2016-07-13 Thread Kevin Wolf
From: Max Reitz Emitting the plain error number is not very helpful. Use strerror() instead. Signed-off-by: Max Reitz Message-id: 20160615153630.2116-2-mre...@redhat.com Reviewed-by: Eric Blake Signed-off-by: Max Reitz

[Qemu-block] [PULL v2 34/34] iotests: Make 157 actually format-agnostic

2016-07-13 Thread Kevin Wolf
From: Max Reitz iotest 157 pretends not to care about the image format used, but in fact it does due to the format name not being filtered in its output. This patch adds filtering and changes the reference output accordingly. Signed-off-by: Max Reitz

[Qemu-block] [PULL v2 24/34] qcow2: Avoid making the L1 table too big

2016-07-13 Thread Kevin Wolf
From: Max Reitz We refuse to open images whose L1 table we deem "too big". Consequently, we should not produce such images ourselves. Cc: qemu-sta...@nongnu.org Signed-off-by: Max Reitz Message-id: 20160615153630.2116-3-mre...@redhat.com Reviewed-by: Eric

[Qemu-block] [PULL v2 26/34] qcow2: Fix qcow2_get_cluster_offset()

2016-07-13 Thread Kevin Wolf
From: Max Reitz Recently, qcow2_get_cluster_offset() has been changed to work with bytes instead of sectors. This invalidated some assertions and introduced a possible integer multiplication overflow. This could be reproduced using e.g. $ qemu-img create -f qcow2 -o

[Qemu-block] [PULL v2 20/34] block/qdev: Allow configuring rerror/werror with qdev properties

2016-07-13 Thread Kevin Wolf
The rerror/werror policies are implemented in the devices, so that's where they should be configured. In comparison to the old options in -drive, the qdev properties are only added to those devices that actually support them. If the option isn't given (or "auto" is specified), the setting of the

[Qemu-block] [PULL v2 16/34] coroutine: move entry argument to qemu_coroutine_create

2016-07-13 Thread Kevin Wolf
From: Paolo Bonzini In practice the entry argument is always known at creation time, and it is confusing that sometimes qemu_coroutine_enter is used with a non-NULL argument to re-enter a coroutine (this happens in block/sheepdog.c and tests/test-coroutine.c). So pass the

[Qemu-block] [PULL v2 29/34] blockdev: Fix regression with the default naming of throttling groups

2016-07-13 Thread Kevin Wolf
From: Alberto Garcia When I/O limits are set for a block device, the name of the throttling group is taken from the BlockBackend if the user doesn't specify one. Commit efaa7c4eeb7490c6f37f3 moved the naming of the BlockBackend in blockdev_init() to the end of the function,

[Qemu-block] [PULL v2 32/34] hmp: show all of snapshot info on every block dev in output of 'info snapshots'

2016-07-13 Thread Kevin Wolf
From: Lin Ma Currently, the output of 'info snapshots' shows fully available snapshots. It's opaque, hides some snapshot information to users. It's not convenient if users want to know more about all of snapshot information on every block device via monitor. Follow Kevin's and

[Qemu-block] [PULL v2 28/34] vmdk: fix metadata write regression

2016-07-13 Thread Kevin Wolf
From: Reda Sallahi Commit "cdeaf1f vmdk: add bdrv_co_write_zeroes" causes a regression on writes. It writes metadata after every write instead of doing it only once for each cluster. vmdk_pwritev() writes metadata whenever m_data is set as valid so this patch sets m_data as

[Qemu-block] [PULL v2 14/34] coroutine: use QSIMPLEQ instead of QTAILQ

2016-07-13 Thread Kevin Wolf
From: Paolo Bonzini CoQueue do not need to remove any element but the head of the list; processing is always strictly FIFO. Therefore, the simpler singly-linked QSIMPLEQ can be used instead. Reviewed-by: Stefan Hajnoczi Signed-off-by: Paolo Bonzini

[Qemu-block] [PULL v2 11/34] blockjob: Update description of the 'device' field in the QMP API

2016-07-13 Thread Kevin Wolf
From: Alberto Garcia The 'device' field in all BLOCK_JOB_* events and 'block-job-*' command is no longer the device name, but the ID of the job. This patch updates the documentation to clarify that. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz

[Qemu-block] [PULL v2 15/34] test-coroutine: prepare for the next patch

2016-07-13 Thread Kevin Wolf
From: Paolo Bonzini The next patch moves the coroutine argument from first-enter to creation time. In this case, coroutine has not been initialized yet when the coroutine is created, so change to a pointer. Signed-off-by: Paolo Bonzini Reviewed-by:

[Qemu-block] [PULL v2 22/34] block: Remove BB options from blockdev-add

2016-07-13 Thread Kevin Wolf
werror/rerror are now available as qdev options. The stats-* options are removed without an existing replacement; they should probably be configurable with a separate QMP command like I/O throttling settings. Removing id is left for another day because this involves updating qemu-iotests cases to

[Qemu-block] [PULL v2 17/34] block/qdev: Allow node name for drive properties

2016-07-13 Thread Kevin Wolf
If a node name instead of a BlockBackend name is specified as the driver for a guest device, an anonymous BlockBackend is created now. The order of operations in release_drive() must be reversed in order to avoid a use-after-free bug because now blk_detach_dev() frees the last reference if an

[Qemu-block] [PULL v2 19/34] commit: Fix use of error handling policy

2016-07-13 Thread Kevin Wolf
Commit implemented the 'enospc' policy as 'ignore' if the error was not ENOSPC. The QAPI documentation promises that it's treated as 'stop'. Using the common block job error handling function fixes this and also adds the missing QMP event. Signed-off-by: Kevin Wolf Reviewed-by:

[Qemu-block] [PULL v2 10/34] qemu-img: Set the ID of the block job in img_commit()

2016-07-13 Thread Kevin Wolf
From: Alberto Garcia img_commit() creates a block job without an ID. This is no longer allowed now that we require it to be unique and well-formed. We were solving this by having a fallback in block_job_create(), but now that we extended the API of commit_active_start() we can

[Qemu-block] [PULL v2 18/34] block/qdev: Allow configuring WCE with qdev properties

2016-07-13 Thread Kevin Wolf
As cache.writeback is a BlockBackend property and as such more related to the guest device than the BlockDriverState, we already removed it from the blockdev-add interface. This patch adds the new way to set it, as a qdev property of the corresponding guest device. For example: -drive

[Qemu-block] [PULL v2 13/34] raw-posix: Use qemu_dup

2016-07-13 Thread Kevin Wolf
From: Fam Zheng Signed-off-by: Fam Zheng Reviewed-by: Max Reitz Reviewed-by: Kevin Wolf Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- block/raw-posix.c | 10 +- 1 file

[Qemu-block] [PULL v2 12/34] osdep: Introduce qemu_dup

2016-07-13 Thread Kevin Wolf
From: Fam Zheng And use it in qemu_dup_flags. Signed-off-by: Fam Zheng Reviewed-by: Eric Blake Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- include/qemu/osdep.h | 3 +++ util/osdep.c |

[Qemu-block] [PULL v2 08/34] stream: Add 'job-id' parameter to 'block-stream'

2016-07-13 Thread Kevin Wolf
From: Alberto Garcia This patch adds a new optional 'job-id' parameter to 'block-stream', allowing the user to specify the ID of the block job to be created. The HMP 'block_stream' command remains unchanged. Signed-off-by: Alberto Garcia Reviewed-by: Kevin

[Qemu-block] [PULL v2 06/34] mirror: Add 'job-id' parameter to 'blockdev-mirror' and 'drive-mirror'

2016-07-13 Thread Kevin Wolf
From: Alberto Garcia This patch adds a new optional 'job-id' parameter to 'blockdev-mirror' and 'drive-mirror', allowing the user to specify the ID of the block job to be created. The HMP 'drive_mirror' command remains unchanged. Signed-off-by: Alberto Garcia

[Qemu-block] [PULL v2 05/34] blockjob: Add 'job_id' parameter to block_job_create()

2016-07-13 Thread Kevin Wolf
From: Alberto Garcia When a new job is created, the job ID is taken from the device name of the BDS. This patch adds a new 'job_id' parameter to let the caller provide one instead. This patch also verifies that the ID is always unique and well-formed. This causes problems in a

[Qemu-block] [PULL v2 09/34] commit: Add 'job-id' parameter to 'block-commit'

2016-07-13 Thread Kevin Wolf
From: Alberto Garcia This patch adds a new optional 'job-id' parameter to 'block-commit', allowing the user to specify the ID of the block job to be created. Signed-off-by: Alberto Garcia Reviewed-by: Kevin Wolf Reviewed-by: Max Reitz

[Qemu-block] [PULL v2 07/34] backup: Add 'job-id' parameter to 'blockdev-backup' and 'drive-backup'

2016-07-13 Thread Kevin Wolf
From: Alberto Garcia This patch adds a new optional 'job-id' parameter to 'blockdev-backup' and 'drive-backup', allowing the user to specify the ID of the block job to be created. The HMP 'drive_backup' command remains unchanged. Signed-off-by: Alberto Garcia

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

2016-07-13 Thread Kevin Wolf
The following changes since commit ca3d87d4c84032f19478010b5604cac88b045c25: Merge remote-tracking branch 'remotes/armbru/tags/pull-include-2016-07-12' into staging (2016-07-12 16:04:36 +0100) are available in the git repository at: git://repo.or.cz/qemu/kevin.git tags/for-upstream for

[Qemu-block] [PULL v2 04/34] block: Use block_job_get() in find_block_job()

2016-07-13 Thread Kevin Wolf
From: Alberto Garcia find_block_job() looks for a block backend with a specified name, checks whether it has a block job and acquires its AioContext. We want to identify jobs by their ID and not by the block backend they're attached to, so this patch ignores the backends

[Qemu-block] [PULL v2 02/34] blockjob: Update description of the 'id' field

2016-07-13 Thread Kevin Wolf
From: Alberto Garcia The 'id' field of the BlockJob structure will be able to hold any ID, not only a device name. This patch updates the description of that field and the error messages where it is being used. Soon we'll add the ability to set an arbitrary ID when creating a

[Qemu-block] [PULL v2 01/34] stream: Fix prototype of stream_start()

2016-07-13 Thread Kevin Wolf
From: Alberto Garcia 'stream-start' has a parameter called 'backing-file', which is the string to be written to bs->backing when the job finishes. In the stream_start() implementation it is called 'backing_file_str', but it the prototype in the header file it is called

[Qemu-block] [PULL v2 03/34] blockjob: Add block_job_get()

2016-07-13 Thread Kevin Wolf
From: Alberto Garcia Currently the way to look for a specific block job is to iterate the list manually using block_job_next(). Since we want to be able to identify a job primarily by its ID it makes sense to have a function that does just that. Signed-off-by: Alberto Garcia

[Qemu-block] [PATCH v4 1/6] block/qdev: Allow node name for drive properties

2016-07-13 Thread Kevin Wolf
If a node name instead of a BlockBackend name is specified as the driver for a guest device, an anonymous BlockBackend is created now. The order of operations in release_drive() must be reversed in order to avoid a use-after-free bug because now blk_detach_dev() frees the last reference if an

Re: [Qemu-block] [Qemu-devel] [PATCH v5 01/10] block: Hide HBitmap in block dirty bitmap interface

2016-07-13 Thread Max Reitz
On 13.07.2016 09:57, Vladimir Sementsov-Ogievskiy wrote: > On 13.07.2016 01:49, John Snow wrote: >> >> On 06/03/2016 12:32 AM, Fam Zheng wrote: >>> HBitmap is an implementation detail of block dirty bitmap that should >>> be hidden >>> from users. Introduce a BdrvDirtyBitmapIter to encapsulate the

Re: [Qemu-block] [PATCH v3 01/11] block: Accept node-name for block-stream

2016-07-13 Thread Kevin Wolf
Am 07.07.2016 um 16:17 hat Kevin Wolf geschrieben: > Am 07.07.2016 um 14:59 hat Alberto Garcia geschrieben: > > On Thu 07 Jul 2016 02:11:27 PM CEST, Kevin Wolf wrote: > > > In order to remove the necessity to use BlockBackend names in the > > > external API, we want to allow node-names everywhere.

Re: [Qemu-block] [PATCH 1/1] mirror: double performance of the bulk stage if the disc is full

2016-07-13 Thread Vladimir Sementsov-Ogievskiy
On 12.07.2016 16:51, Kevin Wolf wrote: Am 12.07.2016 um 11:36 hat Denis V. Lunev geschrieben: From: Vladimir Sementsov-Ogievskiy Mirror can do up to 16 in-flight requests, but actually on full copy (the whole source disk is non-zero) in-flight is always 1. This

Re: [Qemu-block] [Qemu-devel] [PATCH v5 01/10] block: Hide HBitmap in block dirty bitmap interface

2016-07-13 Thread Vladimir Sementsov-Ogievskiy
On 13.07.2016 01:49, John Snow wrote: On 06/03/2016 12:32 AM, Fam Zheng wrote: HBitmap is an implementation detail of block dirty bitmap that should be hidden from users. Introduce a BdrvDirtyBitmapIter to encapsulate the underlying HBitmapIter. A small difference in the interface is, before,

Re: [Qemu-block] [Qemu-devel] [PATCH] build: Work around SIZE_MAX bug in OSX headers

2016-07-13 Thread Markus Armbruster
Peter Maydell writes: > On 12 July 2016 at 19:23, Eric Blake wrote: >> This violates POSIX, which requires that: >> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdint.h.html#tag_13_48 >> "Each instance of these macros shall be replaced