Re: [Qemu-block] [PATCH] qemu-img convert: Deprecate using -n and -o together

2019-08-09 Thread Nir Soffer
On Fri, Aug 9, 2019 at 12:11 PM Kevin Wolf wrote: > bdrv_create options specified with -o have no effect when skipping image > creation with -n, so this doesn't make sense. Warn against the misuse > and deprecate the combination so we can make it a hard error later. > > Signed-off-by: Kevin Wolf

[Qemu-block] [PATCH] block/backup: install notifier during creation

2019-08-09 Thread John Snow
Backup jobs may yield prior to installing their handler, because of the job_co_entry shim which guarantees that a job won't begin work until we are ready to start an entire transaction. Unfortunately, this makes proving correctness about transactional points-in-time for backup hard to reason

Re: [Qemu-block] [Qemu-devel] backup bug or question

2019-08-09 Thread John Snow
On 8/9/19 9:18 AM, Vladimir Sementsov-Ogievskiy wrote: > Hi! > > Hmm, hacking around backup I have a question: > > What prevents guest write request after job_start but before setting > write notifier? > > code path: > > qmp_drive_backup or transaction with backup > > job_start >

Re: [Qemu-block] [PATCH v2 00/11] block: Fix some things about bdrv_has_zero_init()

2019-08-09 Thread Max Reitz
On 24.07.19 19:12, Max Reitz wrote: > Hi, > > See the previous cover letter for the reason for patches 6 through 9: > https://lists.nongnu.org/archive/html/qemu-block/2019-07/msg00563.html > > But no only some bdrv_has_zero_init() implementations are wrong, some > callers also use it the wrong

Re: [Qemu-block] [Qemu-devel] [PATCH v2 09/11] iotests: Convert to preallocated encrypted qcow2

2019-08-09 Thread Max Reitz
On 25.07.19 18:27, Max Reitz wrote: > On 25.07.19 17:30, Maxim Levitsky wrote: >> On Wed, 2019-07-24 at 19:12 +0200, Max Reitz wrote: >>> Add a test case for converting an empty image (which only returns zeroes >>> when read) to a preallocated encrypted qcow2 image. >>> qcow2_has_zero_init()

[Qemu-block] [PATCH] iotests: Fix 141 when run with qed

2019-08-09 Thread Max Reitz
69f47505ee has changed qcow2 in such a way that the commit job run in test 141 (and 144[1]) returns before it emits the READY event. However, 141 also runs with qed, where the order is still the other way around. Just filter out the {"return": {}} so the test passes for qed again. [1] 144 only

Re: [Qemu-block] [Qemu-devel] [PATCH v6 06/42] qcow2: Implement .bdrv_storage_child()

2019-08-09 Thread Eric Blake
On 8/9/19 11:13 AM, Max Reitz wrote: > Signed-off-by: Max Reitz > Reviewed-by: Vladimir Sementsov-Ogievskiy > --- > block/qcow2.c | 9 + > 1 file changed, 9 insertions(+) > Reviewed-by: Eric Blake -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226

Re: [Qemu-block] [Qemu-devel] [PATCH v6 05/42] block: Add chain helper functions

2019-08-09 Thread Eric Blake
On 8/9/19 11:13 AM, Max Reitz wrote: > Add some helper functions for skipping filters in a chain of block > nodes. > > Signed-off-by: Max Reitz > Reviewed-by: Vladimir Sementsov-Ogievskiy > --- > include/block/block_int.h | 3 +++ > block.c | 55

Re: [Qemu-block] [Qemu-devel] [PATCH v6 04/42] block: Add child access functions

2019-08-09 Thread Eric Blake
On 8/9/19 11:13 AM, Max Reitz wrote: > There are BDS children that the general block layer code can access, > namely bs->file and bs->backing. Since the introduction of filters and > external data files, their meaning is not quite clear. bs->backing can > be a COW source, or it can be an

Re: [Qemu-block] [PATCH v2 4/7] block/backup: drop handling of max_transfer for copy_range

2019-08-09 Thread Max Reitz
On 09.08.19 17:32, Vladimir Sementsov-Ogievskiy wrote: > Since previous commit, copy_range supports max_transfer, so we don't > need to handle it by hand. > > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > block/backup.c | 11 ++- > 1 file changed, 2 insertions(+), 9 deletions(-)

Re: [Qemu-block] [PATCH v2 3/7] block/io: handle alignment and max_transfer for copy_range

2019-08-09 Thread Max Reitz
On 09.08.19 17:32, Vladimir Sementsov-Ogievskiy wrote: > copy_range ignores these limitations, let's improve it. > > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > block/io.c | 48 > 1 file changed, 40 insertions(+), 8 deletions(-)

[Qemu-block] [PATCH v6 42/42] iotests: Test committing to overridden backing

2019-08-09 Thread Max Reitz
Signed-off-by: Max Reitz --- tests/qemu-iotests/040 | 61 ++ tests/qemu-iotests/040.out | 4 +-- 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040 index a0a0db8889..558fdb9a09 100755 ---

[Qemu-block] [PATCH v6 41/42] iotests: Add test for commit in sub directory

2019-08-09 Thread Max Reitz
Add a test for committing an overlay in a sub directory to one of the images in its backing chain, using both relative and absolute filenames. Signed-off-by: Max Reitz --- tests/qemu-iotests/020 | 36 tests/qemu-iotests/020.out | 10 ++ 2 files

[Qemu-block] [PATCH v6 40/42] iotests: Add filter mirror test cases

2019-08-09 Thread Max Reitz
This patch adds some test cases how mirroring relates to filters. One of them tests what happens when you mirror off a filtered COW node, two others use the mirror filter node as basically our only example of an implicitly created filter node so far (besides the commit filter). Signed-off-by:

[Qemu-block] [PATCH v6 39/42] iotests: Add filter commit test cases

2019-08-09 Thread Max Reitz
This patch adds some tests on how commit copes with filter nodes. Signed-off-by: Max Reitz --- tests/qemu-iotests/040 | 177 + tests/qemu-iotests/040.out | 4 +- 2 files changed, 179 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/040

[Qemu-block] [PATCH v6 33/42] blockdev: Fix active commit choice

2019-08-09 Thread Max Reitz
We have to perform an active commit whenever the top node has a parent that has taken the WRITE permission on it. Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- blockdev.c | 24 +--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git

[Qemu-block] [PATCH v6 38/42] iotests: Let complete_and_wait() work with commit

2019-08-09 Thread Max Reitz
complete_and_wait() and wait_ready() currently only work for mirror jobs. Let them work for active commit jobs, too. Signed-off-by: Max Reitz --- tests/qemu-iotests/iotests.py | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/iotests.py

[Qemu-block] [PATCH v6 35/42] block: Fix check_to_replace_node()

2019-08-09 Thread Max Reitz
Currently, check_to_replace_node() only allows mirror to replace a node in the chain of the source node, and only if it is the first non-filter node below the source. Well, technically, the idea is that you can exactly replace a quorum child by mirroring from quorum. This has (probably) two

[Qemu-block] [PATCH v6 31/42] block: Drop backing_bs()

2019-08-09 Thread Max Reitz
We want to make it explicit where bs->backing is used, and we have done so. The old role of backing_bs() is now effectively taken by bdrv_filtered_cow_bs(). Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 5 - 1 file changed, 5

[Qemu-block] [PATCH v6 25/42] mirror: Deal with filters

2019-08-09 Thread Max Reitz
This includes some permission limiting (for example, we only need to take the RESIZE permission for active commits where the base is smaller than the top). Signed-off-by: Max Reitz --- block/mirror.c | 117 ++--- blockdev.c | 47

[Qemu-block] [PATCH v6 24/42] block: Use child access functions for QAPI queries

2019-08-09 Thread Max Reitz
query-block, query-named-block-nodes, and query-blockstats now return any filtered child under "backing", not just bs->backing or COW children. This is so that filters do not interrupt the reported backing chain. This changes the output for iotest 184, as the throttled node now appears as a

[Qemu-block] [PATCH v6 22/42] block: Fix bdrv_get_allocated_file_size's fallback

2019-08-09 Thread Max Reitz
If the driver does not implement bdrv_get_allocated_file_size(), we should fall back to cumulating the allocated size of all non-COW children instead of just bs->file. Suggested-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Max Reitz --- block.c | 22 -- 1 file changed,

[Qemu-block] [PATCH v6 21/42] block: Use CAFs for debug breakpoints

2019-08-09 Thread Max Reitz
When looking for a blkdebug node (which implements debug breakpoints), use bdrv_primary_bs() to iterate through the graph, because that is where a blkdebug node would be. Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- block.c | 8 1 file changed, 4

[Qemu-block] [PATCH v6 32/42] block: Make bdrv_get_cumulative_perm() public

2019-08-09 Thread Max Reitz
This is useful in other files like blockdev.c to determine for example whether a node can be written to or not. Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 3 +++ block.c | 6 ++ 2 files changed, 5 insertions(+), 4

[Qemu-block] [PATCH v6 30/42] qemu-img: Use child access functions

2019-08-09 Thread Max Reitz
This changes iotest 204's output, because blkdebug on top of a COW node used to make qemu-img map disregard the rest of the backing chain (the backing chain was broken by the filter). With this patch, the allocation in the base image is reported correctly. Signed-off-by: Max Reitz ---

[Qemu-block] [PATCH v6 29/42] nbd: Use CAF when looking for dirty bitmap

2019-08-09 Thread Max Reitz
When looking for a dirty bitmap to share, we should handle filters by just including them in the search (so they do not break backing chains). Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake --- nbd/server.c | 6 +++--- 1 file changed, 3

[Qemu-block] [PATCH v6 34/42] block: Inline bdrv_co_block_status_from_*()

2019-08-09 Thread Max Reitz
With bdrv_filtered_rw_bs(), we can easily handle this default filter behavior in bdrv_co_block_status(). blkdebug wants to have an additional assertion, so it keeps its own implementation, except bdrv_co_block_status_from_file() needs to be inlined there. Suggested-by: Eric Blake Signed-off-by:

[Qemu-block] [PATCH v6 36/42] iotests: Add tests for mirror @replaces loops

2019-08-09 Thread Max Reitz
This adds two tests for cases where our old check_to_replace_node() function failed to detect that executing this job with these parameters would result in a cyclic graph. Signed-off-by: Max Reitz Reviewed-by: Eric Blake --- tests/qemu-iotests/041 | 124

[Qemu-block] [PATCH v6 37/42] block: Leave BDS.backing_file constant

2019-08-09 Thread Max Reitz
Parts of the block layer treat BDS.backing_file as if it were whatever the image header says (i.e., if it is a relative path, it is relative to the overlay), other parts treat it like a cache for bs->backing->bs->filename (relative paths are relative to the CWD). Considering

[Qemu-block] [PATCH v6 26/42] backup: Deal with filters

2019-08-09 Thread Max Reitz
Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/backup.c | 9 + blockdev.c | 19 +++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/block/backup.c b/block/backup.c index ecadb61af3..7854d7575b 100644 --- a/block/backup.c

[Qemu-block] [PATCH v6 23/42] blockdev: Use CAF in external_snapshot_prepare()

2019-08-09 Thread Max Reitz
This allows us to differentiate between filters and nodes with COW backing files: Filters cannot be used as overlays at all (for this function). Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- blockdev.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff

[Qemu-block] [PATCH v6 28/42] stream: Deal with filters

2019-08-09 Thread Max Reitz
Because of the recent changes that make the stream job independent of the base node and instead track the node above it, we have to split that "bottom" node into two cases: The bottom COW node, and the node directly above the base node (which may be an R/W filter or the bottom COW node).

[Qemu-block] [PATCH v6 13/42] block: Use CAFs in block status functions

2019-08-09 Thread Max Reitz
Use the child access functions in the block status inquiry functions as appropriate. Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/io.c | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/block/io.c b/block/io.c index

[Qemu-block] [PATCH v6 27/42] commit: Deal with filters

2019-08-09 Thread Max Reitz
This includes some permission limiting (for example, we only need to take the RESIZE permission if the base is smaller than the top). Signed-off-by: Max Reitz --- block/block-backend.c | 16 +--- block/commit.c| 96 +++ blockdev.c|

[Qemu-block] [PATCH v6 17/42] block: Use CAFs in bdrv_refresh_limits()

2019-08-09 Thread Max Reitz
Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/io.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/block/io.c b/block/io.c index bcc770d336..dca4689b2f 100644 --- a/block/io.c +++ b/block/io.c @@ -135,6 +135,8 @@ static void

[Qemu-block] [PATCH v6 20/42] block/snapshot: Fix fallback

2019-08-09 Thread Max Reitz
If the top node's driver does not provide snapshot functionality and we want to fall back to a node down the chain, we need to snapshot all non-COW children. For simplicity's sake, just do not fall back if there is more than one such child. bdrv_snapshot_goto() becomes a bit weird because we may

[Qemu-block] [PATCH v6 19/42] block: Use CAF in bdrv_co_rw_vmstate()

2019-08-09 Thread Max Reitz
If a node whose driver does not provide VM state functions has a metadata child, the VM state should probably go there; if it is a filter, the VM state should probably go there. It follows that we should generally go down to the primary child. Signed-off-by: Max Reitz Reviewed-by: Vladimir

[Qemu-block] [PATCH v6 18/42] block: Use CAFs in bdrv_refresh_filename()

2019-08-09 Thread Max Reitz
bdrv_refresh_filename() and the kind of related bdrv_dirname() should look to the primary child when they wish to copy the underlying file's filename. Signed-off-by: Max Reitz --- block.c | 29 + 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/block.c

[Qemu-block] [PATCH v6 16/42] block: Flush all children in generic code

2019-08-09 Thread Max Reitz
If the driver does not support .bdrv_co_flush() so bdrv_co_flush() itself has to flush the children of the given node, it should not flush just bs->file->bs, but in fact all children. In any case, the BLKDBG_EVENT() should be emitted on the primary child, because that is where a blkdebug node

[Qemu-block] [PATCH v6 09/42] block: Include filters when freezing backing chain

2019-08-09 Thread Max Reitz
In order to make filters work in backing chains, the associated functions must be able to deal with them and freeze all filter links, be they COW or R/W filter links. In the process, rename these functions to reflect that they now act on generalized chains of filter nodes instead of backing

[Qemu-block] [PATCH v6 06/42] qcow2: Implement .bdrv_storage_child()

2019-08-09 Thread Max Reitz
Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/qcow2.c | 9 + 1 file changed, 9 insertions(+) diff --git a/block/qcow2.c b/block/qcow2.c index 039bdc2f7e..f8570d6210 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -5086,6 +5086,13 @@ void

[Qemu-block] [PATCH v6 04/42] block: Add child access functions

2019-08-09 Thread Max Reitz
There are BDS children that the general block layer code can access, namely bs->file and bs->backing. Since the introduction of filters and external data files, their meaning is not quite clear. bs->backing can be a COW source, or it can be an R/W-filtered child; bs->file can be an R/W-filtered

[Qemu-block] [PATCH v6 10/42] block: Drop bdrv_is_encrypted()

2019-08-09 Thread Max Reitz
The original purpose of bdrv_is_encrypted() was to inquire whether a BDS can be used without the user entering a password or not. It has not been used for that purpose for quite some time. Actually, it is not even fit for that purpose, because to answer that question, it would have recursively

[Qemu-block] [PATCH v6 14/42] block: Use CAFs when working with backing chains

2019-08-09 Thread Max Reitz
Use child access functions when iterating through backing chains so filters do not break the chain. Signed-off-by: Max Reitz --- block.c | 40 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/block.c b/block.c index 86b84bea21..42abbaf0ba

[Qemu-block] [PATCH v6 15/42] block: Re-evaluate backing file handling in reopen

2019-08-09 Thread Max Reitz
Reopening a node's backing child needs a bit of special handling because the "backing" child has different defaults than all other children (among other things). Adding filter support here is a bit more difficult than just using the child access functions. In fact, we often have to directly use

[Qemu-block] [PATCH v6 08/42] block: bdrv_set_backing_hd() is about bs->backing

2019-08-09 Thread Max Reitz
bdrv_set_backing_hd() is a function that explicitly cares about the bs->backing child. Highlight that in its description and use child_bs(bs->backing) instead of backing_bs(bs) to make it more obvious. Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- block.c | 4 ++-- 1

[Qemu-block] [PATCH v6 07/42] block: *filtered_cow_child() for *has_zero_init()

2019-08-09 Thread Max Reitz
bdrv_has_zero_init() and the related bdrv_unallocated_blocks_are_zero() should use bdrv_filtered_cow_child() if they want to check whether the given BDS has a COW backing file. Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- block.c | 4 ++-- 1 file changed, 2

[Qemu-block] [PATCH v6 12/42] block: Use bdrv_filtered_rw* where obvious

2019-08-09 Thread Max Reitz
Places that use patterns like if (bs->drv->is_filter && bs->file) { ... something about bs->file->bs ... } should be BlockDriverState *filtered = bdrv_filtered_rw_bs(bs); if (filtered) { ... something about @filtered ... } instead. Signed-off-by: Max Reitz

[Qemu-block] [PATCH v6 11/42] block: Add bdrv_supports_compressed_writes()

2019-08-09 Thread Max Reitz
Filters cannot compress data themselves but they have to implement .bdrv_co_pwritev_compressed() still (or they cannot forward compressed writes). Therefore, checking whether bs->drv->bdrv_co_pwritev_compressed is non-NULL is not sufficient to know whether the node can actually handle compressed

[Qemu-block] [PATCH v6 00/42] block: Deal with filters

2019-08-09 Thread Max Reitz
Hi, When we introduced filters, we did it a bit casually. Sure, we talked a lot about them before, but that was mostly discussion about where implicit filters should be added to the graph (note that we currently only have two implicit filters, those being mirror and commit). But in the end, we

[Qemu-block] [PATCH v6 01/42] block: Mark commit and mirror as filter drivers

2019-08-09 Thread Max Reitz
The commit and mirror block nodes are filters, so they should be marked as such. (Strictly speaking, BDS.is_filter's documentation states that a filter's child must be bs->file. The following patch will relax this restriction, however.) Signed-off-by: Max Reitz Reviewed-by: Alberto Garcia

[Qemu-block] [PATCH v6 05/42] block: Add chain helper functions

2019-08-09 Thread Max Reitz
Add some helper functions for skipping filters in a chain of block nodes. Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 3 +++ block.c | 55 +++ 2 files changed, 58 insertions(+) diff

[Qemu-block] [PATCH v6 03/42] throttle: Support compressed writes

2019-08-09 Thread Max Reitz
Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/throttle.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/block/throttle.c b/block/throttle.c index 0349f42257..958a2bcfa6 100644 --- a/block/throttle.c +++ b/block/throttle.c @@ -153,6 +153,15 @@

[Qemu-block] [PATCH v6 02/42] copy-on-read: Support compressed writes

2019-08-09 Thread Max Reitz
Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/copy-on-read.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/block/copy-on-read.c b/block/copy-on-read.c index 6631f30205..16bdf630b6 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@

Re: [Qemu-block] [Qemu-devel] [PATCH v2 6/7] block/backup: teach backup_cow_with_bounce_buffer to copy more at once

2019-08-09 Thread Eric Blake
On 8/9/19 10:32 AM, Vladimir Sementsov-Ogievskiy wrote: > backup_cow_with_offload can transfer more than on cluster. Let s/on/one/ > backup_cow_with_bounce_buffer behave similarly. It reduces number > of IO and there are no needs to copy cluster by cluster. It reduces the number of IO requests,

Re: [Qemu-block] [Qemu-devel] [PATCH v7 7/9] qemu/units: add SI decimal units

2019-08-09 Thread Peter Maydell
On Fri, 9 Aug 2019 at 16:39, Eric Blake wrote: > Also, would it be worth swapping out existing constants in the code base > that should instead be using these macros, so that they actually have a > use and so that we can see whether using them adds legibility? > > For example, block/nvme.c,

Re: [Qemu-block] [PATCH v7 7/9] qemu/units: add SI decimal units

2019-08-09 Thread Eric Blake
On 6/18/19 6:43 AM, Vladimir Sementsov-Ogievskiy wrote: > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > include/qemu/units.h | 7 +++ > 1 file changed, 7 insertions(+) > > diff --git a/include/qemu/units.h b/include/qemu/units.h > index 692db3fbb2..52ccc7445c 100644 > ---

Re: [Qemu-block] [PATCH v2 0/7] backup improvements

2019-08-09 Thread Vladimir Sementsov-Ogievskiy
09.08.2019 18:32, Vladimir Sementsov-Ogievskiy wrote: > Hi all! > > There are some fixes and refactorings I need on my way to resend > my backup-top series. It's obvious now that I need to share copying > code between backup and backup-top, as backup copying code becomes > smarter and more

[Qemu-block] [PATCH v2 4/7] block/backup: drop handling of max_transfer for copy_range

2019-08-09 Thread Vladimir Sementsov-Ogievskiy
Since previous commit, copy_range supports max_transfer, so we don't need to handle it by hand. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/backup.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/block/backup.c b/block/backup.c index

[Qemu-block] [PATCH v2 3/7] block/io: handle alignment and max_transfer for copy_range

2019-08-09 Thread Vladimir Sementsov-Ogievskiy
copy_range ignores these limitations, let's improve it. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/io.c | 48 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/block/io.c b/block/io.c index 06305c6ea6..a5efb2200f 100644

[Qemu-block] [PATCH v2 1/7] block/backup: deal with zero detection

2019-08-09 Thread Vladimir Sementsov-Ogievskiy
We have detect_zeroes option, so at least for blockdev-backup user should define it if zero-detection is needed. For drive-backup leave detection enabled by default but do it through existing option instead of open-coding. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz ---

[Qemu-block] [PATCH v2 6/7] block/backup: teach backup_cow_with_bounce_buffer to copy more at once

2019-08-09 Thread Vladimir Sementsov-Ogievskiy
backup_cow_with_offload can transfer more than on cluster. Let backup_cow_with_bounce_buffer behave similarly. It reduces number of IO and there are no needs to copy cluster by cluster. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/backup.c | 29 +++-- 1 file

[Qemu-block] [PATCH v2 7/7] block/backup: merge duplicated logic into backup_do_cow

2019-08-09 Thread Vladimir Sementsov-Ogievskiy
backup_cow_with_offload and backup_cow_with_bounce_buffer contains a lot of duplicated logic. Move it into backup_do_cow. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block/backup.c | 84 +++--- 1 file changed, 31

[Qemu-block] [PATCH v2 5/7] block/backup: fix backup_cow_with_offload for last cluster

2019-08-09 Thread Vladimir Sementsov-Ogievskiy
We shouldn't try to copy bytes beyond EOF. Fix it. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block/backup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/backup.c b/block/backup.c index 228ba9423c..d482d93458 100644 --- a/block/backup.c

[Qemu-block] [PATCH v2 2/7] block/backup: refactor write_flags

2019-08-09 Thread Vladimir Sementsov-Ogievskiy
write flags are constant, let's store it in BackupBlockJob instead of recalculating. It also makes two boolean fields to be unused, so, drop them. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow Reviewed-by: Max Reitz --- block/backup.c | 24 1 file

[Qemu-block] [PATCH v2 0/7] backup improvements

2019-08-09 Thread Vladimir Sementsov-Ogievskiy
Hi all! There are some fixes and refactorings I need on my way to resend my backup-top series. It's obvious now that I need to share copying code between backup and backup-top, as backup copying code becomes smarter and more complicated. So the goal of the series is to make copying code more

Re: [Qemu-block] [PATCH v7 5/9] block/nbd: refactor nbd connection parameters

2019-08-09 Thread Eric Blake
On 6/18/19 6:43 AM, Vladimir Sementsov-Ogievskiy wrote: > We'll need some connection parameters to be available all the time to > implement nbd reconnect. So, let's refactor them: define additional > parameters in BDRVNBDState, drop them from function parameters, drop > nbd_client_init and

Re: [Qemu-block] [PATCH v3 07/33] automatically add vmstate for reset support in devices

2019-08-09 Thread Dr. David Alan Gilbert
* Peter Maydell (peter.mayd...@linaro.org) wrote: > On Thu, 8 Aug 2019 at 16:42, Dr. David Alan Gilbert > wrote: > > > > * Peter Maydell (peter.mayd...@linaro.org) wrote: > > > On Mon, 29 Jul 2019 at 15:59, Damien Hedde > > > wrote: > > > > > > > > This add the reset related sections for every

[Qemu-block] backup bug or question

2019-08-09 Thread Vladimir Sementsov-Ogievskiy
Hi! Hmm, hacking around backup I have a question: What prevents guest write request after job_start but before setting write notifier? code path: qmp_drive_backup or transaction with backup job_start aio_co_enter(job_co_entry) /* may only schedule execution, isn't it ? */

Re: [Qemu-block] [PATCH v3 07/33] automatically add vmstate for reset support in devices

2019-08-09 Thread Juan Quintela
Damien Hedde wrote: > On 8/9/19 12:32 PM, Peter Maydell wrote: >> On Fri, 9 Aug 2019 at 11:29, Damien Hedde wrote: >>> >>> One way to keep the feature without copy-pasting vmsd would be to add >>> a new vmstate_register with an additional argument to pass the base >>> class vmsd section and

Re: [Qemu-block] [PATCH 4/8] block/backup: improve unallocated clusters skipping

2019-08-09 Thread Max Reitz
On 09.08.19 14:47, Vladimir Sementsov-Ogievskiy wrote: > 09.08.2019 15:25, Max Reitz wrote: >> On 09.08.19 09:50, Vladimir Sementsov-Ogievskiy wrote: >>> 07.08.2019 21:01, Max Reitz wrote: On 07.08.19 10:07, Vladimir Sementsov-Ogievskiy wrote: > Limit block_status querying to request

Re: [Qemu-block] [Qemu-devel] [PATCH] qemu-img convert: Deprecate using -n and -o together

2019-08-09 Thread Eric Blake
On 8/9/19 4:11 AM, Kevin Wolf wrote: > bdrv_create options specified with -o have no effect when skipping image > creation with -n, so this doesn't make sense. Warn against the misuse > and deprecate the combination so we can make it a hard error later. > > Signed-off-by: Kevin Wolf > --- >

Re: [Qemu-block] [PATCH v3 07/33] automatically add vmstate for reset support in devices

2019-08-09 Thread Juan Quintela
Peter Maydell wrote: > On Fri, 9 Aug 2019 at 11:29, Damien Hedde wrote: >> >> One way to keep the feature without copy-pasting vmsd would be to add >> a new vmstate_register with an additional argument to pass the base >> class vmsd section and handle the whole thing there. > > If we have a

Re: [Qemu-block] [PATCH] qemu-img convert: Deprecate using -n and -o together

2019-08-09 Thread Max Reitz
On 09.08.19 11:11, Kevin Wolf wrote: > bdrv_create options specified with -o have no effect when skipping image > creation with -n, so this doesn't make sense. Warn against the misuse > and deprecate the combination so we can make it a hard error later. > > Signed-off-by: Kevin Wolf > --- >

Re: [Qemu-block] [PATCH 4/8] block/backup: improve unallocated clusters skipping

2019-08-09 Thread Vladimir Sementsov-Ogievskiy
09.08.2019 15:25, Max Reitz wrote: > On 09.08.19 09:50, Vladimir Sementsov-Ogievskiy wrote: >> 07.08.2019 21:01, Max Reitz wrote: >>> On 07.08.19 10:07, Vladimir Sementsov-Ogievskiy wrote: Limit block_status querying to request bounds on write notifier to avoid extra seeking. >>> >>> I

Re: [Qemu-block] [PATCH 4/8] block/backup: improve unallocated clusters skipping

2019-08-09 Thread Max Reitz
On 09.08.19 09:50, Vladimir Sementsov-Ogievskiy wrote: > 07.08.2019 21:01, Max Reitz wrote: >> On 07.08.19 10:07, Vladimir Sementsov-Ogievskiy wrote: >>> Limit block_status querying to request bounds on write notifier to >>> avoid extra seeking. >> >> I don’t understand this reasoning. Checking

Re: [Qemu-block] [PATCH v3 05/33] Switch to new api in qdev/bus

2019-08-09 Thread Cédric Le Goater
>>> So.. is this change in the device_reset() signature really necessary? >>> Even if there are compelling reasons to handle warm reset in the new >>> API, that doesn't been you need to change device_reset() itself from >>> its established meaning of a cold (i.e. as per power cycle) reset. >>>

Re: [Qemu-block] [Qemu-devel] [PATCH v3 05/33] Switch to new api in qdev/bus

2019-08-09 Thread Peter Maydell
On Fri, 9 Aug 2019 at 01:10, David Gibson wrote: > > On Wed, Jul 31, 2019 at 01:31:28PM +0200, Philippe Mathieu-Daudé wrote: > > On 7/31/19 11:29 AM, Damien Hedde wrote: > > > On 7/31/19 8:05 AM, David Gibson wrote: > > >> On Mon, Jul 29, 2019 at 04:56:26PM +0200, Damien Hedde wrote: > > >>> @@

Re: [Qemu-block] [PATCH v3 07/33] automatically add vmstate for reset support in devices

2019-08-09 Thread Damien Hedde
On 8/9/19 12:32 PM, Peter Maydell wrote: > On Fri, 9 Aug 2019 at 11:29, Damien Hedde wrote: >> >> One way to keep the feature without copy-pasting vmsd would be to add >> a new vmstate_register with an additional argument to pass the base >> class vmsd section and handle the whole thing there.

Re: [Qemu-block] [PATCH v3 07/33] automatically add vmstate for reset support in devices

2019-08-09 Thread Peter Maydell
On Fri, 9 Aug 2019 at 11:29, Damien Hedde wrote: > > One way to keep the feature without copy-pasting vmsd would be to add > a new vmstate_register with an additional argument to pass the base > class vmsd section and handle the whole thing there. If we have a vmstate section which contains no

Re: [Qemu-block] [PATCH v3 07/33] automatically add vmstate for reset support in devices

2019-08-09 Thread Damien Hedde
On 8/9/19 12:07 PM, Peter Maydell wrote: > On Thu, 8 Aug 2019 at 16:42, Dr. David Alan Gilbert > wrote: >> >> * Peter Maydell (peter.mayd...@linaro.org) wrote: >>> On Mon, 29 Jul 2019 at 15:59, Damien Hedde >>> wrote: This add the reset related sections for every QOM device.

Re: [Qemu-block] [PATCH 4/8] block/backup: improve unallocated clusters skipping

2019-08-09 Thread Vladimir Sementsov-Ogievskiy
09.08.2019 12:12, Vladimir Sementsov-Ogievskiy wrote: > 09.08.2019 10:50, Vladimir Sementsov-Ogievskiy wrote: >> 07.08.2019 21:01, Max Reitz wrote: >>> On 07.08.19 10:07, Vladimir Sementsov-Ogievskiy wrote: Limit block_status querying to request bounds on write notifier to avoid extra

Re: [Qemu-block] [PATCH 4/8] block/backup: improve unallocated clusters skipping

2019-08-09 Thread Vladimir Sementsov-Ogievskiy
09.08.2019 10:50, Vladimir Sementsov-Ogievskiy wrote: > 07.08.2019 21:01, Max Reitz wrote: >> On 07.08.19 10:07, Vladimir Sementsov-Ogievskiy wrote: >>> Limit block_status querying to request bounds on write notifier to >>> avoid extra seeking. >> >> I don’t understand this reasoning.  Checking

Re: [Qemu-block] [PATCH v3 07/33] automatically add vmstate for reset support in devices

2019-08-09 Thread Peter Maydell
On Thu, 8 Aug 2019 at 16:42, Dr. David Alan Gilbert wrote: > > * Peter Maydell (peter.mayd...@linaro.org) wrote: > > On Mon, 29 Jul 2019 at 15:59, Damien Hedde > > wrote: > > > > > > This add the reset related sections for every QOM > > > device. > > > > A bit more detail in the commit message

Re: [Qemu-block] [Qemu-devel] [PATCH v3 12/33] hw/pci/: remove qdev/qbus_reset_all call

2019-08-09 Thread Damien Hedde
On 8/7/19 5:31 PM, Peter Maydell wrote: > On Mon, 29 Jul 2019 at 15:59, Damien Hedde wrote: >> >> Replace deprecated qdev/bus_reset_all by device/bus_reset_warm. >> >> This does not impact the behavior. >> >> Signed-off-by: Damien Hedde > > I'll come back to patches 12-28 later. They're all

Re: [Qemu-block] [Qemu-devel] [PATCH v3 02/33] add temporary device_legacy_reset function to replace device_reset

2019-08-09 Thread Damien Hedde
On 8/7/19 4:27 PM, Peter Maydell wrote: > On Mon, 29 Jul 2019 at 15:58, Damien Hedde wrote: >> >> Provide a temporary function doing what device_reset does to do the >> transition with Resettable API which will trigger a prototype change >> of device_reset. > > The other point here is that

Re: [Qemu-block] [PATCH 4/8] block/backup: improve unallocated clusters skipping

2019-08-09 Thread Vladimir Sementsov-Ogievskiy
09.08.2019 10:50, Vladimir Sementsov-Ogievskiy wrote: > 07.08.2019 21:01, Max Reitz wrote: >> On 07.08.19 10:07, Vladimir Sementsov-Ogievskiy wrote: >>> Limit block_status querying to request bounds on write notifier to >>> avoid extra seeking. >> >> I don’t understand this reasoning.  Checking

[Qemu-block] [PATCH] qemu-img convert: Deprecate using -n and -o together

2019-08-09 Thread Kevin Wolf
bdrv_create options specified with -o have no effect when skipping image creation with -n, so this doesn't make sense. Warn against the misuse and deprecate the combination so we can make it a hard error later. Signed-off-by: Kevin Wolf --- qemu-img.c | 5 + qemu-deprecated.texi |

Re: [Qemu-block] [PATCH v3 08/33] Add function to control reset with gpio inputs

2019-08-09 Thread Damien Hedde
On 8/9/19 7:51 AM, David Gibson wrote: > On Wed, Aug 07, 2019 at 11:37:51AM +0100, Peter Maydell wrote: >> On Wed, 31 Jul 2019 at 07:33, David Gibson >> wrote: >>> >>> On Mon, Jul 29, 2019 at 04:56:29PM +0200, Damien Hedde wrote: It adds the possibility to add 2 gpios to control the warm

Re: [Qemu-block] [PATCH v3 14/33] hw/s390x/s390-virtio-ccw.c: remove qdev_reset_all call

2019-08-09 Thread Damien Hedde
On 8/8/19 12:50 PM, Cornelia Huck wrote: > On Mon, 29 Jul 2019 16:56:35 +0200 > Damien Hedde wrote: > >> Replace deprecated qdev_reset_all by device_reset_warm. >> >> This does not impact the behavior. > > Not so sure about that; see below. In this case, qdev_reset_all is used. The qdev

Re: [Qemu-block] [Qemu-devel] [PATCH] tests/test-hbitmap: test next_zero and _next_dirty_area after truncate

2019-08-09 Thread Vladimir Sementsov-Ogievskiy
08.08.2019 3:04, John Snow wrote: > > > On 8/5/19 12:46 PM, Vladimir Sementsov-Ogievskiy wrote: >> Test that hbitmap_next_zero and hbitmap_next_dirty_area can find things >> after old bitmap end. >> >> Signed-off-by: Vladimir Sementsov-Ogievskiy >> --- >> >> It's a follow-up for >> >>

Re: [Qemu-block] [PATCH 8/8] block/backup: backup_do_cow: use bdrv_dirty_bitmap_next_dirty_area

2019-08-09 Thread Vladimir Sementsov-Ogievskiy
07.08.2019 21:46, Max Reitz wrote: > On 07.08.19 10:07, Vladimir Sementsov-Ogievskiy wrote: >> Use effective bdrv_dirty_bitmap_next_dirty_area interface. >> >> Signed-off-by: Vladimir Sementsov-Ogievskiy >> --- >> block/backup.c | 56 ++ >> 1

Re: [Qemu-block] [PATCH 3/8] block/io: handle alignment and max_transfer for copy_range

2019-08-09 Thread Vladimir Sementsov-Ogievskiy
07.08.2019 20:28, Max Reitz wrote: > On 07.08.19 10:07, Vladimir Sementsov-Ogievskiy wrote: >> copy_range ignores these limitations, let's improve it. block/backup >> code handles max_transfer for copy_range by itself, now it's not needed >> more, drop it. > > Shouldn’t this be two separate

Re: [Qemu-block] [PATCH 4/8] block/backup: improve unallocated clusters skipping

2019-08-09 Thread Vladimir Sementsov-Ogievskiy
07.08.2019 21:01, Max Reitz wrote: > On 07.08.19 10:07, Vladimir Sementsov-Ogievskiy wrote: >> Limit block_status querying to request bounds on write notifier to >> avoid extra seeking. > > I don’t understand this reasoning. Checking whether something is > allocated for qcow2 should just mean an

Re: [Qemu-block] [PATCH v3 08/33] Add function to control reset with gpio inputs

2019-08-09 Thread David Gibson
On Wed, Aug 07, 2019 at 11:37:51AM +0100, Peter Maydell wrote: > On Wed, 31 Jul 2019 at 07:33, David Gibson > wrote: > > > > On Mon, Jul 29, 2019 at 04:56:29PM +0200, Damien Hedde wrote: > > > It adds the possibility to add 2 gpios to control the warm and cold reset. > > > With theses ios, the