Re: [Qemu-block] [PATCH v3 07/16] block: Convert bs->backing_hd to BdrvChild

2015-10-12 Thread Max Reitz
ream.c| 8 ++-- > block/vmdk.c | 21 +- > block/vvfat.c | 6 +-- > blockdev.c| 4 +- > include/block/block_int.h | 12 -- > qemu-img.c| 4 +- > 14 files changed, 115 insertions(+), 109 deletions(-) Reviewed-by: Max Reitz signature.asc Description: OpenPGP digital signature

Re: [Qemu-block] [PATCH v3 08/16] block: Manage backing file references in bdrv_set_backing_hd()

2015-10-12 Thread Max Reitz
.c| 30 +-- > block/vvfat.c | 6 - > include/block/block.h | 1 + > 5 files changed, 37 insertions(+), 84 deletions(-) Reviewed-by: Max Reitz signature.asc Description: OpenPGP digital signature

[Qemu-block] [PATCH v6 00/39] blockdev: BlockBackend and media

2015-10-12 Thread Max Reitz
27;blockdev: Implement change with basic operations' 034/39:[] [--] 'block: Inquire tray state before tray-moved events' 035/39:[0002] [FC] 'qmp: Introduce blockdev-change-medium' 036/39:[] [--] 'hmp: Use blockdev-change-medium for change command' 037/39:

[Qemu-block] [PATCH v6 02/39] block: Set BDRV_O_INCOMING in bdrv_fill_options()

2015-10-12 Thread Max Reitz
This flag should not be set for the root BDS only, but for any BDS that is being created while incoming migration is pending, so setting it is moved from blockdev_init() to bdrv_fill_options(). Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf Reviewed-by: Alberto Garcia

[Qemu-block] [PATCH v6 06/39] block: Add blk_is_available()

2015-10-12 Thread Max Reitz
blk_is_available() returns true iff the BDS is inserted (which means blk_bs() is not NULL and bdrv_is_inserted() returns true) and if the tray of the guest device is closed. blk_is_inserted() is changed to return true only if blk_bs() is not NULL. Signed-off-by: Max Reitz Reviewed-by: Eric

[Qemu-block] [PATCH v6 04/39] iotests: Only create BB if necessary

2015-10-12 Thread Max Reitz
Tests 071 and 081 test giving references in blockdev-add. It is not necessary to create a BlockBackend here, so omit it. While at it, fix up some blockdev-add invocations in the vicinity (s/raw/$IMGFMT/ in 081, drop the format BDS for blkverify's raw child in 071). Signed-off-by: Max

[Qemu-block] [PATCH v6 01/39] block: Remove host floppy support

2015-10-12 Thread Max Reitz
It has been deprecated as of 2.3, so we can now remove it. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf --- block/raw-posix.c| 222 ++- qapi/block-core.json | 9 +-- 2 files changed, 9 insertions(+), 222

[Qemu-block] [PATCH v6 03/39] blockdev: Allow creation of BDS trees without BB

2015-10-12 Thread Max Reitz
ptions which are not parsed by bdrv_open() (like caching) cannot be specified for these BB-less BDS trees yet. A future patch will remove this limitation. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf Reviewed-by: Alberto Garcia --- b

[Qemu-block] [PATCH v6 05/39] block: Make bdrv_is_inserted() return a bool

2015-10-12 Thread Max Reitz
Make bdrv_is_inserted(), blk_is_inserted(), and the callback BlockDriver.bdrv_is_inserted() return a bool. Suggested-by: Eric Blake Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Reviewed-by: Kevin Wolf --- block.c| 12

[Qemu-block] [PATCH v6 13/39] block: Move guest_block_size into BlockBackend

2015-10-12 Thread Max Reitz
guest_block_size is a guest device property so it should be moved into the interface between block layer and guest devices, which is the BlockBackend. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Reviewed-by: Kevin Wolf --- block.c | 7

[Qemu-block] [PATCH v6 08/39] block/raw_bsd: Drop raw_is_inserted()

2015-10-12 Thread Max Reitz
With the new automatically-recursive implementation of bdrv_is_inserted() checking by default whether all the children of a BDS are inserted, we can drop raw's own implementation. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf Reviewed-by: Alberto Garcia ---

[Qemu-block] [PATCH v6 15/39] block: Move BlockAcctStats into BlockBackend

2015-10-12 Thread Max Reitz
As the comment above bdrv_get_stats() says, BlockAcctStats is something which belongs to the device instead of each BlockDriverState. This patch therefore moves it into the BlockBackend. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Reviewed-by: Kevin Wolf

[Qemu-block] [PATCH v6 07/39] block: Make bdrv_is_inserted() recursive

2015-10-12 Thread Max Reitz
If bdrv_is_inserted() is called on the top level BDS, it should make sure all nodes in the BDS tree are actually inserted. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf --- block.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a

[Qemu-block] [PATCH v6 09/39] block: Invoke change media CB before NULLing drv

2015-10-12 Thread Max Reitz
blk_is_inserted()) always returns false for BDS with drv set to NULL, blk_dev_change_media_cb() should therefore be called before drv is set to NULL. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Reviewed-by: Kevin Wolf --- block.c | 8 1 file changed, 4 insertions

[Qemu-block] [PATCH v6 19/39] block: Make some BB functions fall back to BBRS

2015-10-12 Thread Max Reitz
If there is no BDS tree attached to a BlockBackend, functions that can do so should fall back to the BlockBackendRootState structure. Signed-off-by: Max Reitz --- block/block-backend.c | 28 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/block/block

[Qemu-block] [PATCH v6 14/39] block: Remove wr_highest_sector from BlockAcctStats

2015-10-12 Thread Max Reitz
culate the volume usage by (wr_highest_offset + 512) / volume_size, after this patch they will just assume the volume to be full slightly earlier than before. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Reviewed-by: Kevin Wolf --- block/accounting.c

[Qemu-block] [PATCH v6 12/39] block: Fix BB AIOCB AioContext without BDS

2015-10-12 Thread Max Reitz
patch makes blk_get_aio_context() fall back to the main loop context if the BDS pointer is NULL and implements AIOCBInfo::get_aio_context() (blk_aiocb_get_aio_context()) which invokes blk_get_aio_context(). Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Review

[Qemu-block] [PATCH v6 21/39] block: Prepare remaining BB functions for NULL BDS

2015-10-12 Thread Max Reitz
There are several BlockBackend functions which, in theory, cannot fail. This patch makes them cope with the BlockDriverState pointer being NULL by making them fall back to some default action like ignoring the value in setters and returning the default in getters. Signed-off-by: Max Reitz

[Qemu-block] [PATCH v6 18/39] block: Add BlockBackendRootState

2015-10-12 Thread Max Reitz
This structure will store some of the state of the root BDS if the BDS tree is removed, so that state can be restored once a new BDS tree is inserted. Signed-off-by: Max Reitz --- block/block-backend.c | 40 include/block/block_int.h | 10

[Qemu-block] [PATCH v6 23/39] block: Prepare for NULL BDS

2015-10-12 Thread Max Reitz
blk_bs() will not necessarily return a non-NULL value any more (unless blk_is_available() is true or it can be assumed to otherwise, e.g. because it is called immediately after a successful blk_new_with_bs() or blk_new_open()). Signed-off-by: Max Reitz --- block.c | 5 ++ block

[Qemu-block] [PATCH v6 11/39] hw/usb-storage: Check whether BB is inserted

2015-10-12 Thread Max Reitz
Only call bdrv_add_key() on the BlockDriverState if it is not NULL. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Reviewed-by: Kevin Wolf --- hw/usb/dev-storage.c | 30 -- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git

[Qemu-block] [PATCH v6 10/39] hw/block/fdc: Implement tray status

2015-10-12 Thread Max Reitz
The tray of an FDD is open iff there is no medium inserted (there are only two states for an FDD: "medium inserted" or "no medium inserted"). Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf --- hw/block/fdc.c | 20 tests/fdc

[Qemu-block] [PATCH v6 20/39] block: Fail requests to empty BlockBackend

2015-10-12 Thread Max Reitz
same BlockBackend as the guest uses should fail. If the BDS tree is supposed to be usable even after ejecting it from the guest, a different BlockBackend must be used. Signed-off-by: Max Reitz Reviewed-by: Eric Blake --- block/block-backend.c | 55 +

[Qemu-block] [PATCH v6 26/39] blockdev: Allow more options for BB-less BDS tree

2015-10-12 Thread Max Reitz
Most of the options which blockdev_init() parses for both the BlockBackend and the root BDS are valid for just the root BDS as well (e.g. read-only). This patch allows specifying these options even if not creating a BlockBackend. Signed-off-by: Max Reitz --- blockdev.c | 160

[Qemu-block] [PATCH v6 24/39] blockdev: Do not create BDS for empty drive

2015-10-12 Thread Max Reitz
Do not use "rudimentary" BDSs for empty drives any longer (for freshly created drives). After a follow-up patch, empty drives will generally use a NULL BDS, not only the freshly created drives. Signed-off-by: Max Reitz --- block

[Qemu-block] [PATCH v6 22/39] block: Add blk_insert_bs()

2015-10-12 Thread Max Reitz
This function associates the given BlockDriverState with the given BlockBackend. Signed-off-by: Max Reitz --- block/block-backend.c | 11 +++ include/sysemu/block-backend.h | 1 + 2 files changed, 12 insertions(+) diff --git a/block/block-backend.c b/block/block-backend.c

[Qemu-block] [PATCH v6 31/39] blockdev: Add blockdev-insert-medium

2015-10-12 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

[Qemu-block] [PATCH v6 35/39] qmp: Introduce blockdev-change-medium

2015-10-12 Thread Max Reitz
Introduce a new QMP command 'blockdev-change-medium' which is intended to replace the 'change' command for block devices. The existing function qmp_change_blockdev() is accordingly renamed to qmp_blockdev_change_medium(). Signed-off-by: Max Reitz --- blockdev.c

[Qemu-block] [PATCH v6 30/39] blockdev: Add blockdev-remove-medium

2015-10-12 Thread Max Reitz
Signed-off-by: Max Reitz --- blockdev.c | 30 ++ qapi/block-core.json | 15 +++ qmp-commands.hx | 45 + 3 files changed, 90 insertions(+) diff --git a/blockdev.c b/blockdev.c index a4ce1df

[Qemu-block] [PATCH v6 34/39] block: Inquire tray state before tray-moved events

2015-10-12 Thread Max Reitz
should be sent whenever the status changed). Checking @load is now superfluous; it was necessary because it was possible to change a medium without having explicitly opened the tray and closed it again (or it might have been possible, at least). This is no longer possible, though. Signed-off-by: Max

[Qemu-block] [PATCH v6 29/39] blockdev: Add blockdev-close-tray

2015-10-12 Thread Max Reitz
Signed-off-by: Max Reitz --- blockdev.c | 23 +++ qapi/block-core.json | 16 qmp-commands.hx | 35 +++ 3 files changed, 74 insertions(+) diff --git a/blockdev.c b/blockdev.c index b90b1d6..a4ce1df 100644 --- a

[Qemu-block] [PATCH v6 32/39] blockdev: Implement eject with basic operations

2015-10-12 Thread Max Reitz
Implement 'eject' by calling blockdev-open-tray and blockdev-remove-medium. Signed-off-by: Max Reitz --- blockdev.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/blockdev.c b/blockdev.c index 706e7e1..ff3b353 100644 --- a/blockdev.c +++ b/blockdev.c @

[Qemu-block] [PATCH v6 17/39] block/throttle-groups: Make incref/decref public

2015-10-12 Thread Max Reitz
pointer, respectively, instead of a ThrottleGroup pointer. Functionally, they are equivalent, but since ThrottleGroup is not meant to be used outside of block/throttle-groups.c, ThrottleState is easier to handle. Signed-off-by: Max Reitz --- block/throttle-groups.c | 19

[Qemu-block] [PATCH v6 16/39] block: Move I/O status and error actions into BB

2015-10-12 Thread Max Reitz
These options are only relevant for the user of a whole BDS tree (like a guest device or a block job) and should thus be moved into the BlockBackend. Signed-off-by: Max Reitz --- block.c| 125 - block/backup.c | 17

[Qemu-block] [PATCH v6 27/39] block: Add blk_remove_bs()

2015-10-12 Thread Max Reitz
This function removes the BlockDriverState associated with the given BlockBackend from that BB and sets the BDS pointer in the BB to NULL. Signed-off-by: Max Reitz --- block/block-backend.c | 12 include/sysemu/block-backend.h | 1 + 2 files changed, 13 insertions

[Qemu-block] [PATCH v6 33/39] blockdev: Implement change with basic operations

2015-10-12 Thread Max Reitz
Implement 'change' on block devices by calling blockdev-open-tray, blockdev-remove-medium, blockdev-insert-medium (a variation of that which does not need a node-name) and blockdev-close-tray. Signed-off-by: Max Reitz --- blockd

[Qemu-block] [PATCH v6 25/39] blockdev: Pull out blockdev option extraction

2015-10-12 Thread Max Reitz
Extract some of the blockdev option extraction code from blockdev_init() into its own function. This simplifies blockdev_init() and will allow reusing the code in a different function added in a follow-up patch. Signed-off-by: Max Reitz Reviewed-by: Alberto Garcia --- blockdev.c | 209

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

2015-10-12 Thread Max Reitz
find it useful to be able to therefore change the read-only status of a block device when changing the medium. Signed-off-by: Max Reitz Reviewed-by: Eric Blake --- blockdev.c | 25 - hmp.c| 2 +- qapi/block-core.json | 24

[Qemu-block] [PATCH v6 28/39] blockdev: Add blockdev-open-tray

2015-10-12 Thread Max Reitz
Signed-off-by: Max Reitz --- blockdev.c | 49 + qapi/block-core.json | 23 +++ qmp-commands.hx | 39 +++ 3 files changed, 111 insertions(+) diff --git a/blockdev.c b/blockdev.c

[Qemu-block] [PATCH v6 38/39] hmp: Add read-only-mode option to change command

2015-10-12 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: Eric Blake --- hmp-commands.hx | 20 +--- hmp.c | 22 +- 2 files changed, 38 insertions(+),

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

2015-10-12 Thread Max Reitz
fore the new image is created. > > Signed-off-by: Alberto Garcia > --- > blockdev.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) Reviewed-by: Max Reitz signature.asc Description: OpenPGP digital signature

[Qemu-block] [PATCH v6 36/39] hmp: Use blockdev-change-medium for change command

2015-10-12 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 Bl

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

2015-10-12 Thread Max Reitz
Signed-off-by: Max Reitz Reviewed-by: Eric Blake --- tests/qemu-iotests/118 | 638 + tests/qemu-iotests/118.out | 5 + tests/qemu-iotests/group | 1 + 3 files changed, 644 insertions(+) create mode 100755 tests/qemu-iotests/118 create mode

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

2015-10-12 Thread Max Reitz
n is shared. > > Signed-off-by: Alberto Garcia > Cc: Eric Blake > Reviewed-by: Max Reitz > --- > blockdev.c | 165 > --- > qapi-schema.json | 2 + > qapi/block-core.json | 28 + > qmp-commands.hx

Re: [Qemu-block] [PATCH v6 23/39] block: Prepare for NULL BDS

2015-10-14 Thread Max Reitz
On 13.10.2015 17:37, Kevin Wolf wrote: > Am 12.10.2015 um 22:00 hat Max Reitz geschrieben: >> blk_bs() will not necessarily return a non-NULL value any more (unless >> blk_is_available() is true or it can be assumed to otherwise, e.g. >> because it is called immediate

Re: [Qemu-block] [PATCH v6 24/39] blockdev: Do not create BDS for empty drive

2015-10-14 Thread Max Reitz
On 14.10.2015 15:27, Kevin Wolf wrote: > Am 12.10.2015 um 22:00 hat Max Reitz geschrieben: >> Do not use "rudimentary" BDSs for empty drives any longer (for >> freshly created drives). >> >> After a follow-up patch, empty drives will generally use a NULL BDS, n

Re: [Qemu-block] [PATCH v6 25/39] blockdev: Pull out blockdev option extraction

2015-10-14 Thread Max Reitz
On 14.10.2015 17:12, Kevin Wolf wrote: > Am 12.10.2015 um 22:00 hat Max Reitz geschrieben: >> Extract some of the blockdev option extraction code from blockdev_init() >> into its own function. This simplifies blockdev_init() and will allow >> reusing the code in a differen

Re: [Qemu-block] [PATCH 1/3] block: Use bdrv_lookup_bs() instead of bdrv_find_node()

2015-10-14 Thread Max Reitz
y > --- > block/block-backend.c | 2 +- > block/mirror.c | 2 +- > block/write-threshold.c | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) Reviewed-by: Max Reitz signature.asc Description: OpenPGP digital signature

Re: [Qemu-block] [PATCH 1/3] block: Use bdrv_lookup_bs() instead of bdrv_find_node()

2015-10-14 Thread Max Reitz
On 14.10.2015 19:29, Max Reitz wrote: > On 14.10.2015 15:16, Jeff Cody wrote: >> This is a precursor to making bdrv_find_node() static, and internal >> to block.c >> >> To find a BlockDriverState interface, it can be done via blk_by_name(), >> bdrv_find_node(),

Re: [Qemu-block] [PATCH 2/3] block: make bdrv_find_node() static

2015-10-14 Thread Max Reitz
.c | 30 +++--- > include/block/block.h | 1 - > 2 files changed, 15 insertions(+), 16 deletions(-) Reviewed-by: Max Reitz signature.asc Description: OpenPGP digital signature

Re: [Qemu-block] [PATCH 3/3] block: use bdrv_lookup_bs() over blk_by_name() for BDS only results

2015-10-14 Thread Max Reitz
On 14.10.2015 15:16, Jeff Cody wrote: > To find a BlockDriverState interface, it can be done via blk_by_name(), > bdrv_find_node(), and bdrv_lookup_bs(). The latter can take the place > of the other two, in the instances where we are only concerned with the > BlockDriverState. > > In much of the

Re: [Qemu-block] [PATCH v6 26/39] blockdev: Allow more options for BB-less BDS tree

2015-10-17 Thread Max Reitz
On 15.10.2015 13:29, Kevin Wolf wrote: > Am 12.10.2015 um 22:00 hat Max Reitz geschrieben: >> Most of the options which blockdev_init() parses for both the >> BlockBackend and the root BDS are valid for just the root BDS as well >> (e.g. read-only). This patch allows specifyi

Re: [Qemu-block] [PATCH 2/3] block: Add 'blockdev-del' QMP command

2015-10-17 Thread Max Reitz
On 13.10.2015 15:48, Alberto Garcia wrote: > This is the companion to 'blockdev-add'. It allows deleting a > BlockBackend with its associated BlockDriverState tree, or a > BlockDriverState that is not attached to any backend. > > In either case, the command fails if the reference count is greater

Re: [Qemu-block] [PATCH 1/3] block: Add blk_get_refcnt()

2015-10-17 Thread Max Reitz
include/sysemu/block-backend.h | 1 + > 2 files changed, 6 insertions(+) Reviewed-by: Max Reitz signature.asc Description: OpenPGP digital signature

Re: [Qemu-block] [PATCH 2/3] block: Add 'blockdev-del' QMP command

2015-10-17 Thread Max Reitz
On 13.10.2015 15:48, Alberto Garcia wrote: > This is the companion to 'blockdev-add'. It allows deleting a > BlockBackend with its associated BlockDriverState tree, or a > BlockDriverState that is not attached to any backend. > > In either case, the command fails if the reference count is greater

Re: [Qemu-block] [PATCH v6 18/39] block: Add BlockBackendRootState

2015-10-19 Thread Max Reitz
On 19.10.2015 16:18, Kevin Wolf wrote: > Am 12.10.2015 um 22:00 hat Max Reitz geschrieben: >> This structure will store some of the state of the root BDS if the BDS >> tree is removed, so that state can be restored once a new BDS tree is >> inserted. >> >> Sign

Re: [Qemu-block] [PATCH 0/3] Add 'blockdev-del' command

2015-10-19 Thread Max Reitz
On 19.10.2015 13:27, Kevin Wolf wrote: > Am 13.10.2015 um 15:48 hat Alberto Garcia geschrieben: >> Here's my first attempt at the 'blockdev-del' command. >> >> This series goes on top of Max's "BlockBackend and media" v6: >> >> https://lists.gnu.org/archive/html/qemu-devel/2015-10/msg02810.html >>

Re: [Qemu-block] [RFC for-3.0 0/4] block: Add qcow2-rust block driver

2017-04-22 Thread Max Reitz
On 21.04.2017 17:51, Stefan Hajnoczi wrote: > On Sat, Apr 01, 2017 at 05:57:47PM +0200, Max Reitz wrote: >> The issues of using C are well understood and nobody likes it. Let's use >> a better language. C++ is not a better language, Rust is. Everybody >> loves Rust. Rus

Re: [Qemu-block] [PATCH] Block layer core: Fix qemu-img 'amend' subcommand failure of adjusting backing file in different path

2017-04-22 Thread Max Reitz
On 22.04.2017 00:34, Ping Li wrote: > Currently, qemu-img 'amend' subcommand would fail to adjust image's backing > file > which was moved into different path. > For example, parent.qcow2, the backing file of leaf.qcow2, first is at > /home/a/, > then moved into /home/b/. Originally this command,

Re: [Qemu-block] [PATCH] qemu_iotests: Remove _readlink()

2017-04-22 Thread Max Reitz
On 21.04.2017 10:01, Kevin Wolf wrote: > It is unused. > > Suggestetd-by: Fam Zheng *Suggested And, since it now would be rude not to, with that fixed: Reviewed-by: Max Reitz > Signed-off-by: Kevin Wolf > --- > tests/qemu-iotests/common.config | 18 -- >

Re: [Qemu-block] proposed qcow2 extension: cluster reservations [was: [Qemu-devel] [RFC] Proposed qcow2 extension: subcluster allocation

2017-04-22 Thread Max Reitz
On 21.04.2017 23:09, Eric Blake wrote: > On 04/06/2017 11:40 AM, Eric Blake wrote: > >>> === Changes to the on-disk format === >>> >>> The qcow2 on-disk format needs to change so each L2 entry has a bitmap >>> indicating the allocation status of each subcluster. There are three >>> possible states

Re: [Qemu-block] [Qemu-devel] [PATCH 2/2] qemu-img: fix some spelling errors

2017-04-25 Thread Max Reitz
On 24.04.2017 17:53, Eric Blake wrote: > On 04/24/2017 10:47 AM, Eric Blake wrote: >> On 04/24/2017 10:37 AM, Philippe Mathieu-Daudé wrote: >> > /* > - * Returns true iff the first sector pointed to by 'buf' contains at > least > - * a non-NUL byte. > + * Returns true if the fi

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] qemu-img: make sure contain the consecutive number of zero bytes

2017-04-25 Thread Max Reitz
On 25.04.2017 03:50, 858585 jemmy wrote: > On Mon, Apr 24, 2017 at 10:43 PM, Eric Blake wrote: >> On 04/23/2017 09:33 AM, jemmy858...@gmail.com wrote: >>> From: Lidong Chen >>> >>> is_allocated_sectors_min don't guarantee to contain the >>> consecutive number of zero bytes. this patch fixes this

Re: [Qemu-block] [PATCH for-2.10 0/3] qemu-img/convert: Some small fixes

2017-04-26 Thread Max Reitz
On 19.04.2017 17:49, Kevin Wolf wrote: > Am 13.04.2017 um 22:33 hat Max Reitz geschrieben: >> This series fixes some small issues I found in qemu-img's convert >> subcommand while reviewing Dan's convert/dd series. >> >> Nothing serious at all, so all for

[Qemu-block] [PATCH v2 1/3] qemu-img/convert: Use @opts for one thing only

2017-04-26 Thread Max Reitz
no object that supports any of the parameters we query here, but this is neither something we should rely on nor does this variable reuse make the code very nice to read. Therefore, just use an own variable for the --object options. Signed-off-by: Max Reitz Reviewed-by: Eric Blake --- qemu

[Qemu-block] [PATCH v2 3/3] qemu-img: Document backing options

2017-04-26 Thread Max Reitz
The create and convert subcommands have shorthands to set the backing_file and, in the case of create, the backing_fmt options for the new image. However, they have not been documented so far, which is remedied by this patch. Reported-by: Eric Blake Signed-off-by: Max Reitz --- qemu-img

[Qemu-block] [PATCH v2 0/3] qemu-img/convert: Some small fixes

2017-04-26 Thread Max Reitz
FC] indicate (F)unctional and (C)ontextual differences, respectively 001/3:[] [-C] 'qemu-img/convert: Use @opts for one thing only' 002/3:[0007] [FC] 'qemu-img/convert: Move bs_n > 1 && -B check down' 003/3:[down] 'qemu-img: Document backing options'

[Qemu-block] [PATCH v2 2/3] qemu-img/convert: Move bs_n > 1 && -B check down

2017-04-26 Thread Max Reitz
ix this by moving the check. (Also, change the error message because -B is not the only way to specify the backing file, evidently.) Signed-off-by: Max Reitz --- qemu-img.c | 13 +++-- tests/qemu-iotests/122.out | 4 ++-- 2 files changed, 9 insertions(+), 8 deletion

Re: [Qemu-block] [PATCH] iotests: Launch qemu-nbd with -e 42

2017-04-26 Thread Max Reitz
On 26.04.2017 16:18, Eric Blake wrote: > On 04/26/2017 09:14 AM, Max Reitz wrote: >> There is no reason for the qemu-nbd server used for tests not to accept >> an arbitrary number of clients. In fact, test 181 will require it to >> accept two clients at the same time (and thus

Re: [Qemu-block] [PATCH v2 1/3] qemu-img/convert: Use @opts for one thing only

2017-04-26 Thread Max Reitz
On 26.04.2017 16:03, Eric Blake wrote: > On 04/26/2017 08:46 AM, Max Reitz wrote: >> After storing the creation options for the new image into @opts, we >> fetch some things for our own information, like the backing file name, >> or whether to use encryption or preallocati

[Qemu-block] [PATCH] iotests: Launch qemu-nbd with -e 42

2017-04-26 Thread Max Reitz
for all of our current and future tests. Signed-off-by: Max Reitz --- tests/qemu-iotests/common.rc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 7d4781d4ad..31b888d4e9 100644 --- a/tests/qemu-iotests

Re: [Qemu-block] [PATCH] block: Remove NULL check in bdrv_co_flush

2017-04-26 Thread Max Reitz
insertion(+), 1 deletion(-) Reviewed-by: Max Reitz signature.asc Description: OpenPGP digital signature

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

2017-04-26 Thread Max Reitz
On 24.04.2017 11:16, Daniel P. Berrange wrote: > The '--image-opts' flags indicates whether the source filename > includes options. The target filename has to remain in the > plain filename format though, since it needs to be passed to > bdrv_create(). When using --skip-create though, it would be

Re: [Qemu-block] [PATCH v5 4/4] qemu-img: copy *key-secret opts when opening newly created files

2017-04-26 Thread Max Reitz
} > if (!out_blk) {> ret = -1; With the spelling fixed as pointed out by Fam, and with s/out_blk/s.target/ in this hunk: Reviewed-by: Max Reitz signature.asc Description: OpenPGP digital signature

Re: [Qemu-block] [PATCH v2] qemu-img: use blk_co_pwrite_zeroes for zero sectors when compressed

2017-04-26 Thread Max Reitz
On 21.04.2017 11:57, jemmy858...@gmail.com wrote: > From: Lidong Chen > > when the buffer is zero, blk_co_pwrite_zeroes is more effectively than s/when/When/, s/effectively/effective/ > blk_co_pwritev with BDRV_REQ_WRITE_COMPRESSED. this patch can reduces s/this/This/, s/reduces/reduce/ > the

Re: [Qemu-block] [PATCH] qemu-img: improve convert_iteration_sectors()

2017-04-26 Thread Max Reitz
On 07.04.2017 13:34, Vladimir Sementsov-Ogievskiy wrote: > Do not do extra call to _get_block_status() > > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > > Also, I'm not sure about last line: > s->status = s->target_has_backing ? BLK_BACKING_FILE : BLK_DATA; > > (which is equal to old code

Re: [Qemu-block] [PATCH] qemu-img: improve convert_iteration_sectors()

2017-04-26 Thread Max Reitz
On 20.04.2017 01:06, John Snow wrote: > > > On 04/07/2017 07:34 AM, Vladimir Sementsov-Ogievskiy wrote: >> Do not do extra call to _get_block_status() >> >> Signed-off-by: Vladimir Sementsov-Ogievskiy >> --- >> >> Also, I'm not sure about last line: >> s->status = s->target_has_backing ? BLK_BAC

Re: [Qemu-block] [PATCH v2 3/3] qemu-img: Document backing options

2017-04-28 Thread Max Reitz
On 28.04.2017 11:38, Kevin Wolf wrote: > Am 27.04.2017 um 17:36 hat Eric Blake geschrieben: >> On 04/26/2017 08:46 AM, Max Reitz wrote: >>> I think originally the idea was to remove the individual special case >>> options in the long term in favour of the uniform -o

Re: [Qemu-block] [PATCH v3] qemu-img: use blk_co_pwrite_zeroes for zero sectors when compressed

2017-04-28 Thread Max Reitz
On 27.04.2017 04:58, jemmy858...@gmail.com wrote: > From: Lidong Chen > > When the buffer is zero, blk_co_pwrite_zeroes is more effective than > blk_co_pwritev with BDRV_REQ_WRITE_COMPRESSED. This patch can reduce > the time for converting qcow2 images with lots of zero data. > > Signed-off-by:

Re: [Qemu-block] [PATCH] progress: Show current progress on SIGINFO

2017-04-28 Thread Max Reitz
On 08.02.2017 00:57, Max Reitz wrote: > Currently we only print progress information on retrieval of SIGUSR1. > Some systems have a dedicated SIGINFO for this, however, so it should be > handled appropriately if it is available. > > Buglink: https://bugs.launchpad.net/qemu/+bug/1

[Qemu-block] [PATCH] MAINTAINERS: Add qemu-progress to the block layer

2017-04-28 Thread Max Reitz
util/qemu-progress.c is currently unmaintained. The only user of its functionality is qemu-img, so it effectively is part of the block layer. Suggested-by: Fam Zheng Signed-off-by: Max Reitz --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index

Re: [Qemu-block] [PATCH v10 01/17] block: Update comments on BDRV_BLOCK_* meanings

2017-04-28 Thread Max Reitz
y > table is the intended semantics, simplify the rest of the text > to get rid of the confusion. > > Suggested-by: Max Reitz > Signed-off-by: Eric Blake > > --- > v10: new patch > --- > include/block/block.h | 13 +++-- > 1 file changed, 7 insertio

Re: [Qemu-block] [PATCH v10 02/17] qcow2: Correctly report status of preallocated zero clusters

2017-04-28 Thread Max Reitz
On 27.04.2017 03:46, Eric Blake wrote: > We were throwing away the preallocation information associated with > zero clusters. But we should be matching the well-defined semantics > in bdrv_get_block_status(), where (BDRV_BLOCK_ZERO | > BDRV_BLOCK_OFFSET_VALID) informs the user which offset is rese

Re: [Qemu-block] [PATCH v10 03/17] qcow2: Reuse preallocated zero clusters

2017-04-28 Thread Max Reitz
On 27.04.2017 03:46, Eric Blake wrote: > From: Max Reitz > > Instead of just freeing preallocated zero clusters and completely > allocating them from scratch, reuse them. > > We cannot do this in handle_copied(), however, since this is a COW > operation. Therefore, we have

Re: [Qemu-block] [PATCH v10 04/17] qcow2: Optimize zero_single_l2() to minimize L2 churn

2017-04-28 Thread Max Reitz
gt; +continue; > +} > + > qcow2_cache_entry_mark_dirty(bs, s->l2_table_cache, l2_table); > -if (old_offset & QCOW_OFLAG_COMPRESSED || flags & > BDRV_REQ_MAY_UNMAP) { > +if (old_offset & QCOW_OFLAG_COMPRESSED || unm

Re: [Qemu-block] [PATCH v10 05/17] iotests: Add test 179 to cover write zeroes with unmap

2017-04-28 Thread Max Reitz
On 27.04.2017 03:46, Eric Blake wrote: > No tests were covering write zeroes with unmap. Additionally, > I needed to prove that my previous patches for correct status > reporting and write zeroes optimizations actually had an impact. > > The test works for cluster_size between 8k and 2M (for smal

Re: [Qemu-block] [PATCH v10 06/17] qemu-io: Don't open-code QEMU_IS_ALIGNED

2017-04-28 Thread Max Reitz
- > 1 file changed, 5 insertions(+), 5 deletions(-) Reviewed-by: Max Reitz signature.asc Description: OpenPGP digital signature

Re: [Qemu-block] [PATCH v10 07/17] qemu-io: Switch 'alloc' command to byte-based length

2017-04-28 Thread Max Reitz
V_SECTOR_SIZE; > } > +if (!QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)) { > +printf("bytes %" PRId64 " is not sector aligned\n", This isn't real English. :-) With that fixed (somehow, you know better than me how to): Reviewed-by: Max Reitz > + bytes); > +return 0; > +} > +nb_sectors = bytes >> BDRV_SECTOR_BITS; > > remaining = nb_sectors; > sum_alloc = 0; signature.asc Description: OpenPGP digital signature

Re: [Qemu-block] [PATCH v10 08/17] qemu-io: Switch 'map' output to byte-based reporting

2017-04-28 Thread Max Reitz
st 179 > v9: new patch > --- > qemu-io-cmds.c | 5 ++--- > tests/qemu-iotests/102.out | 4 ++-- > tests/qemu-iotests/146.out | 30 +++--- > tests/qemu-iotests/179.out | 22 +++--- > 4 files changed, 30 insertions(+), 31

Re: [Qemu-block] [PATCH v10 07/17] qemu-io: Switch 'alloc' command to byte-based length

2017-04-28 Thread Max Reitz
On 28.04.2017 21:59, Eric Blake wrote: > On 04/28/2017 02:46 PM, Max Reitz wrote: >> On 27.04.2017 03:46, Eric Blake wrote: >>> For the 'alloc' command, accepting an offset in bytes but a length >>> in sectors, and reporting output in sectors, is confusing. D

Re: [Qemu-block] [PATCH v10 07/17] qemu-io: Switch 'alloc' command to byte-based length

2017-04-28 Thread Max Reitz
On 28.04.2017 22:36, Eric Blake wrote: > On 04/28/2017 03:09 PM, Max Reitz wrote: >> On 28.04.2017 21:59, Eric Blake wrote: >>> On 04/28/2017 02:46 PM, Max Reitz wrote: >>>> On 27.04.2017 03:46, Eric Blake wrote: >>>>> For the 'alloc' comm

Re: [Qemu-block] [PATCH v10 09/17] qcow2: Optimize write zero of unaligned tail cluster

2017-04-28 Thread Max Reitz
On 27.04.2017 03:46, Eric Blake wrote: > We've already improved discards to operate efficiently on the tail > of an unaligned qcow2 image; it's time to make a similar improvement > to write zeroes. The special case is only valid at the tail > cluster of a file, where we must recognize that any sec

Re: [Qemu-block] [PATCH v10 10/17] qcow2: Assert that cluster operations are aligned

2017-05-03 Thread Max Reitz
v6: avoid assertion on non-cluster-aligned image, use s->cluster_sectors > to avoid a shift, drop R-b > v5: no change > v4: new patch > --- > block/qcow2-cluster.c | 15 +++ > 1 file changed, 11 insertions(+), 4 deletions(-) Reviewed-by: Max Reitz signature.asc Description: OpenPGP digital signature

Re: [Qemu-block] [PATCH v10 11/17] qcow2: Discard/zero clusters by byte count

2017-05-03 Thread Max Reitz
/qcow2.c [...] > @@ -2858,18 +2857,16 @@ static int qcow2_make_empty(BlockDriverState *bs) > > /* This fallback code simply discards every active cluster; this is slow, > * but works in all cases */ > -for (start_sector = 0; start_sector < bs->total_sectors; > -

Re: [Qemu-block] [PATCH v11 1/9] qemu-io: Improve alignment checks

2017-05-03 Thread Max Reitz
used by humans, and I as a human don't like it very much if my programs are overly technical and cold to me. "X is an invalid value for 'Y'" is very technical. "X is wrong for Y" or "X Y does not work" sounds more familiar and nicer. I like my p

Re: [Qemu-block] [PATCH v11 2/9] qemu-io: Switch 'alloc' command to byte-based length

2017-05-03 Thread Max Reitz
ern | 2 +- > 3 files changed, 23 insertions(+), 17 deletions(-) Reviewed-by: Max Reitz signature.asc Description: OpenPGP digital signature

Re: [Qemu-block] [PATCH v11 3/9] qemu-io: Switch 'map' output to byte-based reporting

2017-05-03 Thread Max Reitz
| 11 ++- > tests/qemu-iotests/102.out | 4 ++-- > tests/qemu-iotests/146.out | 30 +++--- > 3 files changed, 23 insertions(+), 22 deletions(-) Reviwed-by: Max Reitz > diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c > index 1e0ebb4..4b2278f 100644 >

Re: [Qemu-block] [PATCH v11 7/9] blkdebug: Simplify override logic

2017-05-03 Thread Max Reitz
On 29.04.2017 21:14, Eric Blake wrote: > Rather than store into a local variable, then copy to the struct > if the value is valid, then reporting errors otherwise, it is > simpler to just store into the struct and report errors if the > value is invalid. This however requires that the struct store

Re: [Qemu-block] [PATCH v11 7/9] blkdebug: Simplify override logic

2017-05-03 Thread Max Reitz
On 03.05.2017 20:59, Max Reitz wrote: > On 29.04.2017 21:14, Eric Blake wrote: >> Rather than store into a local variable, then copy to the struct >> if the value is valid, then reporting errors otherwise, it is >> simpler to just store into the struct and report errors if th

Re: [Qemu-block] [PATCH v11 0/9] add blkdebug tests

2017-05-03 Thread Max Reitz
On 29.04.2017 21:14, Eric Blake wrote: > Available as a tag at: > git fetch git://repo.or.cz/qemu/ericb.git nbd-blkdebug-v11 > > Prerequisites: Kevin's block pull request: > https://lists.gnu.org/archive/html/qemu-devel/2017-04/msg05799.html > > v10 was: > https://lists.gnu.org/archive/html/qemu-

<    12   13   14   15   16   17   18   19   20   21   >