[Qemu-block] [PATCH] virtio: introduce `info virtio' hmp command

2017-09-26 Thread Jan Dakinevich
The command is intended for exposing device specific virtio feature bits and their negotiation status. It is convenient and useful for debug purpose. Names of features are taken from a devices via get_feature_name() within VirtioDeviceClass. If certain device doesn't implement it, the command

Re: [Qemu-block] [Qemu-devel] [PATCH v4 08/23] block: Switch bdrv_co_get_block_status() to byte-based

2017-09-26 Thread John Snow
On 09/13/2017 12:03 PM, Eric Blake wrote: > We are gradually converting to byte-based interfaces, as they are > easier to reason about than sector-based. Convert another internal > function (no semantic change); and as with its public counterpart, > rename to bdrv_co_block_status() to make the

Re: [Qemu-block] [Qemu-devel] [PATCH v4 09/23] block: Switch BdrvCoGetBlockStatusData to byte-based

2017-09-26 Thread John Snow
On 09/13/2017 12:03 PM, Eric Blake wrote: > We are gradually converting to byte-based interfaces, as they are > easier to reason about than sector-based. Convert another internal > type (no semantic change), and rename it to match the corresponding > public function rename. > > Signed-off-by:

Re: [Qemu-block] [Qemu-devel] [PATCH v4 07/23] block: Convert bdrv_get_block_status() to bytes

2017-09-26 Thread Eric Blake
On 09/26/2017 02:39 PM, John Snow wrote: >> -int64_t bdrv_get_block_status(BlockDriverState *bs, >> - int64_t sector_num, >> - int nb_sectors, int *pnum, >> - BlockDriverState **file) >> +int64_t

Re: [Qemu-block] [Qemu-devel] [PATCH v4 07/23] block: Convert bdrv_get_block_status() to bytes

2017-09-26 Thread John Snow
On 09/13/2017 12:03 PM, Eric Blake wrote: > We are gradually moving away from sector-based interfaces, towards > byte-based. In the common case, allocation is unlikely to ever use > values that are not naturally sector-aligned, but it is possible > that byte-based values will let us be more

Re: [Qemu-block] [Qemu-devel] [PATCH v4 03/23] block: Make bdrv_round_to_clusters() signature more useful

2017-09-26 Thread John Snow
On 09/26/2017 03:18 PM, Eric Blake wrote: > On 09/26/2017 01:51 PM, John Snow wrote: >> >> >> On 09/13/2017 12:03 PM, Eric Blake wrote: >>> In the process of converting sector-based interfaces to bytes, >>> I'm finding it easier to represent a byte count as a 64-bit >>> integer at the block

Re: [Qemu-block] [Qemu-devel] [PATCH v4 03/23] block: Make bdrv_round_to_clusters() signature more useful

2017-09-26 Thread Eric Blake
On 09/26/2017 01:51 PM, John Snow wrote: > > > On 09/13/2017 12:03 PM, Eric Blake wrote: >> In the process of converting sector-based interfaces to bytes, >> I'm finding it easier to represent a byte count as a 64-bit >> integer at the block layer (even if we are internally capped >> by SIZE_MAX

Re: [Qemu-block] [Qemu-devel] [PATCH v4 06/23] qemu-img: Switch get_block_status() to byte-based

2017-09-26 Thread John Snow
On 09/13/2017 12:03 PM, Eric Blake wrote: > We are gradually converting to byte-based interfaces, as they are > easier to reason about than sector-based. Continue by converting > an internal function (no semantic change), and simplifying its > caller accordingly. > > Signed-off-by: Eric Blake

Re: [Qemu-block] [Qemu-devel] [PATCH v4 05/23] block: Switch bdrv_make_zero() to byte-based

2017-09-26 Thread John Snow
On 09/13/2017 12:03 PM, Eric Blake wrote: > We are gradually converting to byte-based interfaces, as they are > easier to reason about than sector-based. Change the internal > loop iteration of zeroing a device to track by bytes instead of > sectors (although we are still guaranteed that we

Re: [Qemu-block] blockdev-commit design

2017-09-26 Thread Kevin Wolf
Am 26.09.2017 um 20:29 hat Eric Blake geschrieben: > On 09/26/2017 12:59 PM, Kevin Wolf wrote: > > This was the easy part. Then I started looking at the code and found a > > few a bit more interesting questions: > > > > * The old block-commit command decides between an "actual" commit job > >

Re: [Qemu-block] [Qemu-devel] [PATCH v4 04/23] qcow2: Switch is_zero_sectors() to byte-based

2017-09-26 Thread John Snow
On 09/13/2017 12:03 PM, Eric Blake wrote: > We are gradually converting to byte-based interfaces, as they are > easier to reason about than sector-based. Convert another internal > function (no semantic change), and rename it to is_zero() in the > process. > > Signed-off-by: Eric Blake

Re: [Qemu-block] [Qemu-devel] [PATCH v4 03/23] block: Make bdrv_round_to_clusters() signature more useful

2017-09-26 Thread John Snow
On 09/13/2017 12:03 PM, Eric Blake wrote: > In the process of converting sector-based interfaces to bytes, > I'm finding it easier to represent a byte count as a 64-bit > integer at the block layer (even if we are internally capped > by SIZE_MAX or even INT_MAX for individual transactions, it's

Re: [Qemu-block] [Qemu-devel] [PATCH v4 02/23] block: Add flag to avoid wasted work in bdrv_is_allocated()

2017-09-26 Thread John Snow
On 09/13/2017 12:03 PM, Eric Blake wrote: > Not all callers care about which BDS owns the mapping for a given > range of the file. In particular, bdrv_is_allocated() cares more > about finding the largest run of allocated data from the guest > perspective, whether or not that data is

Re: [Qemu-block] blockdev-commit design

2017-09-26 Thread Eric Blake
On 09/26/2017 12:59 PM, Kevin Wolf wrote: > Hi, > > as the next step after my commit block job fixes, I'm trying to > implement a new, clean version of the QMP command, which I'm calling > blockdev-commit for consistency with all the other "modern" QMP > commands. > > I'll start with the schema

Re: [Qemu-block] [PATCH v2 1/3] nbd-client: avoid read_reply_co entry if send failed

2017-09-26 Thread Eric Blake
CC: qemu-sta...@nongnu.org On 08/29/2017 07:27 AM, Stefan Hajnoczi wrote: > The following segfault is encountered if the NBD server closes the UNIX > domain socket immediately after negotiation: > > Program terminated with signal SIGSEGV, Segmentation fault. ... > Note this only happens with

[Qemu-block] blockdev-commit design

2017-09-26 Thread Kevin Wolf
Hi, as the next step after my commit block job fixes, I'm trying to implement a new, clean version of the QMP command, which I'm calling blockdev-commit for consistency with all the other "modern" QMP commands. I'll start with the schema that I have so far: { 'command': 'blockdev-commit',

Re: [Qemu-block] [PATCH 2/5] commit: Support multiple roots above top node

2017-09-26 Thread Kevin Wolf
Am 25.09.2017 um 21:38 hat Eric Blake geschrieben: > On 09/25/2017 07:28 AM, Kevin Wolf wrote: > > This changes the commit block job to support operation in a graph where > > there is more than a single active layer that references the top node. > > > > This involves inserting the commit filter

Re: [Qemu-block] [PATCH] virtio: introduce `info virtio' hmp command

2017-09-26 Thread Kevin Wolf
Am 26.09.2017 um 18:13 hat Jan Dakinevich geschrieben: > The command is intended for exposing device specific virtio feature bits > and their negotiation status. It is convenient and useful for debug > purpose. > > Names of features are taken from a devices via get_feature_name() within >

Re: [Qemu-block] [Qemu-devel] [PULL 08/24] iotests: Print full path of bad output if mismatch

2017-09-26 Thread Kevin Wolf
Am 26.09.2017 um 16:56 hat Eric Blake geschrieben: > On 09/26/2017 09:21 AM, Kevin Wolf wrote: > > From: Fam Zheng > > > > So it is easier to copy paste the path. > > > > Signed-off-by: Fam Zheng > > Signed-off-by: Kevin Wolf > > --- > >

Re: [Qemu-block] [Qemu-devel] [PULL 08/24] iotests: Print full path of bad output if mismatch

2017-09-26 Thread Eric Blake
On 09/26/2017 09:21 AM, Kevin Wolf wrote: > From: Fam Zheng > > So it is easier to copy paste the path. > > Signed-off-by: Fam Zheng > Signed-off-by: Kevin Wolf > --- > tests/qemu-iotests/check | 2 +- > 1 file changed, 1 insertion(+), 1

[Qemu-block] [PULL 23/24] qemu-iotests: add shrinking image test

2017-09-26 Thread Kevin Wolf
From: Pavel Butsykin Signed-off-by: Pavel Butsykin Reviewed-by: Max Reitz Reviewed-by: John Snow Message-id: 20170918124230.8152-5-pbutsy...@virtuozzo.com Signed-off-by: Max Reitz ---

Re: [Qemu-block] qemu-img: Check failed: No space left on device

2017-09-26 Thread Nicolas Ecarnot
Le 21/09/2017 à 16:31, Stefan Hajnoczi a écrit : On Tue, Sep 19, 2017 at 12:09:06PM +0200, Nicolas Ecarnot wrote: Hello, First post here, so maybe I should introduce myself : - I'm a sysadmin for decades and currently managing 4 oVirt clusters, made out of tens of hypervisors, all are CentOS

[Qemu-block] [PULL 14/24] block: Add reopen queue to bdrv_check_perm()

2017-09-26 Thread Kevin Wolf
In the context of bdrv_reopen(), we'll have to look at the state of the graph as it will be after the reopen. This interface addition is in preparation for the change. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block.c | 34

[Qemu-block] [PULL 16/24] block: reopen: Queue children after their parents

2017-09-26 Thread Kevin Wolf
We will calculate the required new permissions in the prepare stage of a reopen. Required permissions of children can be influenced by the changes made to their parents, but parents are independent from their children. This means that permissions need to be calculated top-down. In order to achieve

[Qemu-block] [PULL 22/24] qcow2: add shrink image support

2017-09-26 Thread Kevin Wolf
From: Pavel Butsykin This patch add shrinking of the image file for qcow2. As a result, this allows us to reduce the virtual image size and free up space on the disk without copying the image. Image can be fragmented and shrink is done by punching holes in the image

[Qemu-block] [PULL 19/24] iotests: fix 181: enable postcopy-ram capability on target

2017-09-26 Thread Kevin Wolf
From: Vladimir Sementsov-Ogievskiy Migration capabilities should be enabled on both source and destination qemu processes. Signed-off-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Kevin Wolf --- tests/qemu-iotests/181

[Qemu-block] [PULL 17/24] block: Fix permissions after bdrv_reopen()

2017-09-26 Thread Kevin Wolf
If we switch between read-only and read-write, the permissions that image format drivers need on bs->file change, too. Make sure to update the permissions during bdrv_reopen(). Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- include/block/block.h | 1

[Qemu-block] [PULL 21/24] qcow2: add qcow2_cache_discard

2017-09-26 Thread Kevin Wolf
From: Pavel Butsykin Whenever l2/refcount table clusters are discarded from the file we can automatically drop unnecessary content of the cache tables. This reduces the chance of eviction useful cache data and eliminates inconsistent data in the cache with the data in

[Qemu-block] [PULL 24/24] block/qcow2-bitmap: fix use of uninitialized pointer

2017-09-26 Thread Kevin Wolf
From: Vladimir Sementsov-Ogievskiy Without initialization to zero dirty_bitmap field may be not zero for a bitmap which should not be stored and qcow2_store_persistent_dirty_bitmaps will erroneously call store_bitmap for it which leads to SIGSEGV on

[Qemu-block] [PULL 20/24] qemu-img: add --shrink flag for resize

2017-09-26 Thread Kevin Wolf
From: Pavel Butsykin The flag is additional precaution against data loss. Perhaps in the future the operation shrink without this flag will be blocked for all formats, but for now we need to maintain compatibility with raw. Signed-off-by: Pavel Butsykin

[Qemu-block] [PULL 15/24] block: Base permissions on rw state after reopen

2017-09-26 Thread Kevin Wolf
When new permissions are calculated during bdrv_reopen(), they need to be based on the state of the graph as it will be after the reopen has completed, not on the current state of the involved nodes. This patch makes bdrv_is_writable() optionally accept a BlockReopenQueue from which the new flags

[Qemu-block] [PULL 18/24] qemu-iotests: Test change-backing-file command

2017-09-26 Thread Kevin Wolf
This involves a temporary read-write reopen if the backing file link in the middle of a backing file chain should be changed and is therefore a good test for the latest bdrv_reopen() vs. op blockers fixes. Signed-off-by: Kevin Wolf --- tests/qemu-iotests/195 | 92

[Qemu-block] [PULL 06/24] iotests: use -ccw on s390x for 051

2017-09-26 Thread Kevin Wolf
From: Cornelia Huck The default cpu model on s390x does not provide zPCI, which is not yet wired up on tcg. Moreover, virtio-ccw is the standard on s390x, so use the -ccw instead of the -pci versions of virtio devices on s390x. Signed-off-by: Cornelia Huck

[Qemu-block] [PULL 09/24] throttle: Assert that bkt->max is valid in throttle_compute_wait()

2017-09-26 Thread Kevin Wolf
From: Alberto Garcia If bkt->max == 0 and bkt->burst_length > 1 then we could have a division by 0 in throttle_do_compute_wait(). That configuration is however not permitted and is already detected by throttle_is_valid(), but let's assert it in throttle_compute_wait() to make

[Qemu-block] [PULL 11/24] block: Clean up some bad code in the vvfat driver

2017-09-26 Thread Kevin Wolf
From: Thomas Huth Remove the unnecessary home-grown redefinition of the assert() macro here, and remove the unusable debug code at the end of the checkpoint() function. The code there uses assert() with side-effects (assignment to the "mapping" variable), which should be

[Qemu-block] [PULL 07/24] iotests: use virtio aliases for 067

2017-09-26 Thread Kevin Wolf
From: Cornelia Huck The default cpu model on s390x does not provide zPCI, which is not yet wired up on tcg. Moreover, virtio-ccw is the standard on s390x. Using virtio-scsi will implicitly pick the right device, so just switch to that for simplicity. Signed-off-by: Cornelia

[Qemu-block] [PULL 08/24] iotests: Print full path of bad output if mismatch

2017-09-26 Thread Kevin Wolf
From: Fam Zheng So it is easier to copy paste the path. Signed-off-by: Fam Zheng Signed-off-by: Kevin Wolf --- tests/qemu-iotests/check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/check

[Qemu-block] [PULL 12/24] qemu-io: Drop write permissions before read-only reopen

2017-09-26 Thread Kevin Wolf
qemu-io provides a 'reopen' command that allows switching from writable to read-only access. We need to make sure that we don't try to keep write permissions to a BlockBackend that becomes read-only, otherwise things are going to fail. This requires a bdrv_drain() call because otherwise in-flight

[Qemu-block] [PULL 10/24] block/throttle-groups.c: allocate RestartData on the heap

2017-09-26 Thread Kevin Wolf
From: Manos Pitsidianakis RestartData is the opaque data of the throttle_group_restart_queue_entry coroutine. By being stack allocated, it isn't available anymore if aio_co_enter schedules the coroutine with a bottom half and runs after throttle_group_restart_queue returns.

[Qemu-block] [PULL 05/24] iotests: use -ccw on s390x for 040, 139, and 182

2017-09-26 Thread Kevin Wolf
From: Cornelia Huck The default cpu model on s390x does not provide zPCI, which is not yet wired up on tcg. Moreover, virtio-ccw is the standard on s390x, so use the -ccw instead of the -pci versions of virtio devices on s390x. Reviewed-by: Kevin Wolf

[Qemu-block] [PULL 04/24] docs: add qemu-block-drivers(7) man page

2017-09-26 Thread Kevin Wolf
From: Stefan Hajnoczi Block driver documentation is available in qemu-doc.html. It would be convenient to have documentation for formats, protocols, and filter drivers in a man page. Extract the relevant part of qemu-doc.html into a new file called

[Qemu-block] [PULL 13/24] block: Add reopen_queue to bdrv_child_perm()

2017-09-26 Thread Kevin Wolf
In the context of bdrv_reopen(), we'll have to look at the state of the graph as it will be after the reopen. This interface addition is in preparation for the change. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- include/block/block_int.h | 7

[Qemu-block] [PULL 02/24] qemu-img: Clarify about relative backing file options

2017-09-26 Thread Kevin Wolf
From: Fam Zheng It's not too surprising when a user specifies the backing file relative to the current working directory instead of the top layer image. This causes error when they differ. Though the error message has enough information to infer the fact about the

[Qemu-block] [PULL 03/24] file-posix: Clear out first sector in hdev_create

2017-09-26 Thread Kevin Wolf
From: Fam Zheng People get surprised when, after "qemu-img create -f raw /dev/sdX", they still see qcow2 with "qemu-img info", if previously the bdev had a qcow2 header. While this is natural because raw doesn't need to write any magic bytes during creation, hdev_create is free

[Qemu-block] [PULL 01/24] qemu-iotests: Add missing -machine accel=qtest

2017-09-26 Thread Kevin Wolf
A basic set of qemu options is initialised in ./common: export QEMU_OPTIONS="-nodefaults -machine accel=qtest" However, two test cases (172 and 186) overwrite QEMU_OPTIONS and neglect to manually set '-machine accel=qtest'. Add the missing option for 172. 186 probably only copied the code

[Qemu-block] [PULL 00/24] Block layer patches

2017-09-26 Thread Kevin Wolf
The following changes since commit 1e3ee834083227f552179f6e43902cba5a866e6b: Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging (2017-09-25 20:31:24 +0100) are available in the git repository at: git://repo.or.cz/qemu/kevin.git tags/for-upstream for you to

Re: [Qemu-block] [Qemu-devel] [PATCH v1 2/8] tests: Replace fprintf(stderr, "*\n" with error_report()

2017-09-26 Thread Eric Blake
On 09/25/2017 07:55 PM, Emilio G. Cota wrote: >> diff --git a/tests/check-qlit b/tests/check-qlit >> new file mode 100755 >> index >> ..950429524e3eb07e6daed1fe01caad0f5d554809 >> GIT binary patch >> literal 272776 >>

Re: [Qemu-block] [Qemu-devel] [PATCH v1 1/8] Replace all occurances of __FUNCTION__ with __func__

2017-09-26 Thread Eric Blake
On 09/25/2017 07:08 PM, Alistair Francis wrote: > Replace all occurs of __FUNCTION__ except for the check in checkpatch > with the non GCC specific __func__. > > One line in hcd-musb.c was manually tweaked to pass checkpatch. > > Signed-off-by: Alistair Francis >

Re: [Qemu-block] [PATCH v3 0/3] add bdrv_co_drain_begin/end BlockDriver callbacks

2017-09-26 Thread Manos Pitsidianakis
On Tue, Sep 26, 2017 at 12:00:24PM +0100, Stefan Hajnoczi wrote: On Sat, Sep 23, 2017 at 02:14:08PM +0300, Manos Pitsidianakis wrote: This patch series renames bdrv_co_drain to bdrv_co_drain_begin and adds a new bdrv_co_drain_end callback to match bdrv_drained_begin/end and drained_begin/end of

Re: [Qemu-block] ping Re: [PATCH v7 03/16] migration: split common postcopy out of ram postcopy

2017-09-26 Thread Kevin Wolf
Am 26.09.2017 um 12:21 hat Dr. David Alan Gilbert geschrieben: > * Kevin Wolf (kw...@redhat.com) wrote: > > Am 25.09.2017 um 17:27 hat Dr. David Alan Gilbert geschrieben: > > > > > Whatever you think the preferred way to set up postcopy migration is: > > > > > If > > > > > something worked before

Re: [Qemu-block] [PATCH v3 0/3] add bdrv_co_drain_begin/end BlockDriver callbacks

2017-09-26 Thread Stefan Hajnoczi
On Sat, Sep 23, 2017 at 02:14:08PM +0300, Manos Pitsidianakis wrote: > This patch series renames bdrv_co_drain to bdrv_co_drain_begin and adds a new > bdrv_co_drain_end callback to match bdrv_drained_begin/end and > drained_begin/end of BdrvChild. This is needed because the throttle driver >

Re: [Qemu-block] ping Re: [PATCH v7 03/16] migration: split common postcopy out of ram postcopy

2017-09-26 Thread Dr. David Alan Gilbert
* Kevin Wolf (kw...@redhat.com) wrote: > Am 25.09.2017 um 17:27 hat Dr. David Alan Gilbert geschrieben: > > > > Whatever you think the preferred way to set up postcopy migration is: If > > > > something worked before this patch and doesn't after it, that's a > > > > regression and breaks backwards

Re: [Qemu-block] ping Re: [PATCH v7 03/16] migration: split common postcopy out of ram postcopy

2017-09-26 Thread Kevin Wolf
Am 25.09.2017 um 17:27 hat Dr. David Alan Gilbert geschrieben: > > > Whatever you think the preferred way to set up postcopy migration is: If > > > something worked before this patch and doesn't after it, that's a > > > regression and breaks backwards compatibility. > > > > > > If we were talking

Re: [Qemu-block] [PATCH v3 0/3] add bdrv_co_drain_begin/end BlockDriver callbacks

2017-09-26 Thread Stefan Hajnoczi
On Sat, Sep 23, 2017 at 02:14:08PM +0300, Manos Pitsidianakis wrote: > This patch series renames bdrv_co_drain to bdrv_co_drain_begin and adds a new > bdrv_co_drain_end callback to match bdrv_drained_begin/end and > drained_begin/end of BdrvChild. This is needed because the throttle driver >

Re: [Qemu-block] [PATCH 0/5] commit: Support multiple roots above top node

2017-09-26 Thread Kevin Wolf
Am 25.09.2017 um 22:02 hat John Snow geschrieben: > On 09/25/2017 08:28 AM, Kevin Wolf wrote: > > This is a step towards making the commit job flexible enough that it can > > work with any kind of block graph. Currently, it requires that not only > > the top and base node of the commit operation