[Qemu-block] [PATCH v6 02/15] qapi: Assert finite use of 'number'

2016-10-10 Thread Eric Blake
Add assertions to all QMP commands that use a QAPI number (namely migrate_set_downtime on input; query-migrate and query-blockstats on output), to make it obvious where we would have to revisit the code if we were to extend QMP to support Infinity or NaN. Furthermore, make it part of our contract

[Qemu-block] [PATCH v6 08/15] qstring: Add qstring_wrap_str()

2016-10-10 Thread Eric Blake
Several spots in the code malloc a string, then wrap it in a QString, which has to duplicate the input. Adding a new constructor with transfer semantics makes this pattern more efficient, comparable to the just-added transfer semantics to go from QString back to raw string. Use the new

Re: [Qemu-block] [PATCH] qapi: allow blockdev-add for ssh

2016-10-10 Thread Kevin Wolf
Am 10.10.2016 um 13:54 hat Ashijeet Acharya geschrieben: > On Mon, Oct 10, 2016 at 5:01 PM, Kevin Wolf wrote: > > Your .bdrv_open() callback in ssh gets these options as keys in > > QDict *options, using the dot syntax. options might look like this > > (using "key" = "value" for

Re: [Qemu-block] [PATCH] qapi: allow blockdev-add for ssh

2016-10-10 Thread Ashijeet Acharya
On Mon, Oct 10, 2016 at 6:23 PM, Kevin Wolf wrote: > Am 10.10.2016 um 13:54 hat Ashijeet Acharya geschrieben: >> On Mon, Oct 10, 2016 at 5:01 PM, Kevin Wolf wrote: >> > Your .bdrv_open() callback in ssh gets these options as keys in >> > QDict *options, using

Re: [Qemu-block] [PATCH] qapi: allow blockdev-add for ssh

2016-10-10 Thread Kevin Wolf
Am 10.10.2016 um 12:48 hat Ashijeet Acharya geschrieben: > On Mon, Oct 10, 2016 at 2:45 PM, Kevin Wolf wrote: > > Am 08.10.2016 um 12:44 hat Ashijeet Acharya geschrieben: > >> +{ 'struct': 'BlockdevoptionsSsh', > >> + 'data': { 'server': 'InetSocketAddress', > >> +

Re: [Qemu-block] [PATCH 2/3] block: change drain to look only at one child at a time

2016-10-10 Thread Kevin Wolf
Am 07.10.2016 um 18:19 hat Paolo Bonzini geschrieben: > bdrv_requests_pending is checking children to also wait until internal > requests (such as metadata writes) have completed. However, checking > children is in general overkill. Children requests can be of two kinds: > > - requests caused

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

2016-10-10 Thread Kevin Wolf
Am 10.10.2016 um 11:39 hat Peter Maydell geschrieben: > On 7 October 2016 at 14:42, Kevin Wolf wrote: > > The following changes since commit e902754e3d0890945ddcc1b33748ed73762ddb8d: > > > > Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.8-20161006' > > into

Re: [Qemu-block] [Qemu-devel] [PATCH v2 02/11] blockjob: centralize QMP event emissions

2016-10-10 Thread John Snow
On 10/10/2016 12:45 PM, Kashyap Chamarthy wrote: On Wed, Oct 05, 2016 at 05:00:29PM -0400, John Snow wrote: [Arbitrarily chiming here, and still catching up with the details of the thread.] On 10/05/2016 03:24 PM, Eric Blake wrote: On 10/05/2016 01:49 PM, John Snow wrote: [...] Hmm, do

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] dma-helpers: explicitly pass alignment into dma-helpers

2016-10-10 Thread Eric Blake
On 10/09/2016 11:43 AM, Mark Cave-Ayland wrote: > The hard-coded default alignment is BDRV_SECTOR_SIZE, however this is not > necessarily the case for all platforms. Use this as the default alignment for > all current callers. > > Signed-off-by: Mark Cave-Ayland >

Re: [Qemu-block] [PATCH] iotests: drop thread spun work-around

2016-10-10 Thread Max Reitz
On 10.10.2016 04:57, Michael S. Tsirkin wrote: > We've disabled the warning, no need for test to work > around it. > > Signed-off-by: Michael S. Tsirkin > --- > tests/qemu-iotests/common.filter | 1 - > 1 file changed, 1 deletion(-) Thanks, I've applied the patch to my block

Re: [Qemu-block] [Qemu-devel] [PATCH 2/2] macio: switch over to new byte-aligned DMA helpers

2016-10-10 Thread Eric Blake
On 10/09/2016 11:43 AM, Mark Cave-Ayland wrote: > Now that the DMA helpers are byte-aligned they can be called directly from > the macio routines rather than emulating byte-aligned accesses via multiple > block-level accesses. > > Signed-off-by: Mark Cave-Ayland >

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

2016-10-10 Thread Eric Blake
On 10/10/2016 01:38 PM, Eric Blake wrote: > On 10/10/2016 10:12 AM, Peter Maydell wrote: > >>> v2: rewrite into a configure check (not sure if directly adding a >>> -D to QEMU_CFLAGS is the best, so advice welcome) >> >> Writing into config-host.mak would be preferable I think. >> > > Okay,

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

2016-10-10 Thread Eric Blake
On 10/10/2016 10:12 AM, Peter Maydell wrote: >> v2: rewrite into a configure check (not sure if directly adding a >> -D to QEMU_CFLAGS is the best, so advice welcome) > > Writing into config-host.mak would be preferable I think. > Okay, attempted in v4. >> I lack easy access to a Mac box, so

Re: [Qemu-block] [PATCH 1/3] block: add BDS field to count in-flight requests

2016-10-10 Thread Paolo Bonzini
On 10/10/2016 12:36, Kevin Wolf wrote: > > At the BlockBackend level (or really anywhere in the graph), we have two > different kinds of drain requests that we just fail to implement > differently today: > > 1. blk_drain(), i.e. a request to actually drain all requests pending in >this

Re: [Qemu-block] [Qemu-devel] [PATCH v2 02/11] blockjob: centralize QMP event emissions

2016-10-10 Thread Kashyap Chamarthy
On Wed, Oct 05, 2016 at 05:00:29PM -0400, John Snow wrote: [Arbitrarily chiming here, and still catching up with the details of the thread.] > On 10/05/2016 03:24 PM, Eric Blake wrote: > > On 10/05/2016 01:49 PM, John Snow wrote: [...] > > > Hmm, do we want to make it so some jobs are

Re: [Qemu-block] [PATCH 18/22] qapi: add md5 checksum of last dirty bitmap level to query-block

2016-10-10 Thread Max Reitz
On 30.09.2016 12:53, Vladimir Sementsov-Ogievskiy wrote: > Reviewed-by: John Snow > Reviewed-by: Eric Blake > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > block/dirty-bitmap.c | 1 + > include/qemu/hbitmap.h | 8 >

Re: [Qemu-block] [PATCH 18/22] qapi: add md5 checksum of last dirty bitmap level to query-block

2016-10-10 Thread Max Reitz
On 10.10.2016 18:44, Max Reitz wrote: > On 30.09.2016 12:53, Vladimir Sementsov-Ogievskiy wrote: >> Reviewed-by: John Snow >> Reviewed-by: Eric Blake >> Signed-off-by: Vladimir Sementsov-Ogievskiy >> --- >> block/dirty-bitmap.c |

Re: [Qemu-block] [PATCH 20/22] qcow2-dirty-bitmap: refcounts

2016-10-10 Thread Max Reitz
On 30.09.2016 12:53, Vladimir Sementsov-Ogievskiy wrote: > Calculate refcounts for dirty bitmaps. The commit message should mention that this is for qcow2's qemu-img check implementation. > > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > block/qcow2-bitmap.c

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

2016-10-10 Thread Eric Blake
C99 requires SIZE_MAX to be declared with the same type as the integral promotion of size_t, but OSX mistakenly defines it as an 'unsigned long long' expression even though size_t is only 'unsigned long'. Rather than futzing around with whether size_t is 32- or 64-bits wide (which would be needed

Re: [Qemu-block] [PATCH v10 01/16] block: Pause all jobs during bdrv_reopen_multiple()

2016-10-10 Thread Paolo Bonzini
On 10/10/2016 17:37, Kevin Wolf wrote: > > +while ((job = block_job_next(job))) { > > +AioContext *aio_context = blk_get_aio_context(job->blk); > > + > > +aio_context_acquire(aio_context); > > +block_job_pause(job); > > +aio_context_release(aio_context); > > +

Re: [Qemu-block] [PATCH 19/22] iotests: test qcow2 persistent dirty bitmap

2016-10-10 Thread Max Reitz
On 30.09.2016 12:53, Vladimir Sementsov-Ogievskiy wrote: > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > tests/qemu-iotests/165 | 87 > ++ > tests/qemu-iotests/165.out | 5 +++ > tests/qemu-iotests/group | 1 + >

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] dma-helpers: explicitly pass alignment into dma-helpers

2016-10-10 Thread Mark Cave-Ayland
On 10/10/16 17:34, Eric Blake wrote: > On 10/09/2016 11:43 AM, Mark Cave-Ayland wrote: >> The hard-coded default alignment is BDRV_SECTOR_SIZE, however this is not >> necessarily the case for all platforms. Use this as the default alignment for >> all current callers. >> >> Signed-off-by: Mark

Re: [Qemu-block] [Qemu-devel] [PATCH v10 09/16] block: Add QMP support for streaming to an intermediate layer

2016-10-10 Thread Eric Blake
On 10/06/2016 08:02 AM, Alberto Garcia wrote: > This patch makes the 'device' parameter of the 'block-stream' command > accept a node name that is not a root node. > > In addition to that, operation blockers will be checked in all > intermediate nodes between the top and the base node. > >

Re: [Qemu-block] [PATCH 1/2] qemu-img: make img_open() able to surpress file opening errors

2016-10-10 Thread Max Reitz
On 07.10.2016 17:36, Reda Sallahi wrote: > Previously img_open() always printed file opening errors even if the intended > action is just to check the file existence as is sometimes the case in > qemu-img dd. > > This adds an argument (openerror) to img_open() that specifies whether to > print >

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

2016-10-10 Thread Eric Blake
On 10/10/2016 01:27 PM, Eric Blake wrote: > C99 requires SIZE_MAX to be declared with the same type as the > integral promotion of size_t, but OSX mistakenly defines it as > an 'unsigned long long' expression even though size_t is only > 'unsigned long'. Rather than futzing around with whether

Re: [Qemu-block] [PATCH 2/2] qemu-img: change opening method for the output in dd

2016-10-10 Thread Max Reitz
On 07.10.2016 17:36, Reda Sallahi wrote: > The subcommand dd was creating an output image regardless of whether there > was one already created. With this patch we try to check first if the output > image exists and resize it if necessary. > > Signed-off-by: Reda Sallahi >

Re: [Qemu-block] [PATCH 0/2] qemu-img: change img_open() and opening method in dd

2016-10-10 Thread Max Reitz
On 07.10.2016 17:36, Reda Sallahi wrote: > The patch series include the previously submitted patch: > [PATCH v5] qemu-img: change opening method for the output in dd > > Changes from v5: > * Replace access() with a modified version of img_open() in img_dd() > > Depends on: > [PATCH v3] qemu-img:

[Qemu-block] [PATCH] rbd: shift byte count as a 64-bit value

2016-10-10 Thread Paolo Bonzini
Otherwise, reads of more than 2GB fail. Until commit 7bbca9e290a9c7c217b5a24fc6094e91e54bd05d, reads of 2^41 bytes succeeded at least theoretically. In fact, pdiscard ought to receive a 64-bit integer as the count for the same reason. Reported by Coverity. Fixes:

Re: [Qemu-block] [PATCH 18/22] qapi: add md5 checksum of last dirty bitmap level to query-block

2016-10-10 Thread Eric Blake
On 10/10/2016 12:03 PM, Max Reitz wrote: >> I'm not sure what the right way would be to get this information out >> (...maybe make it optional and set it only if qtest_enabled() is true?), >> but in my opinion this is not the right way. > > By the way, the cleanest way I can come up with (which I

Re: [Qemu-block] [Qemu-devel] [PATCH for-2.5] iotests: drop thread spun work-around

2016-10-10 Thread Max Reitz
On 10.10.2016 04:57, Michael S. Tsirkin wrote: > We've disabled the warning, there should be no need for test to work > around it. > > Signed-off-by: Michael S. Tsirkin > --- > > This is on top of > main-loop: suppress warnings under qtest > > I just tested this by running

Re: [Qemu-block] [PATCH] rbd: shift byte count as a 64-bit value

2016-10-10 Thread Eric Blake
On 10/10/2016 03:00 PM, Paolo Bonzini wrote: > Otherwise, reads of more than 2GB fail. Until commit > 7bbca9e290a9c7c217b5a24fc6094e91e54bd05d, reads of 2^41 > bytes succeeded at least theoretically. I don't think the block layer ever passes a read request down to drivers that large in the first

Re: [Qemu-block] [PATCH v10 01/16] block: Pause all jobs during bdrv_reopen_multiple()

2016-10-10 Thread Kevin Wolf
Am 06.10.2016 um 15:02 hat Alberto Garcia geschrieben: > When a BlockDriverState is about to be reopened it can trigger certain > operations that need to write to disk. During this process a different > block job can be woken up. If that block job completes and also needs > to call bdrv_reopen()

Re: [Qemu-block] [PATCH v10 03/16] block: Use block_job_add_bdrv() in mirror_start_job()

2016-10-10 Thread Kevin Wolf
Am 06.10.2016 um 15:02 hat Alberto Garcia geschrieben: > Use block_job_add_bdrv() instead of blocking all operations in > mirror_start_job() and unblocking them in mirror_exit(). > > Signed-off-by: Alberto Garcia Compared to the old code, this unblocks BLOCK_OP_TYPE_DATAPLANE,

Re: [Qemu-block] [PATCH v2] block: Remove "options" indirection from blockdev-add

2016-10-10 Thread Eric Blake
On 10/10/2016 08:41 AM, Kevin Wolf wrote: > Now that QAPI supports boxed types, we can have unions at the top level > of a command, so let's put our real options directly there for > blockdev-add instead of having a single "options" dict that contains the > real arguments. > > blockdev-add is

Re: [Qemu-block] [PATCH 16/22] qmp: add persistent flag to block-dirty-bitmap-add

2016-10-10 Thread Max Reitz
On 30.09.2016 12:53, Vladimir Sementsov-Ogievskiy wrote: > Add optional 'persistent' flag to qmp command block-dirty-bitmap-add. > Default is false. > > Signed-off-by: Vladimir Sementsov-Ogievskiy > Signed-off-by: Denis V. Lunev > --- > blockdev.c

Re: [Qemu-block] [PATCH 17/22] qmp: add autoload parameter to block-dirty-bitmap-add

2016-10-10 Thread Max Reitz
On 30.09.2016 12:53, Vladimir Sementsov-Ogievskiy wrote: > Optional. Default is false. > > Signed-off-by: Vladimir Sementsov-Ogievskiy > Signed-off-by: Denis V. Lunev > --- > blockdev.c | 22 -- > qapi/block-core.json |

Re: [Qemu-block] [Qemu-devel] [PATCH v2 10/11] blockjob: refactor backup_start as backup_job_create

2016-10-10 Thread Kevin Wolf
Am 07.10.2016 um 20:39 hat John Snow geschrieben: > On 09/30/2016 06:00 PM, John Snow wrote: > >Refactor backup_start as backup_job_create, which only creates the job, > >but does not automatically start it. The old interface, 'backup_start', > >is not kept in favor of limiting the number of

Re: [Qemu-block] [Qemu-devel] [PATCH v2 10/11] blockjob: refactor backup_start as backup_job_create

2016-10-10 Thread John Snow
On 10/10/2016 04:57 AM, Kevin Wolf wrote: Am 07.10.2016 um 20:39 hat John Snow geschrieben: On 09/30/2016 06:00 PM, John Snow wrote: Refactor backup_start as backup_job_create, which only creates the job, but does not automatically start it. The old interface, 'backup_start', is not kept in

[Qemu-block] [PATCH v1 1/2] block/replication: prefect the logic to acquire 'top_id'

2016-10-10 Thread Changlong Xie
Only g_strdup(top_id) if 'top_id' is not NULL, although there is no memory leak here Signed-off-by: Changlong Xie --- block/replication.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/replication.c b/block/replication.c index

[Qemu-block] [PATCH v1 0/2] block/replication fixes

2016-10-10 Thread Changlong Xie
Changlong Xie (2): block/replication: prefect the logic to acquire 'top_id' block/replication: Clarify 'top-id' parameter usage block/replication.c | 9 +++-- qapi/block-core.json | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) -- 1.9.3

[Qemu-block] [PATCH v1 2/2] block/replication: Clarify 'top-id' parameter usage

2016-10-10 Thread Changlong Xie
Replication driver only support 'top-id' parameter in secondary side, and it must not be supplied in primary side Signed-off-by: Changlong Xie --- block/replication.c | 5 + qapi/block-core.json | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git

Re: [Qemu-block] [PATCH] qapi: allow blockdev-add for ssh

2016-10-10 Thread Ashijeet Acharya
On Mon, Oct 10, 2016 at 2:45 PM, Kevin Wolf wrote: > Am 08.10.2016 um 12:44 hat Ashijeet Acharya geschrieben: >> Introduce new object 'BlockdevOptionsSsh' in qapi/block-core.json to >> support blockdev-add for SSH network protocol driver. Use only 'struct >> InetSocketAddress'

Re: [Qemu-block] [PATCH] qapi: allow blockdev-add for ssh

2016-10-10 Thread Kevin Wolf
Am 08.10.2016 um 12:44 hat Ashijeet Acharya geschrieben: > Introduce new object 'BlockdevOptionsSsh' in qapi/block-core.json to > support blockdev-add for SSH network protocol driver. Use only 'struct > InetSocketAddress' since SSH only supports connection over TCP. > > Signed-off-by: Ashijeet

Re: [Qemu-block] [PATCH] block: failed qemu-img command should return non-zero exit code

2016-10-10 Thread Kevin Wolf
Am 09.10.2016 um 15:25 hat Reda Sallahi geschrieben: > On Sun, Oct 09, 2016 at 05:17:27PM +0800, Xu Tian wrote: > > If backing file can not open when do qemu-img rebase, var 'ret' not > > assign a no-zero value, qemu-img process go out with exit code zero. > > > > Signed-off-by: Xu Tian

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

2016-10-10 Thread Peter Maydell
On 7 October 2016 at 14:42, Kevin Wolf wrote: > The following changes since commit e902754e3d0890945ddcc1b33748ed73762ddb8d: > > Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.8-20161006' > into staging (2016-10-06 13:34:00 +0100) > > are available in the git

Re: [Qemu-block] [PATCH] Put the copyright information on a separate line

2016-10-10 Thread Paolo Bonzini
On 05/10/2016 11:54, Thomas Huth wrote: > The output string QEMU with "--version" is very long, it does > not fit into a normal line of a terminal window anymore. By > putting the copyright information on a separate line instead, > the output looks much nicer. > > Signed-off-by: Thomas Huth

Re: [Qemu-block] [PATCH 1/3] block: add BDS field to count in-flight requests

2016-10-10 Thread Kevin Wolf
Am 07.10.2016 um 18:19 hat Paolo Bonzini geschrieben: > Unlike tracked_requests, this field also counts throttled requests [in > the BlockBackend layer], and remains non-zero if an AIO operation > needs a BH to be "really" completed. Do you actually like this? I think this is an incredibly ugly

[Qemu-block] [PATCH v6 09/15] qobject: Consolidate qobject_to_json() calls

2016-10-10 Thread Eric Blake
It's simpler to have a single conversion function that takes a bool parameter, rather than two functions where the choice of function determines an internal bool. Similar to commit fc471c18. While at it, the conversion currently cannot fail (maybe it SHOULD be possible to choose to fail, when

[Qemu-block] [PATCH v2] block: Remove "options" indirection from blockdev-add

2016-10-10 Thread Kevin Wolf
Now that QAPI supports boxed types, we can have unions at the top level of a command, so let's put our real options directly there for blockdev-add instead of having a single "options" dict that contains the real arguments. blockdev-add is still experimental and we already made substantial

[Qemu-block] [PATCH v6 15/15] qemu-img: Use new JSON output formatter

2016-10-10 Thread Eric Blake
Now that we can pretty-print straight to JSON from a visitor, we can eliminate the temporary conversion into QObject inside qemu-img. The changes to qemu-iotests 043 expected output demonstrates the fact that output is now done in qapi declaration order, rather than QDict hash order.

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

2016-10-10 Thread Peter Maydell
On 10 October 2016 at 12:37, Kevin Wolf wrote: > Am 10.10.2016 um 11:39 hat Peter Maydell geschrieben: >> On 7 October 2016 at 14:42, Kevin Wolf wrote: >> > The following changes since commit >> > e902754e3d0890945ddcc1b33748ed73762ddb8d: >> > >> > Merge

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

2016-10-10 Thread Eric Blake
C99 requires SIZE_MAX to be declared with the same type as the integral promotion of size_t, but OSX mistakenly defines it as an 'unsigned long long' expression even though size_t is only 'unsigned long'. Rather than futzing around with whether size_t is 32- or 64-bits wide (which would be needed

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

2016-10-10 Thread Peter Maydell
On 10 October 2016 at 15:38, Eric Blake wrote: > C99 requires SIZE_MAX to be declared with the same type as the > integral promotion of size_t, but OSX mistakenly defines it as > an 'unsigned long long' expression even though size_t is only > 'unsigned long'. Rather than