Re: [Qemu-block] [PATCH v19 08/10] Implement new driver for block replication

2016-06-06 Thread Changlong Xie
On 05/20/2016 03:36 PM, Changlong Xie wrote: +if (!failover) { +/* + * This BDS will be closed, and the job should be completed + * before the BDS is closed, because we will access hidden + * disk, secondary disk in backup_job_completed().

Re: [Qemu-block] [PATCH v19 08/10] Implement new driver for block replication

2016-06-06 Thread Changlong Xie
On 05/20/2016 03:36 PM, Changlong Xie wrote: + +/* + * Must protect backup target if backup job was stopped/cancelled + * unexpectedly + */ +bdrv_ref(s->hidden_disk->bs); + +backup_start(s->secondary_disk->bs, s->hidden_disk->bs, 0, +

Re: [Qemu-block] [PATCH v2 5/5] qcow2: Implement .bdrv_co_pwritev()

2016-06-06 Thread Eric Blake
On 06/06/2016 08:59 AM, Kevin Wolf wrote: > This changes qcow2 to implement the byte-based .bdrv_co_pwritev > interface rather than the sector-based old one. > > As preallocation uses the same allocation function as normal writes, and > the interface of that function needs to be changed, it is

Re: [Qemu-block] [PATCH v2 4/5] qcow2: Use bytes instead of sectors for QCowL2Meta

2016-06-06 Thread Eric Blake
On 06/06/2016 08:59 AM, Kevin Wolf wrote: > In preparation for implementing .bdrv_co_pwritev in qcow2. > > Signed-off-by: Kevin Wolf > --- > block/qcow2-cluster.c | 32 > block/qcow2.h | 13 +++-- > 2 files changed, 15

Re: [Qemu-block] [PATCH v2 3/5] qcow2: Make copy_sectors() byte based

2016-06-06 Thread Eric Blake
On 06/06/2016 08:59 AM, Kevin Wolf wrote: > This will allow copy on write operations where the overwritten part of > the cluster is not aligned to sector boundaries. > > Also rename the function because it has nothing to do with sectors any > more. > > Signed-off-by: Kevin Wolf

Re: [Qemu-block] [Qemu-devel] coroutines: block: Co-routine re-entered recursively when migrating disk with iothreads

2016-06-06 Thread Fam Zheng
On Mon, 06/06 14:55, Jason J. Herne wrote: > > I'll see if I can reproduce it here. > > > > Fam > > > > Hi Fam, > Have you had any luck reproducing this? No I cannot reproduce so far.

Re: [Qemu-block] [PATCH v2 2/5] qcow2: Implement .bdrv_co_preadv()

2016-06-06 Thread Eric Blake
On 06/06/2016 08:59 AM, Kevin Wolf wrote: > Reading from qcow2 images is now byte granularity. > > Most of the affected code in qcow2 actually gets simpler with this > change. The only exception is encryption, which is fixed on 512 bytes > blocks; in order to keep this working,

[Qemu-block] [PATCH] Report error when opening device with locked tray

2016-06-06 Thread Colin Lord
This commit causes qmp_blockdev_change_medium to report an error if an attempt is made to open a device with a locked tray. Signed-off-by: Colin Lord This is based off my previous patch regarding the do_open_tray function (currently at v3). Probably should have been submitted

Re: [Qemu-block] [Qemu-devel] coroutines: block: Co-routine re-entered recursively when migrating disk with iothreads

2016-06-06 Thread Jason J. Herne
On 05/25/2016 04:36 AM, Fam Zheng wrote: On Tue, 05/24 11:05, Jason J. Herne wrote: Thread 13 (Thread 0x3ff989ff910 (LWP 29452)): #0 0x03ff99abe2c0 in raise () from /lib64/libc.so.6 #1 0x03ff99abfc26 in abort () from /lib64/libc.so.6 #2 0x80427d80 in qemu_coroutine_enter

[Qemu-block] [PATCH v3] blockdev: clean up error handling in do_open_tray

2016-06-06 Thread Colin Lord
Returns negative error codes and accompanying error messages in cases where the device has no tray or the tray is locked and isn't forced open. This extra information should result in better flexibility in functions that call do_open_tray. Signed-off-by: Colin Lord Suggested

[Qemu-block] [PATCH v2 1/5] qcow2: Work with bytes in qcow2_get_cluster_offset()

2016-06-06 Thread Kevin Wolf
This patch changes the units that qcow2_get_cluster_offset() uses internally, without touching the interface just yet. This will be done in another patch. Signed-off-by: Kevin Wolf --- block/qcow2-cluster.c | 44 +++- 1 file changed, 23

[Qemu-block] [PATCH v2 2/5] qcow2: Implement .bdrv_co_preadv()

2016-06-06 Thread Kevin Wolf
Reading from qcow2 images is now byte granularity. Most of the affected code in qcow2 actually gets simpler with this change. The only exception is encryption, which is fixed on 512 bytes blocks; in order to keep this working, bs->request_alignment is set for encrypted images. Signed-off-by:

[Qemu-block] [PATCH v2 3/5] qcow2: Make copy_sectors() byte based

2016-06-06 Thread Kevin Wolf
This will allow copy on write operations where the overwritten part of the cluster is not aligned to sector boundaries. Also rename the function because it has nothing to do with sectors any more. Signed-off-by: Kevin Wolf --- block/qcow2-cluster.c | 54

[Qemu-block] [PATCH v2 4/5] qcow2: Use bytes instead of sectors for QCowL2Meta

2016-06-06 Thread Kevin Wolf
In preparation for implementing .bdrv_co_pwritev in qcow2. Signed-off-by: Kevin Wolf --- block/qcow2-cluster.c | 32 block/qcow2.h | 13 +++-- 2 files changed, 15 insertions(+), 30 deletions(-) diff --git

[Qemu-block] [PATCH v2 0/5] qcow2: Implement .bdrv_co_preadv/pwritev

2016-06-06 Thread Kevin Wolf
This series converts qcow2 to the byte-based I/O interfaces. This simplifies the code by removing many unit conversions, and in the unlikely case of actual unaligned requests, it even makes the driver work more efficiently by avoiding read-modify-write. v2: - Be more careful with integer

Re: [Qemu-block] [Qemu-devel] [PATCH 5/5] qcow2: Implement .bdrv_co_pwritev

2016-06-06 Thread Kevin Wolf
Am 03.06.2016 um 22:13 hat Eric Blake geschrieben: > On 06/03/2016 11:21 AM, Kevin Wolf wrote: > > This changes qcow2 to implement the byte-based .bdrv_co_pwritev > > interface rather than the sector-based old one. > > > > As preallocation uses the same allocation function as normal writes, and >

Re: [Qemu-block] [PATCH v6 14/22] mirror: Disable image locking on target backing chain

2016-06-06 Thread Max Reitz
On 03.06.2016 10:49, Fam Zheng wrote: > In sync=none the backing image of s->target is s->common.bs, which could > be exclusively locked, the image locking wouldn't work here. > > Later we can update completion code to lock it after the replaced node > has dropped its lock. > > Signed-off-by:

[Qemu-block] [PATCH v2 5/5] qcow2: Implement .bdrv_co_pwritev()

2016-06-06 Thread Kevin Wolf
This changes qcow2 to implement the byte-based .bdrv_co_pwritev interface rather than the sector-based old one. As preallocation uses the same allocation function as normal writes, and the interface of that function needs to be changed, it is converted in the same patch. Signed-off-by: Kevin

[Qemu-block] [PATCH v2 3/3] iotests: Add test for post-mirror backing chains

2016-06-06 Thread Max Reitz
Signed-off-by: Max Reitz --- tests/qemu-iotests/155 | 218 + tests/qemu-iotests/155.out | 5 ++ tests/qemu-iotests/group | 1 + 3 files changed, 224 insertions(+) create mode 100755 tests/qemu-iotests/155 create mode

[Qemu-block] [PATCH v2 2/3] block/mirror: Fix target backing BDS

2016-06-06 Thread Max Reitz
Currently, we are trying to move the backing BDS from the source to the target in bdrv_replace_in_backing_chain() which is called from mirror_exit(). However, mirror_complete() already tries to open the target's backing chain with a call to bdrv_open_backing_file(). First, we should only set the

[Qemu-block] [PATCH v2 1/3] block: Allow replacement of a BDS by its overlay

2016-06-06 Thread Max Reitz
change_parent_backing_link() asserts that the BDS to be replaced is not used as a backing file. However, we may want to replace a BDS by its overlay in which case that very link should not be redirected. Signed-off-by: Max Reitz --- block.c | 15 ++- 1 file

[Qemu-block] [PATCH v2 0/3] block/mirror: Fix target backing BDS

2016-06-06 Thread Max Reitz
Issue #1: Sometimes we can have a wrong backing BDS for the target after a mirror block job. In "existing" mode with drive-mirror, or when using blockdev-mirror, it's generally the user's fault. In "absolute-paths" mode this only means that after a sync=full drive-mirror, the target may have a

Re: [Qemu-block] [Qemu-devel] [PATCH] scsi-disk: fix reads from scsi-disk devices

2016-06-06 Thread Peter Maydell
On 3 June 2016 at 13:42, Eric Blake wrote: > On 06/02/2016 11:17 PM, Mark Cave-Ayland wrote: >> Commit fcaafb1001b9c42817714dd3b2aadcfdb997b53d accidentally broke reads from >> scsi-disk devices when being updated from its original form to use the new >> byte-based block

[Qemu-block] [PATCH v2 3/5] qemu-img bench: Make start offset configurable

2016-06-06 Thread Kevin Wolf
This patch adds an option the specify the offset of the first request made by qemu-img bench. This allows to benchmark misaligned requests. Signed-off-by: Kevin Wolf Reviewed-by: Denis V. Lunev --- qemu-img-cmds.hx | 4 ++-- qemu-img.c | 23

[Qemu-block] [PATCH v2 2/5] qemu-img bench: Sequential writes

2016-06-06 Thread Kevin Wolf
This extends qemu-img bench with an option that makes it use sequential writes instead of reads for the test run. Signed-off-by: Kevin Wolf --- qemu-img-cmds.hx | 4 ++-- qemu-img.c | 38 +- qemu-img.texi| 13 + 3

[Qemu-block] [PATCH v2 0/5] block: Introduce qemu-img bench

2016-06-06 Thread Kevin Wolf
After merging Den's qcow2 patch to avoid duplicated flushes, I thought I would be nice to reproduce the problem and I remembered 'qemu-img bench', which I had posted before as part of more than one RFC series, but which never made it to master somehow. So here is a rebased and cleaned up version

[Qemu-block] [PATCH v2 4/5] qemu-img bench: Implement -S (step size)

2016-06-06 Thread Kevin Wolf
With this new option, qemu-img bench can be told to advance the current offset after each request by a different value than the buffer size. This is useful for controlling the conditions for cluster allocation in image formats (e.g. qcow2 cluster allocation with COW in front of the request, or COW

[Qemu-block] [PATCH v2 5/5] qemu-img bench: Add --flush-interval

2016-06-06 Thread Kevin Wolf
This options allows to flush the image periodically during write tests. Signed-off-by: Kevin Wolf --- qemu-img-cmds.hx | 4 +-- qemu-img.c | 95 ++-- qemu-img.texi| 8 - 3 files changed, 95 insertions(+), 12

[Qemu-block] [PATCH v2 1/5] qemu-img bench

2016-06-06 Thread Kevin Wolf
This adds a qemu-img command that allows doing some simple benchmarks for the block layer without involving guest devices and a real VM. For the start, this implements only a test of sequential reads. Signed-off-by: Kevin Wolf Reviewed-by: Denis V. Lunev ---

Re: [Qemu-block] [PATCH 5/5] qemu-img bench: Add --flush-interval

2016-06-06 Thread Kevin Wolf
Am 03.06.2016 um 17:16 hat Kevin Wolf geschrieben: > Am 03.06.2016 um 17:01 hat Denis V. Lunev geschrieben: > > On 06/03/2016 03:30 PM, Kevin Wolf wrote: > > >This options allows to flush the image periodically during write tests. > > > > > >Signed-off-by: Kevin Wolf > > This

Re: [Qemu-block] [PATCH] block: Fix bdrv_all_delete_snapshot() error handling

2016-06-06 Thread Max Reitz
On 06.06.2016 12:56, Kevin Wolf wrote: > The code to exit the loop after bdrv_snapshot_delete_by_id_or_name() > returned failure was duplicated. The first copy of it was too early so > that the AioContext lock would not be freed. This patch removes it so > that only the second, correct copy

Re: [Qemu-block] [PATCH] iotests: 095: Clean up QEMU before showing image info

2016-06-06 Thread Max Reitz
On 03.06.2016 11:07, Fam Zheng wrote: > Somehow in my locking series, I missed this case where concurrent access > to an image is performed, perhaps we can remove this case independently. > > Signed-off-by: Fam Zheng > --- > tests/qemu-iotests/095 | 2 ++ > 1 file changed, 2

Re: [Qemu-block] [PATCH] iotests: 095: Clean up QEMU before showing image info

2016-06-06 Thread Max Reitz
On 03.06.2016 11:07, Fam Zheng wrote: > Somehow in my locking series, I missed this case where concurrent access > to an image is performed, perhaps we can remove this case independently. > > Signed-off-by: Fam Zheng > --- > tests/qemu-iotests/095 | 2 ++ > 1 file changed, 2

[Qemu-block] [PATCH] block: Fix bdrv_all_delete_snapshot() error handling

2016-06-06 Thread Kevin Wolf
The code to exit the loop after bdrv_snapshot_delete_by_id_or_name() returned failure was duplicated. The first copy of it was too early so that the AioContext lock would not be freed. This patch removes it so that only the second, correct copy remains. Signed-off-by: Kevin Wolf

Re: [Qemu-block] [PATCH 4/5] qemu-img bench: Implement -S (step size)

2016-06-06 Thread Denis V. Lunev
On 06/03/2016 03:30 PM, Kevin Wolf wrote: With this new option, qemu-img bench can be told to advance the current offset after each request by a different value than the buffer size. This is useful for controlling the conditions for cluster allocation in image formats (e.g. qcow2 cluster

Re: [Qemu-block] [PATCH 3/5] qemu-img bench: Make start offset configurable

2016-06-06 Thread Denis V. Lunev
On 06/03/2016 03:30 PM, Kevin Wolf wrote: This patch adds an option the specify the offset of the first request made by qemu-img bench. This allows to benchmark misaligned requests. Signed-off-by: Kevin Wolf --- qemu-img-cmds.hx | 4 ++-- qemu-img.c | 23

Re: [Qemu-block] [PATCH 1/5] qemu-img bench

2016-06-06 Thread Denis V. Lunev
On 06/03/2016 03:30 PM, Kevin Wolf wrote: This adds a qemu-img command that allows doing some simple benchmarks for the block layer without involving guest devices and a real VM. For the start, this implements only a test of sequential reads. Signed-off-by: Kevin Wolf ---

Re: [Qemu-block] [PULL 01/31] block: Fix bdrv_next() memory leak

2016-06-06 Thread Paolo Bonzini
On 25/05/2016 19:39, Kevin Wolf wrote: > @@ -395,20 +399,27 @@ int bdrv_all_delete_snapshot(const char *name, > BlockDriverState **first_bad_bs, > { > int ret = 0; > BlockDriverState *bs; > -BdrvNextIterator *it = NULL; > +BdrvNextIterator it; > QEMUSnapshotInfo sn1,

Re: [Qemu-block] [Qemu-devel] [PATCH v2] blockdev: clean up error handling in do_open_tray

2016-06-06 Thread Markus Armbruster
Colin Lord writes: > Returns negative error codes and accompanying error messages in cases where > the device has no tray or the tray is locked and isn't forced open. This > extra information should result in better flexibility in functions that > call do_open_tray. > >