[Qemu-block] [PATCH v5 07/13] nbd-server: Clear can_read when device io blocker is set

2015-05-20 Thread Fam Zheng
So that NBD export cannot submit IO during bdrv_drain_all(). Signed-off-by: Fam Zheng f...@redhat.com --- nbd.c | 24 1 file changed, 24 insertions(+) diff --git a/nbd.c b/nbd.c index 06b501b..b5026af 100644 --- a/nbd.c +++ b/nbd.c @@ -160,6 +160,8 @@ struct NBDExport {

[Qemu-block] [PATCH v5 02/13] block: Add op blocker notifier list

2015-05-20 Thread Fam Zheng
BDS users can register a notifier and get notified about op blocker changes. Signed-off-by: Fam Zheng f...@redhat.com Reviewed-by: Max Reitz mre...@redhat.com --- block.c | 35 +++ include/block/block.h | 8

[Qemu-block] [PATCH v5 00/13] Fix transactional snapshot with dataplane and NBD export

2015-05-20 Thread Fam Zheng
v5: Patch 13: set blocker before bdrv_drain(). v4: virtio-scsi-dataplane: Use assert in ctrl/event queue handler. [Paolo] Protect mirror complete in new patch 13. [Wen] Add Max's rev-by in 02, 03, 04. Fix 05, 06 per Max's comments. Reported by Paolo. Unlike the iohandler in main

[Qemu-block] [PATCH v5 04/13] virtio-blk: Move complete_request to 'ops' structure

2015-05-20 Thread Fam Zheng
Should more ops be added to differentiate code between dataplane and non-dataplane, the new saved_ops approach will be cleaner than messing with N pointers. Signed-off-by: Fam Zheng f...@redhat.com Reviewed-by: Max Reitz mre...@redhat.com --- hw/block/dataplane/virtio-blk.c | 13 -

[Qemu-block] [PATCH v5 03/13] block-backend: Add blk_op_blocker_add_notifier

2015-05-20 Thread Fam Zheng
Forward the call to bdrv_op_blocker_add_notifier. Signed-off-by: Fam Zheng f...@redhat.com Reviewed-by: Max Reitz mre...@redhat.com --- block/block-backend.c | 6 ++ include/sysemu/block-backend.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/block/block-backend.c

Re: [Qemu-block] [PATCH v3 00/13] main-loop: Get rid of fd_read_poll and qemu_set_fd_handler2

2015-05-20 Thread Fam Zheng
On Wed, 05/20 08:26, Paolo Bonzini wrote: On 19/05/2015 17:02, Stefan Hajnoczi wrote: 1. Convert everything like you converted qemu-nbd.c. This is a conservative approach and we can be confident that behavior is unchanged. So, that means whenever you change receive_disabled you

[Qemu-block] [PATCH v5 01/13] block: Add op blocker type device IO

2015-05-20 Thread Fam Zheng
It blocks device IO. All bdrv_op_block_all/blk_op_block_all callers are taken care of: - virtio_blk_data_plane_create - virtio_scsi_hotplug Device creation, unblock it. - bdrv_set_backing_hd Backing hd is not used by device, so blocking is OK. - backup_start Blocking target when

[Qemu-block] [PATCH v5 06/13] virtio-scsi-dataplane: Add device IO op blocker listener

2015-05-20 Thread Fam Zheng
When a disk is attached to scsi-bus, virtio_scsi_hotplug will take care of protecting the block device with op blockers. Currently we haven't enabled block jobs (like what's done in virtio_blk_data_plane_create), but it is necessary to honor device IO op blocker first before we do. This is useful

Re: [Qemu-block] [PATCH v5 13/13] block/mirror: Block device IO during mirror exit

2015-05-20 Thread Paolo Bonzini
On 20/05/2015 08:16, Fam Zheng wrote: static void mirror_exit(BlockJob *job, void *opaque) @@ -328,6 +330,8 @@ static void mirror_exit(BlockJob *job, void *opaque) MirrorExitData *data = opaque; AioContext *replace_aio_context = NULL; +bdrv_op_unblock(s-common.bs,

Re: [Qemu-block] [PATCH v5 13/13] block/mirror: Block device IO during mirror exit

2015-05-20 Thread Fam Zheng
On Wed, 05/20 08:32, Paolo Bonzini wrote: On 20/05/2015 08:16, Fam Zheng wrote: static void mirror_exit(BlockJob *job, void *opaque) @@ -328,6 +330,8 @@ static void mirror_exit(BlockJob *job, void *opaque) MirrorExitData *data = opaque; AioContext *replace_aio_context =

[Qemu-block] [PATCH v5 05/13] virtio-blk: Don't handle output when there is device IO op blocker

2015-05-20 Thread Fam Zheng
virtio-blk now listens to op blocker change of the associated block backend. Up on setting op blocker on BLOCK_OP_TYPE_DEVICE_IO: non-dataplane: 1) Set VirtIOBlock.paused 2) In virtio_blk_handle_output, do nothing if VirtIOBlock.paused dataplane: 1) Clear the host event notifier

[Qemu-block] [PATCH v5 09/13] blockdev: Block device IO during external snapshot transaction

2015-05-20 Thread Fam Zheng
Signed-off-by: Fam Zheng f...@redhat.com --- blockdev.c | 18 -- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/blockdev.c b/blockdev.c index 7f763d9..923fc90 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1404,6 +1404,7 @@ typedef struct ExternalSnapshotState {

[Qemu-block] [PATCH v5 08/13] blockdev: Block device IO during internal snapshot transaction

2015-05-20 Thread Fam Zheng
Signed-off-by: Fam Zheng f...@redhat.com --- blockdev.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/blockdev.c b/blockdev.c index 5eaf77e..7f763d9 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1262,6 +1262,7 @@ typedef struct InternalSnapshotState {

[Qemu-block] [PATCH v5 12/13] block: Block device IO during bdrv_drain and bdrv_drain_all

2015-05-20 Thread Fam Zheng
We don't want new requests from guest, so block the operation around the nested poll. It also avoids looping forever when iothread is submitting a lot of requests. Signed-off-by: Fam Zheng f...@redhat.com --- block/io.c | 22 -- 1 file changed, 20 insertions(+), 2

[Qemu-block] [PATCH v5 13/13] block/mirror: Block device IO during mirror exit

2015-05-20 Thread Fam Zheng
When mirror should complete, the source and target are in sync. But we call bdrv_swap() only a while later in the main loop bh. If the guest writes something before that, target will not get the new data. Block device IO before bdrv_drain and unblock it after bdrw_swap(). Reported-by: Wen

Re: [Qemu-block] [Qemu-devel] [PATCH 7/8] fdc: Fix MSR.RQM flag

2015-05-20 Thread Kevin Wolf
Am 19.05.2015 um 22:40 hat John Snow geschrieben: On 05/19/2015 11:36 AM, Kevin Wolf wrote: The RQM bit in MSR should be set whenever the guest is supposed to access the FIFO, and it should be cleared in all other cases. This is important so the guest can't continue writing/reading the

[Qemu-block] [PATCH v4 5/5] raw-posix: Introduce hdev_is_sg()

2015-05-20 Thread Dimitris Aragiorgis
Until now, an SG device was identified only by checking if its path started with /dev/sg. Then, hdev_open() set bs-sg accordingly. This is very fragile, e.g. it fails with symlinks or relative paths. We should rely on the actual properties of the device instead of the specified file path. Test

Re: [Qemu-block] [Qemu-devel] [PATCH 6/8] fdc: Disentangle phases in fdctrl_read_data()

2015-05-20 Thread John Snow
On 05/20/2015 04:25 AM, Kevin Wolf wrote: Am 19.05.2015 um 22:40 hat John Snow geschrieben: On 05/19/2015 11:36 AM, Kevin Wolf wrote: This commit makes similar improvements as have already been made to the write function: Instead of relying on a flag in the MSR to distinguish controller

Re: [Qemu-block] [PATCH] MAINTAINERS: Add header files to Block Layer Core section

2015-05-20 Thread Alberto Garcia
On Wed 20 May 2015 12:05:55 PM CEST, Kevin Wolf kw...@redhat.com wrote: Suggested-by: Markus Armbruster arm...@redhat.com Signed-off-by: Kevin Wolf kw...@redhat.com Reviewed-by: Alberto Garcia be...@igalia.com Berto

Re: [Qemu-block] [Qemu-devel] [PATCH v4 11/11] qmp-commands.hx: Update the supported 'transaction' operations

2015-05-20 Thread Kashyap Chamarthy
On Tue, May 19, 2015 at 11:37:32AM -0400, John Snow wrote: On Mon, May 18, 2015 at 06:22:22PM +0200, Max Reitz wrote: On 12.05.2015 01:04, John Snow wrote: [. . .] diff --git a/qmp-commands.hx b/qmp-commands.hx index 7506774..363126a 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx

Re: [Qemu-block] [Qemu-devel] [PATCH 3/8] fdc: Introduce fdctrl-phase

2015-05-20 Thread John Snow
On 05/20/2015 05:24 AM, Peter Maydell wrote: On 20 May 2015 at 09:43, Kevin Wolf kw...@redhat.com wrote: Am 20.05.2015 um 10:06 hat Peter Maydell geschrieben: That handles migration, which is good. But I still think that storing the same information in two places in the device state (phase

[Qemu-block] [PATCH] MAINTAINERS: Split Block QAPI, monitor, command line off core

2015-05-20 Thread Markus Armbruster
Kevin and Stefan asked me to take care of this part. Signed-off-by: Markus Armbruster arm...@redhat.com --- MAINTAINERS | 8 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index b3552b2..8df0c6a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -812,6 +812,14 @@ F:

Re: [Qemu-block] [Qemu-devel] [PATCH 7/8] fdc: Fix MSR.RQM flag

2015-05-20 Thread John Snow
On 05/20/2015 04:14 AM, Kevin Wolf wrote: Am 19.05.2015 um 22:40 hat John Snow geschrieben: On 05/19/2015 11:36 AM, Kevin Wolf wrote: The RQM bit in MSR should be set whenever the guest is supposed to access the FIFO, and it should be cleared in all other cases. This is important so the

Re: [Qemu-block] [Qemu-devel] [PATCH v4 06/11] block: add refcount to Job object

2015-05-20 Thread Stefan Hajnoczi
On Tue, May 19, 2015 at 06:15:23PM -0400, John Snow wrote: On 05/18/2015 11:45 AM, Stefan Hajnoczi wrote: On Mon, May 11, 2015 at 07:04:21PM -0400, John Snow wrote: If we want to get at the job after the life of the job, we'll need a refcount for this object. This may occur for example

Re: [Qemu-block] [Qemu-devel] [PATCH 6/8] fdc: Disentangle phases in fdctrl_read_data()

2015-05-20 Thread Kevin Wolf
Am 19.05.2015 um 22:40 hat John Snow geschrieben: On 05/19/2015 11:36 AM, Kevin Wolf wrote: This commit makes similar improvements as have already been made to the write function: Instead of relying on a flag in the MSR to distinguish controller phases, use the explicit phase that we

[Qemu-block] [PATCH v4 3/5] raw-posix: DPRINTF instead of DEBUG_BLOCK_PRINT

2015-05-20 Thread Dimitris Aragiorgis
Building the QEMU tools fails if we #define DEBUG_BLOCK inside block/raw-posix.c. Here instead of adding qemu-log.o in block-obj-y so that DEBUG_BLOCK_PRINT can be used, we substitute the latter with a simple DPRINTF() (that does not cause bit-rot). Signed-off-by: Dimitris Aragiorgis

[Qemu-block] [PATCH v4 0/5] Some fixes related to scsi-generic

2015-05-20 Thread Dimitris Aragiorgis
Hi all, These four patches make slight changes to the way QEMU handles SCSI generic devices to fix a number of small problems. I am sending them against the master branch, since I don't know if they can be considered bugfixes. Thanks, dimara v4 (rebased to current master): * Avoid errno

Re: [Qemu-block] [Qemu-devel] [PATCH 3/8] fdc: Introduce fdctrl-phase

2015-05-20 Thread Kevin Wolf
Am 20.05.2015 um 10:06 hat Peter Maydell geschrieben: On 20 May 2015 at 08:54, Kevin Wolf kw...@redhat.com wrote: Am 19.05.2015 um 22:57 hat Peter Maydell geschrieben: Yeah, if there's genuinely an underlying state machine that's not completely visible in registers you need to actually

[Qemu-block] [PATCH v4 1/5] block: Use bdrv_is_sg() everywhere

2015-05-20 Thread Dimitris Aragiorgis
Instead of checking bs-sg use bdrv_is_sg() consistently throughout the code. Signed-off-by: Dimitris Aragiorgis dim...@arrikto.com Reviewed-by: Paolo Bonzini pbonz...@redhat.com --- block.c |6 +++--- block/iscsi.c |2 +- block/raw-posix.c |4 ++-- 3 files changed, 6

[Qemu-block] [PATCH v4 2/5] Fix migration in case of scsi-generic

2015-05-20 Thread Dimitris Aragiorgis
During migration, QEMU uses fsync()/fdatasync() on the open file descriptor for read-write block devices to flush data just before stopping the VM. However, fsync() on a scsi-generic device returns -EINVAL which causes the migration to fail. This patch skips flushing data in case of an SG device,

[Qemu-block] [PATCH v4 4/5] raw-posix: Use DPRINTF for DEBUG_FLOPPY

2015-05-20 Thread Dimitris Aragiorgis
Get rid of several #ifdef DEBUG_FLOPPY and substitute them with DPRINTF. Signed-off-by: Dimitris Aragiorgis dim...@arrikto.com --- block/raw-posix.c | 22 +- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index

Re: [Qemu-block] [PATCH v3 00/13] main-loop: Get rid of fd_read_poll and qemu_set_fd_handler2

2015-05-20 Thread Stefan Hajnoczi
On Wed, May 20, 2015 at 8:39 AM, Paolo Bonzini pbonz...@redhat.com wrote: On 20/05/2015 08:38, Fam Zheng wrote: On Wed, 05/20 08:26, Paolo Bonzini wrote: On 19/05/2015 17:02, Stefan Hajnoczi wrote: 1. Convert everything like you converted qemu-nbd.c. This is a conservative approach and we

[Qemu-block] [PATCH] MAINTAINERS: Add header files to Block Layer Core section

2015-05-20 Thread Kevin Wolf
Suggested-by: Markus Armbruster arm...@redhat.com Signed-off-by: Kevin Wolf kw...@redhat.com --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index b3552b2..9ff7c36 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -785,6 +785,7 @@ S: Supported F: block*

Re: [Qemu-block] [Qemu-devel] [PATCH 3/8] fdc: Introduce fdctrl-phase

2015-05-20 Thread Peter Maydell
On 20 May 2015 at 09:43, Kevin Wolf kw...@redhat.com wrote: Am 20.05.2015 um 10:06 hat Peter Maydell geschrieben: That handles migration, which is good. But I still think that storing the same information in two places in the device state (phase field and the register fields) is error-prone.

Re: [Qemu-block] [Qemu-devel] [PATCH 01/34] qdict: Add qdict_array_entries()

2015-05-20 Thread Alberto Garcia
On Fri 08 May 2015 10:06:35 PM CEST, Eric Blake wrote: +for (i = 0; i UINT_MAX; i++) { +QObject *subqobj; +int subqdict_entries; +size_t slen = 32 + subqdict_len; +char indexstr[slen], prefix[slen]; And more dependence on a working C99 compiler, thanks

Re: [Qemu-block] [Qemu-devel] [PATCH] MAINTAINERS: Split Block QAPI, monitor, command line off core

2015-05-20 Thread Eric Blake
On 05/20/2015 05:23 AM, Markus Armbruster wrote: Kevin and Stefan asked me to take care of this part. Signed-off-by: Markus Armbruster arm...@redhat.com --- MAINTAINERS | 8 1 file changed, 8 insertions(+) Reviewed-by: Eric Blake ebl...@redhat.com diff --git a/MAINTAINERS

[Qemu-block] [PULL 03/12] tests: Use qtest_add_data_func() consistently

2015-05-20 Thread Andreas Färber
Replace uses of g_test_add_data_func() for QTest test cases. It is still valid to use it for any non-QTest test cases, which are not run for multiple target binaries. Suggested-by: John Snow js...@redhat.com Reviewed-by: John Snow js...@redhat.com Signed-off-by: Andreas Färber afaer...@suse.de

Re: [Qemu-block] [PATCH COLO v4 00/15] Block replication for continuous checkpoints

2015-05-20 Thread Wen Congyang
On 05/21/2015 03:18 AM, Dr. David Alan Gilbert wrote: * Wen Congyang (we...@cn.fujitsu.com) wrote: Block replication is a very important feature which is used for continuous checkpoints(for example: COLO). Usage: Please refer to docs/block-replication.txt You can get the patch here:

[Qemu-block] [PATCH COLO-Block v5 03/15] Allow creating backup jobs when opening BDS

2015-05-20 Thread Wen Congyang
When opening BDS, we need to create backup jobs for image-fleecing. Signed-off-by: Wen Congyang we...@cn.fujitsu.com Signed-off-by: zhanghailiang zhang.zhanghaili...@huawei.com Signed-off-by: Gonglei arei.gong...@huawei.com Cc: Jeff Cody jc...@redhat.com --- block/Makefile.objs | 2 +- 1 file

[Qemu-block] [PATCH COLO-Block v5 12/15] skip nbd_target when starting block replication

2015-05-20 Thread Wen Congyang
Signed-off-by: Wen Congyang we...@cn.fujitsu.com Signed-off-by: zhanghailiang zhang.zhanghaili...@huawei.com Signed-off-by: Gonglei arei.gong...@huawei.com --- block.c | 12 1 file changed, 12 insertions(+) diff --git a/block.c b/block.c index 74fd3d6..961e395 100644 --- a/block.c

[Qemu-block] [PATCH COLO-Block v5 15/15] Implement new driver for block replication

2015-05-20 Thread Wen Congyang
Signed-off-by: Wen Congyang we...@cn.fujitsu.com Signed-off-by: zhanghailiang zhang.zhanghaili...@huawei.com Signed-off-by: Gonglei arei.gong...@huawei.com --- block/Makefile.objs | 1 + block/replication.c | 441 2 files changed, 442

[Qemu-block] [PATCH COLO-Block v5 05/15] Backup: clear all bitmap when doing block checkpoint

2015-05-20 Thread Wen Congyang
Signed-off-by: Wen Congyang we...@cn.fujitsu.com Signed-off-by: zhanghailiang zhang.zhanghaili...@huawei.com Signed-off-by: Gonglei arei.gong...@huawei.com Cc: Jeff Cody jc...@redhat.com --- block/backup.c | 13 + blockjob.c | 10 ++

[Qemu-block] [PATCH COLO-Block v5 02/15] allow writing to the backing file

2015-05-20 Thread Wen Congyang
Signed-off-by: Wen Congyang we...@cn.fujitsu.com Signed-off-by: zhanghailiang zhang.zhanghaili...@huawei.com Signed-off-by: Gonglei arei.gong...@huawei.com --- block.c | 33 - 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index

[Qemu-block] [PATCH COLO-Block v5 00/15] Block replication for continuous checkpoints

2015-05-20 Thread Wen Congyang
Block replication is a very important feature which is used for continuous checkpoints(for example: COLO). Usage: Please refer to docs/block-replication.txt You can get the patch here: https://github.com/wencongyang/qemu-colo/commits/block-replication-v5 The other newest COLO patchse will be

[Qemu-block] [PATCH COLO-Block v5 01/15] docs: block replication's description

2015-05-20 Thread Wen Congyang
Signed-off-by: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yang Hongyang yan...@cn.fujitsu.com Signed-off-by: zhanghailiang zhang.zhanghaili...@huawei.com Signed-off-by: Gonglei arei.gong...@huawei.com --- docs/block-replication.txt | 179 + 1 file

[Qemu-block] [PATCH COLO-Block v5 11/15] Add new block driver interfaces to control block replication

2015-05-20 Thread Wen Congyang
Signed-off-by: Wen Congyang we...@cn.fujitsu.com Signed-off-by: zhanghailiang zhang.zhanghaili...@huawei.com Signed-off-by: Gonglei arei.gong...@huawei.com Cc: Luiz Capitulino lcapitul...@redhat.com Cc: Michael Roth mdr...@linux.vnet.ibm.com Reviewed-by: Paolo Bonzini pbonz...@redhat.com ---

[Qemu-block] [PATCH COLO-Block v5 04/15] block: Parse backing_reference option to reference existing BDS

2015-05-20 Thread Wen Congyang
Usage: -drive file=xxx,id=Y, \ -drive file=,id=X,backing_reference.drive_id=Y,backing_reference.hidden-disk.* It will create such backing chain: {virtio-blk dev 'Y'} {virtio-blk dev 'X'} |

Re: [Qemu-block] [Qemu-devel] [PATCH 11/34] block: Allow references for backing files

2015-05-20 Thread Wen Congyang
On 05/09/2015 01:21 AM, Kevin Wolf wrote: For bs-file, using references to existing BDSes has been possible for a while already. This patch enables the same for bs-backing_hd. 1. We reference to an existing BDSes, and some disk uses this blk. Do we allow this? 2. bs-backing_hd-blk can be not

Re: [Qemu-block] [PATCH] MAINTAINERS: Split Block QAPI, monitor, command line off core

2015-05-20 Thread Kevin Wolf
Am 20.05.2015 um 13:23 hat Markus Armbruster geschrieben: Kevin and Stefan asked me to take care of this part. Signed-off-by: Markus Armbruster arm...@redhat.com Thanks, applied to the block branch. Kevin

Re: [Qemu-block] [PATCH 03/34] quorum: Use bdrv_open_image()

2015-05-20 Thread Alberto Garcia
On Fri 08 May 2015 07:21:35 PM CEST, Kevin Wolf wrote: Besides standardising on a single interface for opening child nodes, this simplifies the .bdrv_open() implementation of the quorum block driver by using block layer functionality for handling BlockdevRefs. Signed-off-by: Kevin Wolf

Re: [Qemu-block] [PATCH 05/34] block: Use macro for cache option names

2015-05-20 Thread Alberto Garcia
On Fri 08 May 2015 07:21:37 PM CEST, Kevin Wolf wrote: Signed-off-by: Kevin Wolf kw...@redhat.com Reviewed-by: Alberto Garcia be...@igalia.com Berto