Re: [Qemu-block] [PATCH] block/nfs: add support for setting debug level

2015-10-26 Thread Stefan Hajnoczi
On Thu, Oct 22, 2015 at 08:37:19AM +0200, Peter Lieven wrote: > Am 22.09.2015 um 08:13 schrieb Peter Lieven: > >Am 25.06.2015 um 15:18 schrieb Stefan Hajnoczi: > >>On Tue, Jun 23, 2015 at 10:12:15AM +0200, Peter Lieven wrote: > >>>upcoming libnfs versions will support logging debug messages. Add >

Re: [Qemu-block] [PATCH] block/nfs: add support for setting debug level

2015-10-26 Thread Peter Lieven
Am 26.10.2015 um 11:45 schrieb Stefan Hajnoczi: On Thu, Oct 22, 2015 at 08:37:19AM +0200, Peter Lieven wrote: Am 22.09.2015 um 08:13 schrieb Peter Lieven: Am 25.06.2015 um 15:18 schrieb Stefan Hajnoczi: On Tue, Jun 23, 2015 at 10:12:15AM +0200, Peter Lieven wrote: upcoming libnfs versions

[Qemu-block] [PATCH 8/9] block: Introduce BlockDriver.bdrv_drain callback

2015-10-26 Thread Fam Zheng
Drivers can have internal request sources that generate IO, like the need_check_timer in QED. Since we want quiesced periods that contain nested event loops in block layer, we need to have a way to disable such event sources. Block drivers must implement the "bdrv_drain" callback if it has any

[Qemu-block] [PATCH 6/9] block: Emulate bdrv_ioctl with bdrv_aio_ioctl and track both

2015-10-26 Thread Fam Zheng
Currently all drivers that support .bdrv_aio_ioctl also implement .bdrv_ioctl redundantly. To track ioctl requests in block layer it is easier if we unify the two paths, because we'll need to run it in a coroutine, as required by tracked_request_begin. While we're at it, use .bdrv_aio_ioctl plus

[Qemu-block] [PATCH v3 2/2] aio: Introduce aio-epoll.c

2015-10-26 Thread Fam Zheng
To minimize code duplication, epoll is hooked into aio-posix's aio_poll() instead of rolling its own. This approach also has both compile-time and run-time switchability. 1) When QEMU starts with a small number of fds in the event loop, ppoll is used. 2) When QEMU starts with a big number of

Re: [Qemu-block] [PATCH 0/2] blkverify: Fix BDS leak in .bdrv_open error path

2015-10-26 Thread Stefan Hajnoczi
On Tue, Oct 13, 2015 at 02:17:38PM +0200, Kevin Wolf wrote: > Kevin Wolf (2): > block: Allow bdrv_unref_child(bs, NULL) > blkverify: Fix BDS leak in .bdrv_open error path > > block.c | 7 ++- > block/blkverify.c | 3 +++ > 2 files changed, 9 insertions(+), 1 deletion(-) > > --

Re: [Qemu-block] [PATCH V2 0/4] ide: avoid main-loop hang on CDROM/NFS failure

2015-10-26 Thread Stefan Hajnoczi
On Mon, Oct 12, 2015 at 02:27:21PM +0200, Peter Lieven wrote: > This series aims at avoiding a hanging main-loop if a vserver has a > CDROM image mounted from a NFS share and that NFS share goes down. > Typical situation is that users mount an CDROM ISO to install something > and then forget to

Re: [Qemu-block] [Qemu-devel] [PULL 00/37] Block layer patches

2015-10-26 Thread Peter Maydell
On 23 October 2015 at 18:00, Kevin Wolf wrote: > The following changes since commit 1e700f4c6cddaf29ce1d205f0f8e8b9255481930: > > Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2015-10-23-tag' > into staging (2015-10-23 15:55:50 +0100) > > are available in the git

[Qemu-block] [PATCH 5/9] block: Add ioctl parameter fields to BlockRequest

2015-10-26 Thread Fam Zheng
The two fields that will be used by ioctl handling code later are added as union, because it's used exclusively by ioctl code which dosn't need the four fields in the other struct of the union. Signed-off-by: Fam Zheng --- include/block/block.h | 16 1 file

[Qemu-block] [PATCH 4/9] iscsi: Emulate commands in iscsi_aio_ioctl as iscsi_ioctl

2015-10-26 Thread Fam Zheng
iscsi_ioctl emulates SG_GET_VERSION_NUM and SG_GET_SCSI_ID. Now that bdrv_ioctl() will be emulated with .bdrv_aio_ioctl, replicate the logic into iscsi_aio_ioctl to make them consistent. Signed-off-by: Fam Zheng --- block/iscsi.c | 39 +-- 1

Re: [Qemu-block] [Qemu-devel] Dynamic reconfiguration

2015-10-26 Thread Markus Armbruster
Wen Congyang writes: > On 10/21/2015 04:27 PM, Markus Armbruster wrote: [...] >> Can we phrase the operation differently? Instead of "insert between A >> and B (silently replacing everything that is now between A and B)", >> say one of >> >> 1a. Replace node A by A <-

[Qemu-block] [PATCH 3/9] block: Track discard requests

2015-10-26 Thread Fam Zheng
Both bdrv_discard and bdrv_aio_discard will call into bdrv_co_discard, so add tracked_request_begin/end calls around the loop. Signed-off-by: Fam Zheng --- block/io.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/block/io.c b/block/io.c

[Qemu-block] [PATCH 0/9] block: Fixes for bdrv_drain

2015-10-26 Thread Fam Zheng
Previously bdrv_drain and bdrv_drain_all don't handle ioctl, flush and discard requests (which are fundamentally the same as read and write requests that change disk state). Forgetting such requests leaves us in risk of violating the invariant that bdrv_drain() callers rely on - all asynchronous

[Qemu-block] [PATCH 2/9] block: Track flush requests

2015-10-26 Thread Fam Zheng
Both bdrv_flush and bdrv_aio_flush eventually call bdrv_co_flush, add tracked_request_begin and tracked_request_end pair in that function so that all flush requests are now tracked. Signed-off-by: Fam Zheng --- block/io.c | 11 --- 1 file changed, 8 insertions(+), 3

[Qemu-block] [PATCH 1/9] block: Add more types for tracked request

2015-10-26 Thread Fam Zheng
We'll track more request types besides read and write, change the boolean field to an enum. Signed-off-by: Fam Zheng --- block/io.c| 9 + include/block/block_int.h | 10 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git

Re: [Qemu-block] [Qemu-devel] Dynamic reconfiguration

2015-10-26 Thread Wen Congyang
On 10/26/2015 03:24 PM, Markus Armbruster wrote: > Wen Congyang writes: > >> On 10/21/2015 04:27 PM, Markus Armbruster wrote: > [...] >>> Can we phrase the operation differently? Instead of "insert between A >>> and B (silently replacing everything that is now between A

[Qemu-block] [PATCH 7/9] block: Drop BlockDriver.bdrv_ioctl

2015-10-26 Thread Fam Zheng
Now the callback is not used any more, drop the field along with all implementations in block drivers, which are iscsi and raw. Signed-off-by: Fam Zheng --- block/iscsi.c | 33 - block/raw-posix.c | 9 -

[Qemu-block] [PATCH 9/9] qed: Implement .bdrv_drain

2015-10-26 Thread Fam Zheng
The "need_check_timer" is used to clear the "NEED_CHECK" flag in the image header after a grace period once metadata update has finished. In compliance to the bdrv_drain semantics we should make sure it remains deleted once .bdrv_drain is called. We cannot reuse qed_need_check_timer_cb because

[Qemu-block] [PATCH v3 1/2] aio: Introduce aio_context_setup

2015-10-26 Thread Fam Zheng
This is the place to initialize platform specific bits of AioContext. Signed-off-by: Fam Zheng --- aio-posix.c | 4 aio-win32.c | 4 async.c | 13 +++-- include/block/aio.h | 8 4 files changed, 27 insertions(+), 2

[Qemu-block] [PATCH v3 0/2] aio: Use epoll in aio_poll()

2015-10-26 Thread Fam Zheng
v3: Remove the redundant check in aio_epoll_try_enable. [Stefan] v2: Merge aio-epoll.c into aio-posix.c. [Paolo] Capture some benchmark data in commit log. This series adds the ability to use epoll in aio_poll() on Linux. It's switched on in a dynamic way rather than static for two reasons:

[Qemu-block] [PATCH v2 1/3] qemu-io: fix cvtnum lval types

2015-10-26 Thread John Snow
cvtnum() returns int64_t: we should not be storing this result inside of an int. In a few cases, we need an extra sprinkling of error handling where we expect to pass this number on towards a function that expects something smaller than int64_t. Reported-by: Max Reitz

[Qemu-block] [PATCH v8 12/15] hmp: Use blockdev-change-medium for change command

2015-10-26 Thread Max Reitz
Use separate code paths for the two overloaded functions of the 'change' HMP command, and invoke the 'blockdev-change-medium' QMP command if used on a block device (by calling qmp_blockdev_change_medium()). Signed-off-by: Max Reitz Reviewed-by: Eric Blake

[Qemu-block] [PATCH v8 13/15] blockdev: read-only-mode for blockdev-change-medium

2015-10-26 Thread Max Reitz
Add an option to qmp_blockdev_change_medium() which allows changing the read-only status of the block device whose medium is changed. Some drives do not have a inherently fixed read-only status; for instance, floppy disks can be set read-only or writable independently of the drive. Some users may

Re: [Qemu-block] [PATCH] block: allow best-effort query

2015-10-26 Thread Max Reitz
On 26.10.2015 19:12, John Snow wrote: > For more complex BDS trees that can be created under normal circumstances, > we lose the ability to issue query commands because of our inability to > re-construct the absolute filename. > > Instead, omit this field when it is a problem and present as much

[Qemu-block] [PATCH v8 05/15] blockdev: Add blockdev-close-tray

2015-10-26 Thread Max Reitz
Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- blockdev.c | 23 +++ qapi/block-core.json | 16 qmp-commands.hx | 35 +++ 3 files changed, 74 insertions(+) diff --git

[Qemu-block] [PATCH v8 10/15] block: Inquire tray state before tray-moved events

2015-10-26 Thread Max Reitz
blk_dev_change_media_cb() is called for all potential tray movements; however, it is possible to request closing the tray but nothing actually happening (on a floppy disk drive without a medium). Thus, the actual tray status should be inquired before sending a tray-moved event (and an event

[Qemu-block] [PATCH v8 15/15] iotests: Add test for change-related QMP commands

2015-10-26 Thread Max Reitz
Signed-off-by: Max Reitz --- tests/qemu-iotests/118 | 720 + tests/qemu-iotests/118.out | 5 + tests/qemu-iotests/group | 1 + 3 files changed, 726 insertions(+) create mode 100755 tests/qemu-iotests/118 create mode

[Qemu-block] [PATCH v8 00/15] blockdev: BlockBackend and media

2015-10-26 Thread Max Reitz
Now that the main rework part of this series is merged, these remaining patches here implement atomic tray/medium operations and add the read-only-mode parameter to change and blockdev-change-medium (which was the original purpose of this series!). Once again, I'd like to thank all the reviewers

[Qemu-block] [PATCH v8 04/15] blockdev: Add blockdev-open-tray

2015-10-26 Thread Max Reitz
Signed-off-by: Max Reitz --- blockdev.c | 36 qapi/block-core.json | 32 qmp-commands.hx | 48 3 files changed, 116 insertions(+) diff --git

[Qemu-block] [PATCH v8 14/15] hmp: Add read-only-mode option to change command

2015-10-26 Thread Max Reitz
Expose the new read-only-mode option of 'blockdev-change-medium' for the 'change' HMP command. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- hmp-commands.hx | 20 +--- hmp.c | 22 +- 2 files changed, 38

[Qemu-block] [PATCH v8 02/15] block: Make bdrv_states public

2015-10-26 Thread Max Reitz
When inserting a BDS tree into a BB, we will need to add the root BDS to this list. Since we will want to do that in the blockdev-insert-medium implementation in blockdev.c, we will need access to it there. This patch is not exactly elegant, but bdrv_states will be removed in the future anyway

[Qemu-block] [PATCH v8 06/15] blockdev: Add blockdev-remove-medium

2015-10-26 Thread Max Reitz
Signed-off-by: Max Reitz --- blockdev.c | 51 +++ qapi/block-core.json | 16 qmp-commands.hx | 45 + 3 files changed, 112 insertions(+) diff --git

[Qemu-block] [PATCH v8 03/15] block: Add functions for inheriting a BBRS

2015-10-26 Thread Max Reitz
In order to open a BDS which inherits a BB's root state, blk_get_open_flags_from_root_state() is used to inquire the flags to be passed to bdrv_open(), and blk_apply_root_state() is used to apply the remaining state after the BDS has been opened. Signed-off-by: Max Reitz ---

Re: [Qemu-block] [PATCH] block: allow best-effort query

2015-10-26 Thread John Snow
On 10/26/2015 05:18 PM, Max Reitz wrote: > On 26.10.2015 19:12, John Snow wrote: >> For more complex BDS trees that can be created under normal circumstances, >> we lose the ability to issue query commands because of our inability to >> re-construct the absolute filename. >> >> Instead, omit

[Qemu-block] [PATCH 3/3] qemu-io: Correct error messages

2015-10-26 Thread John Snow
Signed-off-by: John Snow --- qemu-io-cmds.c | 58 +- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index e2477fc..92c6b87 100644 --- a/qemu-io-cmds.c +++ b/qemu-io-cmds.c

[Qemu-block] [PATCH 2/3] qemu-io: Check for trailing chars

2015-10-26 Thread John Snow
Make sure there's not trailing garbage, e.g. "64k-whatever-i-want-here" Reported-by: Max Reitz Signed-off-by: John Snow --- qemu-io-cmds.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index

[Qemu-block] [PATCH 1/3] qemu-io: fix cvtnum lval types

2015-10-26 Thread John Snow
cvtnum() returns int64_t: we should not be storing this result inside of an int. In a few cases, we need an extra sprinkling of error handling where we expect to pass this number on towards a function that expects something smaller than int64_t. Signed-off-by: John Snow ---

[Qemu-block] [PATCH 0/3] qemu-io: clean up cvtnum usage

2015-10-26 Thread John Snow
cvtnum returns an int64_t, not an int, so correct the lvalue types wherever it is used. While we're at it, make the error messages more meaningful and hopefully less confusing. For convenience, this branch is

Re: [Qemu-block] [PATCH 1/3] qemu-io: fix cvtnum lval types

2015-10-26 Thread Eric Blake
On 10/26/2015 04:06 PM, John Snow wrote: > cvtnum() returns int64_t: we should not be storing this > result inside of an int. > > In a few cases, we need an extra sprinkling of error handling > where we expect to pass this number on towards a function that > expects something smaller than

[Qemu-block] [PATCH v8 07/15] blockdev: Add blockdev-insert-medium

2015-10-26 Thread Max Reitz
And a helper function for that, which directly takes a pointer to the BDS to be inserted instead of its node-name (which will be used for implementing 'change' using blockdev-insert-medium). Signed-off-by: Max Reitz --- blockdev.c | 56

Re: [Qemu-block] [PATCH 3/3] qemu-io: Correct error messages

2015-10-26 Thread John Snow
On 10/26/2015 06:54 PM, Eric Blake wrote: > On 10/26/2015 04:06 PM, John Snow wrote: >> Signed-off-by: John Snow >> --- >> qemu-io-cmds.c | 58 >> +- >> 1 file changed, 37 insertions(+), 21 deletions(-) >> >> diff --git

[Qemu-block] [PATCH] ide: remove hardcoded 2GiB transactional limit

2015-10-26 Thread John Snow
Not that you can request a >2GiB transaction, but that's why checking for it makes no sense anymore. With the newer 'limit' parameter to prepare_buf, we no longer need a static limit. The maximum limit is still 2GiB, but the limit parameter is set to the current transaction size, which cannot

Re: [Qemu-block] [PATCH 2/3] qemu-io: Check for trailing chars

2015-10-26 Thread Eric Blake
On 10/26/2015 04:44 PM, Eric Blake wrote: > On 10/26/2015 04:06 PM, John Snow wrote: >> Make sure there's not trailing garbage, e.g. >> "64k-whatever-i-want-here" >> >> Reported-by: Max Reitz >> Signed-off-by: John Snow >> --- >> qemu-io-cmds.c | 9 -

Re: [Qemu-block] [PATCH] block: allow best-effort query

2015-10-26 Thread Max Reitz
On 26.10.2015 22:34, John Snow wrote: > > > On 10/26/2015 05:18 PM, Max Reitz wrote: >> On 26.10.2015 19:12, John Snow wrote: >>> For more complex BDS trees that can be created under normal circumstances, >>> we lose the ability to issue query commands because of our inability to >>>

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

2015-10-26 Thread Wen Congyang
On 10/16/2015 07:37 PM, Stefan Hajnoczi wrote: > On Fri, Oct 16, 2015 at 10:22:05AM +0800, Wen Congyang wrote: >> On 10/15/2015 10:55 PM, Stefan Hajnoczi wrote: >>> On Thu, Oct 15, 2015 at 10:19:17AM +0800, Wen Congyang wrote: On 10/14/2015 10:27 PM, Stefan Hajnoczi wrote: > On Tue, Oct

Re: [Qemu-block] [PATCH] block: allow best-effort query

2015-10-26 Thread Eric Blake
On 10/26/2015 12:12 PM, John Snow wrote: > For more complex BDS trees that can be created under normal circumstances, > we lose the ability to issue query commands because of our inability to > re-construct the absolute filename. > > Instead, omit this field when it is a problem and present as

[Qemu-block] [PATCH] block: Don't call blk_bs() twice in bdrv_lookup_bs()

2015-10-26 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- block.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block.c b/block.c index e9f40dc..eb8158a 100644 --- a/block.c +++ b/block.c @@ -2683,12 +2683,12 @@ BlockDriverState *bdrv_lookup_bs(const char *device,

Re: [Qemu-block] [PATCH v7 37/39] blockdev: read-only-mode for blockdev-change-medium

2015-10-26 Thread Kevin Wolf
Am 19.10.2015 um 17:53 hat Max Reitz geschrieben: > Add an option to qmp_blockdev_change_medium() which allows changing the > read-only status of the block device whose medium is changed. > > Some drives do not have a inherently fixed read-only status; for > instance, floppy disks can be set

[Qemu-block] [PATCH v8 4/5] block: add a 'blockdev-snapshot' QMP command

2015-10-26 Thread Alberto Garcia
One of the limitations of the 'blockdev-snapshot-sync' command is that it does not allow passing BlockdevOptions to the newly created snapshots, so they are always opened using the default values. Extending the command to allow passing options is not a practical solution because there is overlap

[Qemu-block] [PATCH v8 1/5] block: check for existing device IDs in external_snapshot_prepare()

2015-10-26 Thread Alberto Garcia
The 'snapshot-node-name' parameter of blockdev-snapshot-sync allows setting the node name of the image that is going to be created. Before creating the image, external_snapshot_prepare() checks that the name is not already being used. The check is however incomplete since it only considers

[Qemu-block] [PATCH v8 5/5] block: add tests for the 'blockdev-snapshot' command

2015-10-26 Thread Alberto Garcia
Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz Reviewed-by: Jeff Cody --- tests/qemu-iotests/085 | 102 ++--- tests/qemu-iotests/085.out | 34 ++- 2 files changed, 128

[Qemu-block] [PATCH v8 3/5] block: support passing 'backing': '' to 'blockdev-add'

2015-10-26 Thread Alberto Garcia
Passing an empty string allows opening an image but not its backing file. This was already described in the API documentation, only the implementation was missing. This is useful for creating snapshots using images opened with blockdev-add, since they are not supposed to have a backing image

[Qemu-block] [PATCH v8 0/5] Add 'blockdev-snapshot' command

2015-10-26 Thread Alberto Garcia
This series adds a new 'blockdev-snapshot' command, that is similar to 'blockdev-snapshot-sync' but takes references to two existing block devices. This finally applies (and works) cleanly on master. Max's patch to allow creating BlockDriverState trees without a BlockBackend is now available as

Re: [Qemu-block] [PATCH v7 39/39] iotests: Add test for change-related QMP commands

2015-10-26 Thread Kevin Wolf
Am 19.10.2015 um 17:53 hat Max Reitz geschrieben: > Signed-off-by: Max Reitz > Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf

Re: [Qemu-block] [PATCH] block: Don't call blk_bs() twice in bdrv_lookup_bs()

2015-10-26 Thread Kevin Wolf
Am 26.10.2015 um 15:46 hat Alberto Garcia geschrieben: > Signed-off-by: Alberto Garcia Thanks, applied to the block branch. Kevin

Re: [Qemu-block] [PATCH v5 2/6] block: Avoid BlockDriverState.filename

2015-10-26 Thread Kevin Wolf
Am 19.10.2015 um 20:49 hat Max Reitz geschrieben: > In places which directly pass a filename to the OS, we should not use > the filename field at all but exact_filename instead (although the > former currently equals the latter if that is set). > > In raw_open_common(), we do not need to access

Re: [Qemu-block] [PATCH v5 4/6] qemu-img: Use bdrv_filename() for map

2015-10-26 Thread Kevin Wolf
Am 19.10.2015 um 20:49 hat Max Reitz geschrieben: > Replaces bs->filename by the result of bdrv_filename() in the > qemu-img map subcommand. Since that value is queried relatively often, > however, it should be cached. > > Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf

Re: [Qemu-block] [PATCH v5 3/6] block: Add bdrv_filename()

2015-10-26 Thread Kevin Wolf
Am 19.10.2015 um 20:49 hat Max Reitz geschrieben: > Split the part which actually refreshes the BlockDriverState.filename > field off of bdrv_refresh_filename() into a more generic function > bdrv_filename(), which first calls bdrv_refresh_filename() and then > stores a qemu-usable filename in the

[Qemu-block] [PATCH] block: allow best-effort query

2015-10-26 Thread John Snow
For more complex BDS trees that can be created under normal circumstances, we lose the ability to issue query commands because of our inability to re-construct the absolute filename. Instead, omit this field when it is a problem and present as much information as we can. This will change the