Re: [Qemu-block] [PATCH 17/18] block: introduce block_account_one_io

2017-05-25 Thread Fam Zheng
On Thu, 05/11 16:42, Paolo Bonzini wrote: > -void block_acct_done(BlockAcctStats *stats, BlockAcctCookie *cookie) > +static void block_account_one_io(BlockAcctStats *stats, BlockAcctCookie > *cookie, bool failed) This line is too long. Can be fixed when applying, though. Fam

Re: [Qemu-block] [Qemu-devel] [PATCH v2 5/5] blkdebug: Support .bdrv_co_get_block_status

2017-05-25 Thread Fam Zheng
0 TEST_DIR/t.IMGFMT > +0x3c0 0x110 TEST_DIR/t.IMGFMT > +0x6a0 0x160 TEST_DIR/t.IMGFMT > No errors were found on the image. > *** done > -- > 2.9.4 > > Reviewed-by: Fam Zheng <f...@redhat.com>

Re: [Qemu-block] [Qemu-devel] [PATCH v2 4/5] block: Simplify use of BDRV_BLOCK_RAW

2017-05-25 Thread Fam Zheng
o_get_block_status(BlockDriverState *bs, > if (be32_to_cpu(footer->type) == VHD_FIXED) { > *pnum = nb_sectors; > *file = bs->file->bs; > -return BDRV_BLOCK_RAW | BDRV_BLOCK_OFFSET_VALID | BDRV_BLOCK_DATA | > +return BDRV_BLOCK_RAW | BDRV_BLOCK_OFFSET_VALID | > (sector_num << BDRV_SECTOR_BITS); > } > > -- > 2.9.4 > > Reviewed-by: Fam Zheng <f...@redhat.com>

Re: [Qemu-block] [PATCH v2 3/5] block: Allow NULL file for bdrv_get_block_status()

2017-05-25 Thread Fam Zheng
On Wed, 05/24 15:28, Eric Blake wrote: > Not all callers care about which BDS owns the mapping for a given > range of the file. This patch merely simplifies the callers by > consolidating the logic in the common call point, while guaranteeing > a non-NULL file to all the driver callbacks, for no

Re: [Qemu-block] [PATCH v2 2/5] block: Guarantee that *file is set on bdrv_get_block_status()

2017-05-25 Thread Fam Zheng
ead 30408704/30408704 bytes at offset 80740352 > 29 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > read 23068672/23068672 bytes at offset 49056 > 22 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > +Offset Length File > +0 0x800 blkdebug::TEST_DIR/t.IMGFMT > No errors were found on the image. > *** done > -- > 2.9.4 > Reviewed-by: Fam Zheng <f...@redhat.com>

Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/5] qemu-io: Don't die on second open

2017-05-24 Thread Fam Zheng
force_share, opts); > +openfile(NULL, flags, writethrough, force_share, opts); > } else { > QDECREF(opts); > -return qemuio_command_usage(_cmd); > + qemuio_command_usage(_cmd); > } > +return 0; > } > > static int quit_f(BlockBackend *blk, int argc, char **argv) > -- > 2.9.4 > > This is better, thanks! Reviewed-by: Fam Zheng <f...@redhat.com>

Re: [Qemu-block] [Qemu-devel] [PATCH 1/4] qemu-io: Don't die on second open

2017-05-24 Thread Fam Zheng
On Thu, 05/18 21:32, Eric Blake wrote: > Failure to open a file in qemu-io should normally return 1 on > failure to end the command loop, on the presumption that when > batching commands all on the command line, failure to open means > nothing further can be attempted. But when executing qemu-io >

Re: [Qemu-block] [PATCH 0/4] Block migration (migrate -b) fixes

2017-05-24 Thread Fam Zheng
On Tue, 05/23 16:01, Kevin Wolf wrote: > Kevin Wolf (4): > block: Fix anonymous BBs in blk_root_inactivate() > migration: Inactivate images after .save_live_complete_precopy() > migration/block: Clean up BBs in block_save_complete() > qemu-iotests: Block migration test R

[Qemu-block] [PATCH v3 13/16] blk: fix aio context loss on media change

2017-05-23 Thread Fam Zheng
crash on virtio_scsi_ctx_check: Assertion `blk_get_aio_context(d->conf.blk) == s->ctx' failed. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> Signed-off-by: Fam Zheng <f...@redhat.com> --- block/block-backend.c | 6 ++ 1 file changed, 6 insertions(+)

[Qemu-block] [PATCH v3 15/16] block: Add perm assertion on blk_set_aio_context

2017-05-23 Thread Fam Zheng
Now that all BB users comply with the BLK_PERM_AIO_CONTEXT_CHANGE rule, we can assert it. Signed-off-by: Fam Zheng <f...@redhat.com> --- block/block-backend.c | 4 1 file changed, 4 insertions(+) diff --git a/block/block-backend.c b/block/block-backend.c index dfe577d..51c62ea

[Qemu-block] [PATCH v3 10/16] mirror: Do initial aio context move of target via BB interface

2017-05-23 Thread Fam Zheng
-off-by: Fam Zheng <f...@redhat.com> --- block/mirror.c | 54 -- blockdev.c | 4 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index a3337ee..4eccb8d 100644 --- a/block/mirror.c

[Qemu-block] [PATCH v3 08/16] mirror: Request aio context change permission on target

2017-05-23 Thread Fam Zheng
What's done in the source's context change notifier is moving the target's context to follow the new one, so we request this permission here. Signed-off-by: Fam Zheng <f...@redhat.com> --- block/mirror.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/mirror.c b/block/mirror.c

[Qemu-block] [PATCH v3 05/16] block: Propagate BLK_PERM_AIO_CONTEXT_CHANGE down the graph

2017-05-23 Thread Fam Zheng
bdrv_set_aio_context can take care of children recursively, so it is okay to pass down the perm. Signed-off-by: Fam Zheng <f...@redhat.com> --- block.c | 10 ++ block/vvfat.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/block.c b/block.c index d

[Qemu-block] [PATCH v3 16/16] tests: Add test case for BLK_PERM_AIO_CONTEXT_CHANGE

2017-05-23 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> --- tests/Makefile.include | 2 ++ tests/test-blk-perm.c | 59 ++ 2 files changed, 61 insertions(+) create mode 100644 tests/test-blk-perm.c diff --git a/tests/Makefile.include b/tests/Makefile.i

[Qemu-block] [PATCH v3 06/16] backup: Request BLK_PERM_AIO_CONTEXT_CHANGE on target

2017-05-23 Thread Fam Zheng
What's done in the source's context change notifier is moving the target's context to follow the new one, so we request this permission here. Signed-off-by: Fam Zheng <f...@redhat.com> --- block/backup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/backup.c b

[Qemu-block] [PATCH v3 07/16] backup: Do initial aio context move of target via BB interface

2017-05-23 Thread Fam Zheng
this through blk_set_aio_context interface, in backup_job_create() which is a central place for both drive-backup and blockdev-backup, to take care of the compatibility check. Also the bdrv_set_aio_context in do_drive_backup could have been conditional, to save a recursion when possible. Signed-off-by: Fam

[Qemu-block] [PATCH v3 12/16] virtio-blk: Request BLK_PERM_AIO_CONTEXT_CHANGE for dataplane

2017-05-23 Thread Fam Zheng
blk_set_aio_context is audited by perm API, so follow the protocol and request for permission first. Previously the return code in error path was hardcoded as -EPERM, but returning 'r' is more meaningful here both for the new error and existing ones. Signed-off-by: Fam Zheng <f...@redhat.

[Qemu-block] [PATCH v3 09/16] commit: Allow aio context change on s->base

2017-05-23 Thread Fam Zheng
The block job has the aio context change notifier, we should allow it here as well. Signed-off-by: Fam Zheng <f...@redhat.com> --- block/commit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/commit.c b/block/commit.c index e2ee0ff..bbf7768 100644 --- a

[Qemu-block] [PATCH v3 03/16] blockjob: Add BLK_PERM_AIO_CONTEXT_CHANGE shared perm on bs

2017-05-23 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> --- blockjob.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/blockjob.c b/blockjob.c index 6e48932..b20fb86 100644 --- a/blockjob.c +++ b/blockjob.c @@ -214,6 +214,9 @@ void *block_job_create(const char *job_id, const BlockJobDriver *

[Qemu-block] [PATCH v3 14/16] nbd: Allow BLK_PERM_AIO_CONTEXT_CHANGE on BB

2017-05-23 Thread Fam Zheng
This is safe because of the aio context notifier we'll register on this node. So allow it. Signed-off-by: Fam Zheng <f...@redhat.com> --- nbd/server.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nbd/server.c b/nbd/server.c index 924a1fe..a8f58fb 100644 ---

[Qemu-block] [PATCH v3 02/16] block-backend: Add blk_request_perm

2017-05-23 Thread Fam Zheng
This function tries to request, if not granted yet, for the given permissions. Signed-off-by: Fam Zheng <f...@redhat.com> --- block/block-backend.c | 12 include/sysemu/block-backend.h | 1 + 2 files changed, 13 insertions(+) diff --git a/block/block-backend.c b

[Qemu-block] [PATCH v3 04/16] blockjob: Allow aio context change on intermediate nodes

2017-05-23 Thread Fam Zheng
The intermediate nodes do work with aio context change, so allow that operations. Signed-off-by: Fam Zheng <f...@redhat.com> --- block/commit.c | 3 ++- block/mirror.c | 3 ++- block/stream.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/block/commit.c b/block/co

[Qemu-block] [PATCH v3 00/16] block: Protect AIO context change with perm API

2017-05-23 Thread Fam Zheng
proper bdrv_set_aio_context(). Store the AioContext in BB and do it in blk_insert_bs. That is done by Vladimir's patch. Other patches are to make sure such a bdrv_set_aio_context() doesn't interfere with other BBs using other nodes from this graph. Fam Fam Zheng (15): block: Define

[Qemu-block] [PATCH v3 01/16] block: Define BLK_PERM_AIO_CONTEXT_CHANGE

2017-05-23 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> --- block.c | 2 ++ include/block/block.h | 7 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index 50ba264..d98662f 100644 --- a/block.c +++ b/block.c @@ -1649,6 +1649,8 @@ char *bdrv_perm

Re: [Qemu-block] [PATCH v2 10/16] mirror: Do initial aio context move of target via BB interface

2017-05-23 Thread Fam Zheng
On Thu, 05/11 16:27, Stefan Hajnoczi wrote: > On Wed, Apr 19, 2017 at 05:43:50PM +0800, Fam Zheng wrote: > > diff --git a/blockdev.c b/blockdev.c > > index dfd1385..53f9874 100644 > > --- a/blockdev.c > > +++ b/blockdev.c > > @@ -3556,8 +3556,6 @@ void qmp_dri

Re: [Qemu-block] [PATCH v2 02/16] block-backend: Add blk_request_perm

2017-05-23 Thread Fam Zheng
On Thu, 05/11 15:32, Stefan Hajnoczi wrote: > On Wed, Apr 19, 2017 at 05:43:42PM +0800, Fam Zheng wrote: > > This function tries to request, if not granted yet, for the given > > permissions. > > > > Signed-off-by: Fam Zheng <f...@redhat.com> > > --- &

Re: [Qemu-block] [Qemu-devel] [PATCH] iotests: 147: Don't test inet6 if not available

2017-05-17 Thread Fam Zheng
On Fri, 05/05 11:41, Daniel P. Berrange wrote: > On Fri, May 05, 2017 at 06:21:53PM +0800, Fam Zheng wrote: > > This is the case in our docker tests, as we use --net=none there. Skip > > this method. > > > > Signed-off-by: Fam Zheng <f...@redhat.com> > &

Re: [Qemu-block] [Qemu-devel] [PATCH] iotests: 147: Don't test inet6 if not available

2017-05-17 Thread Fam Zheng
On Wed, 05/17 13:59, Kevin Wolf wrote: > Am 17.05.2017 um 04:13 hat Fam Zheng geschrieben: > > On Fri, 05/05 18:21, Fam Zheng wrote: > > > This is the case in our docker tests, as we use --net=none there. Skip > > > this method. > > > > Ping. Is this pa

Re: [Qemu-block] [Qemu-devel] [PATCH] iotests: 147: Don't test inet6 if not available

2017-05-16 Thread Fam Zheng
On Fri, 05/05 18:21, Fam Zheng wrote: > This is the case in our docker tests, as we use --net=none there. Skip > this method. Ping. Is this patch okay? > > Signed-off-by: Fam Zheng <f...@redhat.com> > --- > tests/qemu-iotests/147 | 7 +++ > 1 file changed, 7 in

Re: [Qemu-block] [Qemu-devel] [PATCH] block/win32: fix 'ret not initialized' warning

2017-05-16 Thread Fam Zheng
ptions, "locking", false)) { > > error_setg(errp, "locking=on is not supported on Windows"); > > +ret = -EINVAL; > > goto fail; > > } > > > This is a bug fix for commit 1c3a555c. > > Reviewed-by: Stefan Weil <s...@weilnetz.de> > > Thank you! Reviewed-by: Fam Zheng <f...@redhat.com>

Re: [Qemu-block] [Qemu-devel] [PATCH] block: Use QDict helpers for --force-share

2017-05-15 Thread Fam Zheng
qdict_put(opts, BDRV_OPT_FORCE_SHARE, qbool_from_bool(true)); > +qdict_put_bool(opts, BDRV_OPT_FORCE_SHARE, true); > } > qemuio_blk = blk_new_open(name, NULL, opts, flags, _err); > if (!qemuio_blk) { > -- > 2.9.4 > > Reviewed-by: Fam Zheng <f...@redhat.com>

Re: [Qemu-block] [Qemu-devel] [RFC PATCH] qemu-io: add drain/undrain cmd

2017-05-15 Thread Fam Zheng
On Mon, 05/15 16:02, Peter Lieven wrote: > > > do you have a pointer to the image locking mechanism? > > It hit qemu.git master just a moment ago. See raw_check_perm. > > which master are you looking at? > > $ git fetch upstream > $ git log upstream/master --oneline > 3a87606 Merge tag

[Qemu-block] [PATCH] qemu-img: Fix leakage of options on error

2017-05-15 Thread Fam Zheng
Reported by Coverity. Signed-off-by: Fam Zheng <f...@redhat.com> --- qemu-img.c | 1 + 1 file changed, 1 insertion(+) diff --git a/qemu-img.c b/qemu-img.c index b506839..8b0dfa7 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -294,6 +294,7 @@ static BlockBackend *img_open_opts(const char *

Re: [Qemu-block] [Qemu-devel] [RFC PATCH] qemu-io: add drain/undrain cmd

2017-05-15 Thread Fam Zheng
On Mon, 05/15 14:32, Peter Lieven wrote: > Am 15.05.2017 um 14:28 schrieb Fam Zheng: > > On Mon, 05/15 13:58, Peter Lieven wrote: > > > Am 15.05.2017 um 13:53 schrieb Fam Zheng: > > > > On Mon, 05/15 13:26, Peter Lieven wrote: > > > > > Am 15.05.2017 u

Re: [Qemu-block] [Qemu-devel] [RFC PATCH] qemu-io: add drain/undrain cmd

2017-05-15 Thread Fam Zheng
On Mon, 05/15 12:02, Peter Lieven wrote: > Hi Block developers, > > I would like to add a feature to Qemu to drain all traffic from a block so > that > I can take external snaphosts without the risk to that in the middle of a > write > operation. Its meant for cases where where QGA freeze/thaw

Re: [Qemu-block] [PATCH v8 0/4] Improve convert and dd commands

2017-05-15 Thread Fam Zheng
On Fri, 05/12 19:41, Max Reitz wrote: > The fun is increased by the fact that the locking series has > (inadvertently) removed the -B documentation from convert, so there is > another conflict looming in the future... Sorry about the mistake there.. I've posted a patch for that: [Qemu-devel]

[Qemu-block] [PATCH] qemu-img: Fix documentation of convert

2017-05-15 Thread Fam Zheng
It got lost in commit a8d16f9ca "qemu-img: Update documentation for -U". Reported-by: Max Reitz <mre...@redhat.com> Signed-off-by: Fam Zheng <f...@redhat.com> --- qemu-img-cmds.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu-img-cmds.hx b/

Re: [Qemu-block] [PULL 05/58] qemu-img: Update documentation for -U

2017-05-15 Thread Fam Zheng
On Fri, 05/12 19:37, Max Reitz wrote: > On 2017-05-11 16:32, Kevin Wolf wrote: > > From: Fam Zheng <f...@redhat.com> > > > > Signed-off-by: Fam Zheng <f...@redhat.com> > > Signed-off-by: Kevin Wolf <kw...@redhat.com> > > --- > > qemu-img

Re: [Qemu-block] [PATCH v17 23/23] tests: Add POSIX image locking test case 182

2017-05-11 Thread Fam Zheng
On Thu, 05/11 12:08, Kevin Wolf wrote: > Am 02.05.2017 um 18:35 hat Fam Zheng geschrieben: > > Signed-off-by: Fam Zheng <f...@redhat.com> > > --- > > tests/qemu-iotests/182 | 73 > > ++ > > tests/qemu-iot

Re: [Qemu-block] [Qemu-devel] [PATCH v8 3/4] qemu-img: introduce --target-image-opts for 'convert' command

2017-05-09 Thread Fam Zheng
gh, it would be > possible to use image-opts syntax. This adds --target-image-opts > to indicate that the target filename includes options. Currently > this mandates use of the --skip-create flag too. > > Signed-off-by: Daniel P. Berrange <berra...@redhat.com> Reviewed-by: Fam Zheng <f...@redhat.com>

Re: [Qemu-block] [Qemu-devel] [PATCH] block: Simplify BDRV_BLOCK_RAW recursion

2017-05-09 Thread Fam Zheng
v_co_get_block_status(*file, ret >> BDRV_SECTOR_BITS, > + *pnum, pnum, file); > goto out; > } > > -- > 2.9.3 > > Reviewed-by: Fam Zheng <f...@redhat.com>

Re: [Qemu-block] [PATCH v3] aio: add missing aio_notify() to aio_enable_external()

2017-05-08 Thread Fam Zheng
completes the SCSI disk will be > unresponsive. This leads to request timeouts inside the guest. > > Reported-by: Qianqian Zhu <qi...@redhat.com> > Suggested-by: Fam Zheng <f...@redhat.com> > Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com> > --- > v3: >

[Qemu-block] [PATCH] iotests: 147: Don't test inet6 if not available

2017-05-05 Thread Fam Zheng
This is the case in our docker tests, as we use --net=none there. Skip this method. Signed-off-by: Fam Zheng <f...@redhat.com> --- tests/qemu-iotests/147 | 7 +++ 1 file changed, 7 insertions(+) diff --git a/tests/qemu-iotests/147 b/tests/qemu-iotests/147 index 32afea6..db34838

Re: [Qemu-block] [PATCH v2] aio: add missing aio_notify() to aio_enable_external()

2017-05-05 Thread Fam Zheng
On Fri, 05/05 11:02, Stefan Hajnoczi wrote: > diff --git a/include/block/aio.h b/include/block/aio.h > index 406e323..b3d6f76 100644 > --- a/include/block/aio.h > +++ b/include/block/aio.h > @@ -454,8 +454,14 @@ static inline void aio_disable_external(AioContext *ctx) > */ > static inline void

Re: [Qemu-block] [PATCH v17 00/23] block: Image locking series

2017-05-04 Thread Fam Zheng
On Thu, 05/04 15:09, Kevin Wolf wrote: > Am 02.05.2017 um 18:35 hat Fam Zheng geschrieben: > > v17: Fixes addressing comments by Kevin: > > - Rebase on top of kevin/block > > - In test case 153, don't compile test program, just try locking=on and > >

Re: [Qemu-block] [PATCH] aio: add missing aio_notify() to aio_enable_external()

2017-05-04 Thread Fam Zheng
timeouts inside the guest. > > I agree this is the minimal fix and is the right thing to do. The > bdrv_drained_begin/end device callbacks would also make it possible to > remove disable/enable external altogether, but that's more invasive. > > Reviewed-by: Paolo Bonzini <pbonz...@red

Re: [Qemu-block] [Qemu-devel] [PATCH for 2.10 00/17] Block layer thread safety, part 1

2017-05-04 Thread Fam Zheng
emoved > together with all temporary workarounds that have accumulated. Thanks! I had a few nits and questions, but it's pretty good in general: Reviewed-by: Fam Zheng <f...@redhat.com> Fam

Re: [Qemu-block] [Qemu-devel] [PATCH 16/17] block: protect modification of dirty bitmaps with a mutex

2017-05-04 Thread Fam Zheng
On Thu, 04/20 14:00, Paolo Bonzini wrote: > @@ -400,7 +431,8 @@ BlockDirtyInfoList > *bdrv_query_dirty_bitmaps(BlockDriverState *bs) > return list; > } > > -int bdrv_get_dirty(BlockDriverState *bs, BdrvDirtyBitmap *bitmap, > +/* Called within bdrv_dirty_bitmap_lock..unlock */ > +int

Re: [Qemu-block] [Qemu-devel] [PATCH 15/17] block: introduce dirty_bitmap_mutex

2017-05-04 Thread Fam Zheng
On Thu, 04/20 14:00, Paolo Bonzini wrote: > diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c > index 519737c..e13718e 100644 > --- a/block/dirty-bitmap.c > +++ b/block/dirty-bitmap.c > @@ -52,6 +52,24 @@ struct BdrvDirtyBitmapIter { > BdrvDirtyBitmap *bitmap; > }; > > +static

Re: [Qemu-block] [Qemu-devel] [PATCH 09/17] util: add stats64 module

2017-05-04 Thread Fam Zheng
On Thu, 04/20 14:00, Paolo Bonzini wrote: > +static inline void stat64_rdlock(Stat64 *s) > +{ > +/* Keep out incoming writers to avoid them starving us. */ > +atomic_add(>lock, 2); > + > +/* If there is a concurrent writer, wait for it. */ > +while (atomic_read(>lock) & 1) { > +

Re: [Qemu-block] [Qemu-devel] [PATCH 13/17] coroutine-lock: introduce qemu_co_mutex_lock_unlock

2017-05-04 Thread Fam Zheng
On Thu, 04/20 14:00, Paolo Bonzini wrote: > +if (atomic_cmpxchg(>locked, waiters, waiters + 1) != waiters) { Is it still useful to try the fast path again if there are now even more waiters, i.e. "atomic_cmpxchg(...) > waiters"? > +goto retry_fast_path; > +} > + > +

Re: [Qemu-block] [Qemu-devel] [PATCH 12/17] block: protect tracked_requests and flush_queue with reqs_lock

2017-05-04 Thread Fam Zheng
On Thu, 04/20 14:00, Paolo Bonzini wrote: > Signed-off-by: Paolo Bonzini > --- > block.c | 1 + > block/io.c| 20 +--- > include/block/block_int.h | 12 +++- > 3 files changed, 25 insertions(+), 8 deletions(-) > >

Re: [Qemu-block] [Qemu-devel] [PATCH 09/17] util: add stats64 module

2017-05-04 Thread Fam Zheng
On Thu, 04/20 14:00, Paolo Bonzini wrote: > This module provides fast paths for 64-bit atomic operations on machines > that only have 32-bit atomic access. Interesting patch! Out of curiosity: what are the machines here, besides i386? It strikes me as they are old and slow anyway, then why this

Re: [Qemu-block] [Qemu-devel] [PATCH 08/17] throttle-groups: protect throttled requests with a CoMutex

2017-05-04 Thread Fam Zheng
On Thu, 04/20 14:00, Paolo Bonzini wrote: > Signed-off-by: Paolo Bonzini > --- > block/block-backend.c | 1 + > block/throttle-groups.c| 11 +-- > include/sysemu/block-backend.h | 7 ++- > 3 files changed, 12 insertions(+), 7 deletions(-) > >

Re: [Qemu-block] [PATCH v17 18/23] block: Reuse bs as backing hd for drive-backup sync=none

2017-05-02 Thread Fam Zheng
On Wed, 05/03 00:35, Fam Zheng wrote: > Opening the backing image for the second time is bad, especially here > when it is also in use as the active image as the source. The > drive-backup job itself doesn't read from target->backing for COW, > instead it gets data from the write no

[Qemu-block] [PATCH v17 20/23] osdep: Fall back to posix lock when OFD lock is unavailable

2017-05-02 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> --- util/osdep.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/util/osdep.c b/util/osdep.c index 3de4a18..a2863c8 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -38,6 +38,14 @@ extern int madvise(c

[Qemu-block] [PATCH v17 18/23] block: Reuse bs as backing hd for drive-backup sync=none

2017-05-02 Thread Fam Zheng
ing the target to NBD etc. won't work, because of the likely stale metadata cache. Use BDRV_O_NO_BACKING in this case and manually set up the backing BdrvChild. Cc: qemu-sta...@nongnu.org Signed-off-by: Fam Zheng <f...@redhat.com> --- blockdev.c | 15 ++- 1 file changed, 14 inserti

[Qemu-block] [PATCH v17 22/23] qemu-iotests: Add test case 153 for image locking

2017-05-02 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> --- tests/qemu-iotests/153 | 233 +++ tests/qemu-iotests/153.out | 390 + tests/qemu-iotests/group | 1 + 3 files changed, 624 insertions(+) create mode 100755 test

[Qemu-block] [PATCH v17 16/23] file-win32: Error out if locking=on

2017-05-02 Thread Fam Zheng
We share the same set of QAPI options with file-posix, but locking is not supported here. So error out if it is specified as 'on' for now. Signed-off-by: Fam Zheng <f...@redhat.com> --- block/file-win32.c | 5 + 1 file changed, 5 insertions(+) diff --git a/block/file-win32.c b/bloc

[Qemu-block] [PATCH v17 15/23] file-posix: Add 'locking' option

2017-05-02 Thread Fam Zheng
Making this option available even before implementing it will let converting tests easier: in coming patches they can specify the option already when necessary, before we actually write code to lock the images. Signed-off-by: Fam Zheng <f...@redhat.com> --- block/file-posix.c | 5 +

[Qemu-block] [PATCH v17 23/23] tests: Add POSIX image locking test case 182

2017-05-02 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> --- tests/qemu-iotests/182 | 73 ++ tests/qemu-iotests/182.out | 8 + tests/qemu-iotests/group | 1 + 3 files changed, 82 insertions(+) create mode 100755 tests/qemu-iotests/182 create mode

[Qemu-block] [PATCH v17 17/23] tests: Disable image lock in test-replication

2017-05-02 Thread Fam Zheng
The COLO block replication architecture requires one disk to be shared between primary and secondary, in the test both processes use posix file protocol (instead of over NBD) so it is affected by image locking. Disable the lock. Signed-off-by: Fam Zheng <f...@redhat.com> --- test

[Qemu-block] [PATCH v17 21/23] file-posix: Add image locking to perm operations

2017-05-02 Thread Fam Zheng
the same permission is translated to a shared lock of a separate byte. With that, we use 2x number of bytes of distinct permission types. virtlockd in libvirt locks the first byte, so we do locking from a higher offset. Suggested-by: Kevin Wolf <kw...@redhat.com> Signed-off-by: Fam Zheng <f...@r

[Qemu-block] [PATCH v17 19/23] osdep: Add qemu_lock_fd and qemu_unlock_fd

2017-05-02 Thread Fam Zheng
They are wrappers of POSIX fcntl "file private locking", with a convenient "try lock" wrapper implemented with F_OFD_GETLK. Signed-off-by: Fam Zheng <f...@redhat.com> Reviewed-by: Max Reitz <mre...@redhat.com> --- include/qemu/osdep.h |

[Qemu-block] [PATCH v17 07/23] iotests: 030: Prepare for image locking

2017-05-02 Thread Fam Zheng
qemu-img and qemu-io commands when guest is running need "-U" option, add it. Signed-off-by: Fam Zheng <f...@redhat.com> --- tests/qemu-iotests/030 | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/0

[Qemu-block] [PATCH v17 14/23] tests: Use null-co:// instead of /dev/null as the dummy image

2017-05-02 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> Reviewed-by: Max Reitz <mre...@redhat.com> --- tests/drive_del-test.c| 2 +- tests/nvme-test.c | 2 +- tests/usb-hcd-uhci-test.c | 2 +- tests/usb-hcd-xhci-test.c | 2 +- tests/virtio-blk-test.c | 2 +- tests/virtio-scsi

[Qemu-block] [PATCH v17 12/23] iotests: 091: Quit QEMU before checking image

2017-05-02 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> Reviewed-by: Max Reitz <mre...@redhat.com> --- tests/qemu-iotests/091 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qemu-iotests/091 b/tests/qemu-iotests/091 index 32bbd56..10ac4a8 100755 --- a/tests/qemu-iotests/091 +++

[Qemu-block] [PATCH v17 13/23] iotests: 172: Use separate images for multiple devices

2017-05-02 Thread Fam Zheng
To avoid image lock failures. Signed-off-by: Fam Zheng <f...@redhat.com> --- tests/qemu-iotests/172 | 55 +- tests/qemu-iotests/172.out | 50 + 2 files changed, 56 insertions(+), 49 deletions(-) diff

[Qemu-block] [PATCH v17 11/23] iotests: 087: Don't attach test image twice

2017-05-02 Thread Fam Zheng
The test scenario doesn't require the same image, instead it focuses on the duplicated node-name, so use null-co to avoid locking conflict. Reviewed-by: Max Reitz <mre...@redhat.com> Signed-off-by: Fam Zheng <f...@redhat.com> --- tests/qemu-iotests/087 | 6 ++ 1 file changed,

[Qemu-block] [PATCH v17 10/23] iotests: 085: Avoid image locking conflict

2017-05-02 Thread Fam Zheng
In the case where we test the expected error when a blockdev-snapshot target already has a backing image, the backing chain is opened multiple times. This will be a problem when we use image locking, so use a different backing file that is not already open. Signed-off-by: Fam Zheng &l

[Qemu-block] [PATCH v17 05/23] qemu-img: Update documentation for -U

2017-05-02 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> --- qemu-img-cmds.hx | 36 ++-- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx index bf4ce59..e5bc28f 100644 --- a/qemu-img-cmds.hx +++ b/qemu-img-cmds.hx @@

[Qemu-block] [PATCH v17 09/23] iotests: 055: Don't attach the target image already for drive-backup

2017-05-02 Thread Fam Zheng
Double attach is not a valid usage of the target image, drive-backup will open the blockdev itself so skip the add_drive call in this case. Signed-off-by: Fam Zheng <f...@redhat.com> Reviewed-by: Max Reitz <mre...@redhat.com> --- tests/qemu-iotests/055 | 32 ++-

[Qemu-block] [PATCH v17 08/23] iotests: 046: Prepare for image locking

2017-05-02 Thread Fam Zheng
The qemu-img info command is executed while VM is running, add -U option to avoid the image locking error. Signed-off-by: Fam Zheng <f...@redhat.com> --- tests/qemu-iotests/046 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotes

[Qemu-block] [PATCH v17 04/23] qemu-img: Add --force-share option to subcommands

2017-05-02 Thread Fam Zheng
This will force the opened images to allow sharing all permissions with other programs. Signed-off-by: Fam Zheng <f...@redhat.com> --- qemu-img.c | 154 ++--- 1 file changed, 118 insertions(+), 36 deletions(-) diff --git a/qemu-i

[Qemu-block] [PATCH v17 06/23] qemu-io: Add --force-share option

2017-05-02 Thread Fam Zheng
Add --force-share/-U to program options and -U to open subcommand. Signed-off-by: Fam Zheng <f...@redhat.com> --- qemu-io.c | 42 ++ 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/qemu-io.c b/qemu-io.c index 427cbae..cf4b876

[Qemu-block] [PATCH v17 03/23] block: Respect "force-share" in perm propagating

2017-05-02 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> --- block.c | 32 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/block.c b/block.c index 710ba04..70ca7b4 100644 --- a/block.c +++ b/block.c @@ -1467,6 +1467,22 @@ static int bdrv_child_chec

[Qemu-block] [PATCH v17 01/23] block: Make bdrv_perm_names public

2017-05-02 Thread Fam Zheng
It can be used outside of block.c for making user friendly messages. Signed-off-by: Fam Zheng <f...@redhat.com> --- block.c | 2 +- include/block/block.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index 6c6bb3e..d8fcad9

[Qemu-block] [PATCH v17 02/23] block: Add, parse and store "force-share" option

2017-05-02 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> --- block.c | 17 + include/block/block.h | 1 + include/block/block_int.h | 1 + qapi/block-core.json | 3 +++ 4 files changed, 22 insertions(+) diff --git a/block.c b/block.c index d8fcad9..710ba04

[Qemu-block] [PATCH v17 00/23] block: Image locking series

2017-05-02 Thread Fam Zheng
ddress Max's comments. - Add reviewed-by from Max and Eric. - Rebase for 2.10: * Use op blocker API * Add --unsafe-read for qemu-img and qemu-io Fam Zheng (23): block: Make bdrv_perm_names public block: Add, parse and store "force-share" option block: Respe

Re: [Qemu-block] [PATCH v16 21/22] qemu-iotests: Add test case 153 for image locking

2017-05-02 Thread Fam Zheng
On Tue, 05/02 16:59, Kevin Wolf wrote: > Am 02.05.2017 um 10:18 hat Fam Zheng geschrieben: > > Signed-off-by: Fam Zheng <f...@redhat.com> > > --- > > tests/qemu-iotests/153 | 247 > >

Re: [Qemu-block] [PATCH v16 15/22] file-posix: Add 'locking' option

2017-05-02 Thread Fam Zheng
On Tue, 05/02 16:15, Kevin Wolf wrote: > > diff --git a/qapi/block-core.json b/qapi/block-core.json > > index 1cf29a1..29d3040 100644 > > --- a/qapi/block-core.json > > +++ b/qapi/block-core.json > > @@ -2127,11 +2127,15 @@ > > # > > # @filename:path to the image file > > # @aio:

[Qemu-block] [PATCH v16 21/22] qemu-iotests: Add test case 153 for image locking

2017-05-02 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> --- tests/qemu-iotests/153 | 247 tests/qemu-iotests/153.out | 390 + tests/qemu-iotests/group | 1 + 3 files changed, 638 insertions(+) create mode 100755 test

[Qemu-block] [PATCH v16 16/22] tests: Disable image lock in test-replication

2017-05-02 Thread Fam Zheng
The COLO block replication architecture requires one disk to be shared between primary and secondary, in the test both processes use posix file protocol (instead of over NBD) so it is affected by image locking. Disable the lock. Signed-off-by: Fam Zheng <f...@redhat.com> --- test

[Qemu-block] [PATCH v16 15/22] file-posix: Add 'locking' option

2017-05-02 Thread Fam Zheng
Making this option available even before implementing it will let converting tests easier: in coming patches they can specify the option already when necessary, before we actually write code to lock the images. Signed-off-by: Fam Zheng <f...@redhat.com> --- block/file-posix.c | 5 +

[Qemu-block] [PATCH v16 10/22] iotests: 085: Avoid image locking conflict

2017-05-02 Thread Fam Zheng
In the case where we test the expected error when a blockdev-snapshot target already has a backing image, the backing chain is opened multiple times. This will be a problem when we use image locking, so use a different backing file that is not already open. Signed-off-by: Fam Zheng &l

[Qemu-block] [PATCH v16 18/22] osdep: Add qemu_lock_fd and qemu_unlock_fd

2017-05-02 Thread Fam Zheng
They are wrappers of POSIX fcntl "file private locking", with a convenient "try lock" wrapper implemented with F_OFD_GETLK. Signed-off-by: Fam Zheng <f...@redhat.com> Reviewed-by: Max Reitz <mre...@redhat.com> --- include/qemu/osdep.h |

[Qemu-block] [PATCH v16 19/22] osdep: Fall back to posix lock when OFD lock is unavailable

2017-05-02 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> --- util/osdep.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/util/osdep.c b/util/osdep.c index 3de4a18..a2863c8 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -38,6 +38,14 @@ extern int madvise(c

[Qemu-block] [PATCH v16 20/22] file-posix: Add image locking to perm operations

2017-05-02 Thread Fam Zheng
the same permission is translated to a shared lock of a separate byte. With that, we use 2x number of bytes of distinct permission types. virtlockd in libvirt locks the first byte, so we do locking from a higher offset. Suggested-by: Kevin Wolf <kw...@redhat.com> Signed-off-by: Fam Zheng <f...@r

[Qemu-block] [PATCH v16 22/22] tests: Add POSIX image locking test case 182

2017-05-02 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> --- tests/qemu-iotests/182 | 73 ++ tests/qemu-iotests/182.out | 8 + tests/qemu-iotests/group | 1 + 3 files changed, 82 insertions(+) create mode 100755 tests/qemu-iotests/182 create mode

[Qemu-block] [PATCH v16 17/22] block: Reuse bs as backing hd for drive-backup sync=none

2017-05-02 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> --- blockdev.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/blockdev.c b/blockdev.c index 6428206..e1facf5 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3174,6 +3174,7 @@ static BlockJob *do_drive_backup(Drive

[Qemu-block] [PATCH v16 14/22] tests: Use null-co:// instead of /dev/null as the dummy image

2017-05-02 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> Reviewed-by: Max Reitz <mre...@redhat.com> --- tests/drive_del-test.c| 2 +- tests/nvme-test.c | 2 +- tests/usb-hcd-uhci-test.c | 2 +- tests/usb-hcd-xhci-test.c | 2 +- tests/virtio-blk-test.c | 2 +- tests/virtio-scsi

[Qemu-block] [PATCH v16 13/22] iotests: 172: Use separate images for multiple devices

2017-05-02 Thread Fam Zheng
To avoid image lock failures. Signed-off-by: Fam Zheng <f...@redhat.com> --- tests/qemu-iotests/172 | 55 +- tests/qemu-iotests/172.out | 50 + 2 files changed, 56 insertions(+), 49 deletions(-) diff

[Qemu-block] [PATCH v16 12/22] iotests: 091: Quit QEMU before checking image

2017-05-02 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> Reviewed-by: Max Reitz <mre...@redhat.com> --- tests/qemu-iotests/091 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qemu-iotests/091 b/tests/qemu-iotests/091 index 32bbd56..10ac4a8 100755 --- a/tests/qemu-iotests/091 +++

[Qemu-block] [PATCH v16 08/22] iotests: 046: Prepare for image locking

2017-05-02 Thread Fam Zheng
The qemu-img info command is executed while VM is running, add -U option to avoid the image locking error. Signed-off-by: Fam Zheng <f...@redhat.com> --- tests/qemu-iotests/046 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotes

[Qemu-block] [PATCH v16 04/22] qemu-img: Add --force-share option to subcommands

2017-05-02 Thread Fam Zheng
This will force the opened images to allow sharing all permissions with other programs. Signed-off-by: Fam Zheng <f...@redhat.com> --- qemu-img.c | 154 ++--- 1 file changed, 118 insertions(+), 36 deletions(-) diff --git a/qemu-i

[Qemu-block] [PATCH v16 07/22] iotests: 030: Prepare for image locking

2017-05-02 Thread Fam Zheng
qemu-img and qemu-io commands when guest is running need "-U" option, add it. Signed-off-by: Fam Zheng <f...@redhat.com> --- tests/qemu-iotests/030 | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/0

[Qemu-block] [PATCH v16 02/22] block: Add, parse and store "force-share" option

2017-05-02 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> --- block.c | 17 + include/block/block.h | 1 + include/block/block_int.h | 1 + qapi/block-core.json | 3 +++ 4 files changed, 22 insertions(+) diff --git a/block.c b/block.c index dd272cb..3e77fa4

[Qemu-block] [PATCH v16 03/22] block: Respect "force-share" in perm propagating

2017-05-02 Thread Fam Zheng
Signed-off-by: Fam Zheng <f...@redhat.com> --- block.c | 32 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/block.c b/block.c index 3e77fa4..e33f221 100644 --- a/block.c +++ b/block.c @@ -1467,6 +1467,22 @@ static int bdrv_child_chec

[Qemu-block] [PATCH v16 06/22] qemu-io: Add --force-share option

2017-05-02 Thread Fam Zheng
Add --force-share/-U to program options and -U to open subcommand. Signed-off-by: Fam Zheng <f...@redhat.com> --- qemu-io.c | 42 ++ 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/qemu-io.c b/qemu-io.c index 427cbae..cf4b876

[Qemu-block] [PATCH v16 01/22] block: Make bdrv_perm_names public

2017-05-02 Thread Fam Zheng
It can be used outside of block.c for making user friendly messages. Signed-off-by: Fam Zheng <f...@redhat.com> --- block.c | 2 +- include/block/block.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index 7b557f3..dd272cb

<    4   5   6   7   8   9   10   11   12   13   >