Re: [Qemu-block] [RFC PATCH 7/7] block/qdev: Allow configuring WCE with qdev properties

2016-06-24 Thread Eric Blake
On 06/23/2016 08:36 AM, Kevin Wolf wrote: > 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

Re: [Qemu-block] [RFC PATCH 6/7] block: Accept node-name for block-stream

2016-06-24 Thread Eric Blake
On 06/23/2016 08:36 AM, Kevin Wolf wrote: > In order to remove the necessity to use BlockBackend names in the > external API, we want to allow node-names everywhere. This is an example > conversion that accepts a node-name without lifting the restriction that > we're operating at a root node.

Re: [Qemu-block] [RFC PATCH 5/7] block: Accept device model name for blockdev-open/close-tray

2016-06-24 Thread Eric Blake
On 06/23/2016 08:36 AM, Kevin Wolf wrote: > This is an example conversion of a QMP command that operates on the > BlockBackend level to accept both the device model name (which is > supposed to become the primary interface) and the BlockBackend name. > > Naming suggestions for the new QMP field

Re: [Qemu-block] [RFC PATCH 4/7] qdev-monitor: Add blk_by_qdev_id()

2016-06-24 Thread Eric Blake
On 06/23/2016 08:36 AM, Kevin Wolf wrote: > This finds the BlockBackend attached to the device model identified by > its qdev ID. > > Signed-off-by: Kevin Wolf > --- > include/sysemu/block-backend.h | 1 + > qdev-monitor.c | 18 ++ > 2 files

Re: [Qemu-block] [Qemu-devel] [PATCH 1/3] block: ignore flush requests when storage is clean

2016-06-24 Thread Evgeny Yakovlev
On 24.06.2016 18:31, Eric Blake wrote: On 06/24/2016 09:06 AM, Denis V. Lunev wrote: From: Evgeny Yakovlev Some guests (win2008 server for example) do a lot of unnecessary flushing when underlying media has not changed. This adds additional overhead on host when

Re: [Qemu-block] [RFC PATCH 1/7] block/qdev: Allow node name for drive properties

2016-06-24 Thread Kevin Wolf
Am 24.06.2016 um 19:35 hat Eric Blake geschrieben: > On 06/23/2016 08:36 AM, Kevin Wolf wrote: > > If a node name instead of a BlockBackend name is specified as the driver > > for a guest device, an anonymous BlockBackend is created now. > > > > Signed-off-by: Kevin Wolf > >

Re: [Qemu-block] [RFC PATCH 3/7] qdev-monitor: Factor out find_device_state()

2016-06-24 Thread Eric Blake
On 06/23/2016 08:36 AM, Kevin Wolf wrote: > Signed-off-by: Kevin Wolf > --- > qdev-monitor.c | 16 > 1 file changed, 12 insertions(+), 4 deletions(-) Reviewed-by: Eric Blake -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt

Re: [Qemu-block] [RFC PATCH 2/7] block: Add blk_by_dev()

2016-06-24 Thread Eric Blake
On 06/23/2016 08:36 AM, Kevin Wolf wrote: > This finds a BlockBackend given the device model that is attached to it. > > Signed-off-by: Kevin Wolf > --- > block/block-backend.c | 19 +++ > include/sysemu/block-backend.h | 1 + > 2 files changed, 20

Re: [Qemu-block] [RFC PATCH 1/7] block/qdev: Allow node name for drive properties

2016-06-24 Thread Eric Blake
On 06/23/2016 08:36 AM, Kevin Wolf wrote: > If a node name instead of a BlockBackend name is specified as the driver > for a guest device, an anonymous BlockBackend is created now. > > Signed-off-by: Kevin Wolf > --- > hw/core/qdev-properties-system.c | 18 +- >

Re: [Qemu-block] [Qemu-devel] [PATCH 1/3] block: ignore flush requests when storage is clean

2016-06-24 Thread Eric Blake
On 06/24/2016 09:06 AM, Denis V. Lunev wrote: > From: Evgeny Yakovlev > > Some guests (win2008 server for example) do a lot of unnecessary > flushing when underlying media has not changed. This adds additional > overhead on host when calling fsync/fdatasync. > > This

[Qemu-block] [PATCH 0/3] block: ignore flush requests when storage is clean

2016-06-24 Thread Denis V. Lunev
Changes from v2: - Better comments - Rebased on latest master Changes from v1: - Flush requests that should be skipped will now wait for completion of any previous requests already in flight - Fixed IDE and AHCI tests to dirty media for new flush behaviour - Fixed a problem in IDE

[Qemu-block] [PATCH 2/3] ide: ignore retry_unit check for non-retry operations

2016-06-24 Thread Denis V. Lunev
From: Evgeny Yakovlev The following sequence of tests discovered a problem in IDE emulation: 1. Send DMA write to IDE device 0 2. Send CMD_FLUSH_CACHE to same IDE device which will be failed by block layer using blkdebug script in tests/ide-test:test_retry_flush When

[Qemu-block] [PATCH 1/3] block: ignore flush requests when storage is clean

2016-06-24 Thread Denis V. Lunev
From: Evgeny Yakovlev Some guests (win2008 server for example) do a lot of unnecessary flushing when underlying media has not changed. This adds additional overhead on host when calling fsync/fdatasync. This change introduces a dirty flag in BlockDriverState which is

[Qemu-block] [PATCH 3/3] tests: in IDE and AHCI tests perform DMA write before flushing

2016-06-24 Thread Denis V. Lunev
From: Evgeny Yakovlev Due to previous change flushed on clean disks stopped generating flush_to_disk events and IDE and AHCI tests that test flush commands began to fail. This change adds additional DMA writes to affected tests before sending flush cache commands so

Re: [Qemu-block] [PATCH v3 17/22] block: Switch discard length bounds to byte-based

2016-06-24 Thread Kevin Wolf
Am 24.06.2016 um 16:15 hat Eric Blake geschrieben: > On 06/24/2016 12:43 AM, Fam Zheng wrote: > > On Thu, 06/23 16:37, Eric Blake wrote: > >> Sector-based limits are awkward to think about; in our on-going > >> quest to move to byte-based interfaces, convert max_discard and > >> discard_alignment.

Re: [Qemu-block] [PATCH v3 00/22] Byte-based block limits

2016-06-24 Thread Kevin Wolf
Am 24.06.2016 um 00:37 hat Eric Blake geschrieben: > BlockLimits is currently an ugly mix of byte limits vs. > sector limits. Unify it. Fix some bugs I found in > bdrv_aligned_preadv() while at it. > > Prequisite: none (built on Kevin's block branch, which is currently > merged into master) >

Re: [Qemu-block] [PATCH v3 20/22] block: Move request_alignment into BlockLimit

2016-06-24 Thread Eric Blake
On 06/24/2016 07:45 AM, Kevin Wolf wrote: > Am 24.06.2016 um 00:37 hat Eric Blake geschrieben: >> It makes more sense to have ALL block size limit constraints >> in the same struct. Improve the documentation while at it. >> >> Simplify a couple of conditionals, now that we have audited and >>

Re: [Qemu-block] [PATCH v3 16/22] block: Wording tweaks to write zeroes limits

2016-06-24 Thread Eric Blake
On 06/24/2016 12:12 AM, Fam Zheng wrote: > On Thu, 06/23 16:37, Eric Blake wrote: >> Improve the documentation of the write zeroes limits, to mention >> additional constraints that drivers should observe. Worth squashing >> into commit cf081fca, if that hadn't been pushed already :) >> >>

Re: [Qemu-block] [PATCH v3 17/22] block: Switch discard length bounds to byte-based

2016-06-24 Thread Eric Blake
On 06/24/2016 12:43 AM, Fam Zheng wrote: > On Thu, 06/23 16:37, Eric Blake wrote: >> Sector-based limits are awkward to think about; in our on-going >> quest to move to byte-based interfaces, convert max_discard and >> discard_alignment. Rename them, using 'pdiscard' as an aid to >> track which

Re: [Qemu-block] [PATCH v3 20/22] block: Move request_alignment into BlockLimit

2016-06-24 Thread Kevin Wolf
Am 24.06.2016 um 00:37 hat Eric Blake geschrieben: > It makes more sense to have ALL block size limit constraints > in the same struct. Improve the documentation while at it. > > Simplify a couple of conditionals, now that we have audited and > documented that request_alignment is always

[Qemu-block] [PATCH v2 7/7] Revert "mirror: Workaround for unexpected iohandler events during completion"

2016-06-24 Thread Fam Zheng
This reverts commit ab27c3b5e7408693dde0b565f050aa55c4a1bcef. The virtio storage device host notifiers now work with bdrv_drained_begin/end, so we don't need this hack any more. Signed-off-by: Fam Zheng --- block/mirror.c | 9 - 1 file changed, 9 deletions(-) diff

[Qemu-block] [PATCH v2 5/7] virtio-blk: Call virtio_add_queue_aio

2016-06-24 Thread Fam Zheng
AIO based handler is more appropriate here because it will then cooperate with bdrv_drained_begin/end. It is needed by the coming revert patch. Signed-off-by: Fam Zheng --- hw/block/virtio-blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[Qemu-block] [PATCH v2 6/7] virtio-scsi: Call virtio_add_queue_aio

2016-06-24 Thread Fam Zheng
AIO based handler is more appropriate here because it will then cooperate with bdrv_drained_begin/end. It is needed by the coming revert patch. Signed-off-by: Fam Zheng --- hw/scsi/virtio-scsi.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git

[Qemu-block] [PATCH v2 3/7] virtio: Introduce virtio_add_queue_aio

2016-06-24 Thread Fam Zheng
Using this function instead of virtio_add_queue marks the vq as aio based. This differentiation will be useful in later patches. Signed-off-by: Fam Zheng --- hw/virtio/virtio.c | 19 +-- include/hw/virtio/virtio.h | 3 +++ 2 files changed, 20

[Qemu-block] [PATCH v2 4/7] virtio: Use aio_set_event_notifier for aio vq

2016-06-24 Thread Fam Zheng
Signed-off-by: Fam Zheng --- hw/virtio/virtio.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 1ea6f66..a586529 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1835,11 +1835,21 @@

[Qemu-block] [PATCH v2 0/7] virtio: Merge virtio-{blk, scsi} host notifier handling paths

2016-06-24 Thread Fam Zheng
v2: Only convert virtio-{blk,scsi}. [Paolo] This series is based on top of Cornelia's [PATCH 0/6] virtio: refactor host notifiers The benifit is we don't use event_notifier_set_handler even in non-dataplane now, which in turn makes virtio-blk and virtio-scsi follow block layer aio context

[Qemu-block] [PATCH v2 1/7] virtio-bus: Drop "set_handler" parameter

2016-06-24 Thread Fam Zheng
It always equals to assign now. Signed-off-by: Fam Zheng --- hw/virtio/virtio-bus.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index 1313760..f34b4fc 100644 --- a/hw/virtio/virtio-bus.c +++

[Qemu-block] [PATCH v2 2/7] virtio: Add typedef for handle_output

2016-06-24 Thread Fam Zheng
The function pointer signature has been repeated a few times, using a typedef may make coding easier. Signed-off-by: Fam Zheng --- hw/virtio/virtio.c | 9 - include/hw/virtio/virtio.h | 5 +++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git

[Qemu-block] [PATCH] resize qcow2 with snapshot

2016-06-24 Thread zhangzhiming
qcow2 can’t be resized while there is a snapshot in qcow2 image but in version 3 image of qcow2, each disk size of snapshot is stored in the image, so we can resize image even through this are some snapshots since version 3 image. the function of resize nearly finished by others, i just do

Re: [Qemu-block] [Qemu-devel] [PATCH 3/3] blockdev: Add dynamic module loading for block drivers

2016-06-24 Thread Daniel P. Berrange
On Fri, Jun 24, 2016 at 11:04:43AM +0100, Stefan Hajnoczi wrote: > On Wed, Jun 22, 2016 at 05:35:54PM -0400, Colin Lord wrote: > > > > > @@ -447,8 +466,15 @@ int get_tmp_filename(char *filename, int size) > > static BlockDriver *find_hdev_driver(const char *filename) > > { > > int

Re: [Qemu-block] [PATCH] block/qdev: Fix NULL access when using BB twice

2016-06-24 Thread Stefan Hajnoczi
On Thu, Jun 23, 2016 at 09:30:01AM +0200, Kevin Wolf wrote: > BlockBackend has only a single pointer to its guest device, so it makes > sure that only a single guest device is attached to it. device-add > returns an error if you try to attach a second device to a BB. In order > to make the error

Re: [Qemu-block] [PATCH 2/3] blockdev: Add dynamic generation of module_block.h

2016-06-24 Thread Stefan Hajnoczi
On Wed, Jun 22, 2016 at 05:35:53PM -0400, Colin Lord wrote: > +def print_top(fheader): > +fheader.write('''/* AUTOMATICALLY GENERATED, DO NOT MODIFY */ > +/* > + * QEMU Block Module Infrastructure > + * > + * Copyright Red Hat, Inc. 2015 > + * > + * Authors: > + * Marc Mari

Re: [Qemu-block] [PATCH 3/3] blockdev: Add dynamic module loading for block drivers

2016-06-24 Thread Stefan Hajnoczi
On Wed, Jun 22, 2016 at 05:35:54PM -0400, Colin Lord wrote: > +for (i = 0; i < ARRAY_SIZE(block_driver_modules); ++i) { > +if (!strcmp(block_driver_modules[i].format_name, format_name)) { > +block_module_load_one(block_driver_modules[i].library_name); > +/*

Re: [Qemu-block] [PATCH] qcow2 resize with snapshot

2016-06-24 Thread Stefan Hajnoczi
On Thu, Jun 23, 2016 at 10:34:48PM +0800, zhangzhiming wrote: > hi, please help to review my code. i have checked it for serval times. > it is short and very easy too read. and i will be very grateful to you for > taking a very little time > to read it. thanks very much! > > zhangzhiming >

Re: [Qemu-block] [Qemu-devel] [PATCH 2/4] virtio: Always use aio path to set host handler

2016-06-24 Thread Fam Zheng
On Fri, 06/24 08:39, Paolo Bonzini wrote: > > > On 24/06/2016 07:12, Fam Zheng wrote: > > Apart from the interface difference, the aio version works the same as > > the non-aio one. The event notifier versus aio fd handler makes no > > diffeerence, except the former led to an ugly patch in

Re: [Qemu-block] [PATCH v3 22/22] block: Use bool as appropriate for BDS members

2016-06-24 Thread Fam Zheng
On Thu, 06/23 16:37, Eric Blake wrote: > Using int for values that are only used as booleans is confusing. > While at it, rearrange a couple of members so that all the bools > are contiguous. > > Signed-off-by: Eric Blake Reviewed-by: Fam Zheng

Re: [Qemu-block] [PATCH v3 21/22] block: Fix error message style

2016-06-24 Thread Fam Zheng
On Thu, 06/23 16:37, Eric Blake wrote: > error_setg() is not supposed to be used for multi-sentence > messages; tweak the message to append a hint instead. > > Signed-off-by: Eric Blake > > --- > v3: new patch > --- > block/raw-posix.c | 4 ++-- > 1 file changed, 2

Re: [Qemu-block] [PATCH v3 20/22] block: Move request_alignment into BlockLimit

2016-06-24 Thread Fam Zheng
On Thu, 06/23 16:37, Eric Blake wrote: > It makes more sense to have ALL block size limit constraints > in the same struct. Improve the documentation while at it. > > Simplify a couple of conditionals, now that we have audited and > documented that request_alignment is always non-zero. > >

Re: [Qemu-block] [PATCH v3 19/22] block: Split bdrv_merge_limits() from bdrv_refresh_limits()

2016-06-24 Thread Fam Zheng
On Thu, 06/23 16:37, Eric Blake wrote: > During bdrv_merge_limits(), we were computing initial limits > based on another BDS in two places. At first glance, the two > computations are not identical (one is doing straight copying, > the other is doing merging towards or away from zero) - but >

Re: [Qemu-block] [PATCH v3 18/22] block: Drop raw_refresh_limits()

2016-06-24 Thread Fam Zheng
On Thu, 06/23 16:37, Eric Blake wrote: > The raw block driver was blindly copying all limits from bs->file, > even though: 1. the main bdrv_refresh_limits() already does this > for many of the limits, and 2. blindly copying from the children > can weaken any stricter limits that were already

Re: [Qemu-block] [PATCH 2/4] virtio: Always use aio path to set host handler

2016-06-24 Thread Paolo Bonzini
On 24/06/2016 07:12, Fam Zheng wrote: > Apart from the interface difference, the aio version works the same as > the non-aio one. The event notifier versus aio fd handler makes no > diffeerence, except the former led to an ugly patch in commit > ab27c3b5e7, which won't be necessary any more. >

Re: [Qemu-block] [PATCH v3 16/22] block: Wording tweaks to write zeroes limits

2016-06-24 Thread Fam Zheng
On Thu, 06/23 16:37, Eric Blake wrote: > Improve the documentation of the write zeroes limits, to mention > additional constraints that drivers should observe. Worth squashing > into commit cf081fca, if that hadn't been pushed already :) > > Signed-off-by: Eric Blake > > ---

Re: [Qemu-block] [PATCH v3 17/22] block: Switch discard length bounds to byte-based

2016-06-24 Thread Fam Zheng
On Thu, 06/23 16:37, Eric Blake wrote: > Sector-based limits are awkward to think about; in our on-going > quest to move to byte-based interfaces, convert max_discard and > discard_alignment. Rename them, using 'pdiscard' as an aid to > track which remaining discard interfaces need conversion,

Re: [Qemu-block] [PATCH v3 15/22] block: Switch transfer length bounds to byte-based

2016-06-24 Thread Fam Zheng
On Thu, 06/23 16:37, Eric Blake wrote: > Sector-based limits are awkward to think about; in our on-going > quest to move to byte-based interfaces, convert max_transfer_length > and opt_transfer_length. Rename them (dropping the _length suffix) > so that the compiler will help us catch the change

[Qemu-block] [PULL 34/34] virtio-bus: remove old set_host_notifier callback

2016-06-24 Thread Michael S. Tsirkin
From: Cornelia Huck All users have been converted to the new ioevent callbacks. Signed-off-by: Cornelia Huck Reviewed-by: Fam Zheng Reviewed-by: Stefan Hajnoczi Reviewed-by: Michael S. Tsirkin

[Qemu-block] [PULL 30/34] virtio-bus: have callers tolerate new host notifier api

2016-06-24 Thread Michael S. Tsirkin
From: Cornelia Huck Have vhost and dataplane use the new api for transports that have been converted. Signed-off-by: Cornelia Huck Reviewed-by: Fam Zheng Reviewed-by: Stefan Hajnoczi Reviewed-by: