Re: [Qemu-devel] [PATCH 08/10] block: Reuse bs-options setting from bdrv_open()

2014-01-26 Thread Benoît Canet
Le Sunday 26 Jan 2014 à 20:02:41 (+0100), Max Reitz a écrit : Setting bs-options in bdrv_file_open() is not necessary if it is already done in bdrv_open(). Signed-off-by: Max Reitz mre...@redhat.com --- block.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git

Re: [Qemu-devel] [PATCH 07/10] block: Reuse fail path from bdrv_open()

2014-01-26 Thread Benoît Canet
Le Sunday 26 Jan 2014 à 20:02:40 (+0100), Max Reitz a écrit : The fail paths of bdrv_file_open() and bdrv_open() naturally exhibit similarities, thus it is possible to reuse the one from bdrv_open() and shorten the one in bdrv_file_open() accordingly. Signed-off-by: Max Reitz

[Qemu-devel] [PATCH v12 00/11] Drop in_use from BlockDriverState and enable point-in-time snapshot exporting over NBD

2014-01-26 Thread Fam Zheng
This series adds for point-in-time snapshot NBD exporting based on blockdev-backup (variant of drive-backup with existing device as target). We get a thin point-in-time snapshot by COW mechanism of drive-backup, and export it through built in NBD server. The steps are as below: 1. (SHELL)

[Qemu-devel] [PATCH v12 01/11] block: Add BlockOpType enum

2014-01-26 Thread Fam Zheng
This adds the enum of all the operations that can be taken on a block device. Signed-off-by: Fam Zheng f...@redhat.com --- include/block/block.h | 19 +++ 1 file changed, 19 insertions(+) diff --git a/include/block/block.h b/include/block/block.h index 963a61f..9626650 100644

[Qemu-devel] [PATCH v12 06/11] block: Add backing_blocker in BlockDriverState

2014-01-26 Thread Fam Zheng
This makes use of op_blocker and blocks all the operations except for commit target, on each BlockDriverState-backing_hd. The asserts for op_blocker in bdrv_swap are removed because with this change, the target of block commit has at least the backing blocker of its child, so the assertion is not

[Qemu-devel] [PATCH v12 03/11] block: Replace in_use with operation blocker

2014-01-26 Thread Fam Zheng
This drops BlockDriverState.in_use with op_blockers: - Call bdrv_op_block_all in place of bdrv_set_in_use(bs, 1). - Call bdrv_op_unblock_all in place of bdrv_set_in_use(bs, 0). - Check bdrv_op_is_blocked() in place of bdrv_in_use(bs). The specific types are used, e.g. in place of

[Qemu-devel] [PATCH v12 05/11] block: Add bdrv_set_backing_hd()

2014-01-26 Thread Fam Zheng
This is the common but non-trivial steps to assign or change the backing_hd of BDS. Signed-off-by: Fam Zheng f...@redhat.com --- block.c | 39 ++- include/block/block.h | 1 + 2 files changed, 31 insertions(+), 9 deletions(-) diff --git

[Qemu-devel] [PATCH v12 02/11] block: Introduce op_blockers to BlockDriverState

2014-01-26 Thread Fam Zheng
BlockDriverState.op_blockers is an array of lists with BLOCK_OP_TYPE_MAX elements. Each list is a list of blockers of an operation type (BlockOpType), that marks this BDS as currently blocked for a certain type of operation with reason errors stored in the list. The rule of usage is: * BDS user

[Qemu-devel] [PATCH v12 10/11] qmp: Add command 'blockdev-backup'

2014-01-26 Thread Fam Zheng
Similar to drive-backup, but this command uses a device id as target instead of creating/opening an image file. Also add blocker on target bs, since the target is also a named device now. Signed-off-by: Fam Zheng f...@redhat.com --- block/backup.c | 21 + blockdev.c

[Qemu-devel] [PATCH v12 04/11] block: Move op_blocker check from block_job_create to its caller

2014-01-26 Thread Fam Zheng
It makes no sense to check for any blocker on bs, we are here only because of the mechanical conversion from in_use to op_blockers. Remove it now, and let the callers check specific operation types. Backup and mirror already have it, add checker to stream and commit. Signed-off-by: Fam Zheng

[Qemu-devel] [PATCH v12 09/11] stream: Use bdrv_drop_intermediate and drop close_unused_images

2014-01-26 Thread Fam Zheng
This reuses the new bdrv_drop_intermediate. Signed-off-by: Fam Zheng f...@redhat.com --- block/stream.c | 30 +- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/block/stream.c b/block/stream.c index dd0b4ac..9cdcf0e 100644 --- a/block/stream.c +++

[Qemu-devel] [PATCH v12 07/11] block: Parse backing option to reference existing BDS

2014-01-26 Thread Fam Zheng
Now it's safe to allow reference for backing_hd in the interface. Signed-off-by: Fam Zheng f...@redhat.com --- block.c | 26 -- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index 4498ce7..be58d93 100644 --- a/block.c +++ b/block.c @@

[Qemu-devel] [PATCH v12 11/11] block: Allow backup on referenced named BlockDriverState

2014-01-26 Thread Fam Zheng
Drive backup is a read only operation on source bs. We want to allow this specific case to enable image-fleecing. Note that when image-fleecing job starts, the job still add its blocker to source bs, and any other operation on it will be blocked by that. Signed-off-by: Fam Zheng f...@redhat.com

[Qemu-devel] [PATCH v12 08/11] block: Support dropping active in bdrv_drop_intermediate

2014-01-26 Thread Fam Zheng
Dropping intermediate could be useful both for commit and stream, and BDS refcnt plus bdrv_swap could do most of the job nicely. It also needs to work with op blockers. Signed-off-by: Fam Zheng f...@redhat.com --- block.c| 146 +

<    1   2