Re: [PATCH 00/16] hw/block/nvme: zoned namespace command set

2020-09-24 Thread Klaus Jensen
On Sep 24 19:24, Keith Busch wrote: > On Thu, Sep 24, 2020 at 10:45:00PM +0200, Klaus Jensen wrote: > > Finally, I wrote this. I am *NOT* saying that this somehow makes it > > better, but as a maintainer, is a big deal to me since both series are > > arguably a lot of code to maintain and support

Re: [PATCH 00/16] hw/block/nvme: zoned namespace command set

2020-09-24 Thread Keith Busch
On Thu, Sep 24, 2020 at 10:45:00PM +0200, Klaus Jensen wrote: > Finally, I wrote this. I am *NOT* saying that this somehow makes it > better, but as a maintainer, is a big deal to me since both series are > arguably a lot of code to maintain and support (both series are about > the same size). But

Re: [PATCH 00/16] hw/block/nvme: zoned namespace command set

2020-09-24 Thread no-reply
Patchew URL: https://patchew.org/QEMU/20200924204516.1881843-1-...@irrelevant.dk/ Hi, This series seems to have some coding style problems. See output below for more information: Type: series Message-id: 20200924204516.1881843-1-...@irrelevant.dk Subject: [PATCH 00/16] hw/block/nvme: zoned

Re: [PATCH v7 0/5] fix & merge block_status_above and is_allocated_above

2020-09-24 Thread no-reply
Patchew URL: https://patchew.org/QEMU/20200924194003.22080-1-vsement...@virtuozzo.com/ Hi, This series failed the docker-quick@centos7 build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally. === TEST SCRIPT

Re: About TODO in nvme emulation

2020-09-24 Thread Klaus Jensen
On Sep 24 16:52, Markus Armbruster wrote: > Cc'ing nvme maintainers. > > Amey Narkhede writes: > > > Is there any TODO file/wiki for nvme emulation code? > > I'm a beginner who is interested in getting into > > nvme emulation. I have read nvme v1.4a specification > > and some code in

[PATCH 11/16] hw/block/nvme: add the zone management send command

2020-09-24 Thread Klaus Jensen
From: Klaus Jensen Add the Zone Management Send command. Signed-off-by: Klaus Jensen --- hw/block/nvme.h | 1 + include/block/nvme.h | 29 +++ hw/block/nvme.c | 552 -- hw/block/trace-events | 11 + 4 files changed, 574 insertions(+),

Re: [PATCH 03/16] hw/block/nvme: make lba data size configurable

2020-09-24 Thread Klaus Jensen
On Sep 24 22:45, Klaus Jensen wrote: > From: Klaus Jensen > > Allos the LBA data size (lbads) to be set between 9 and 12. > The patch from Dmitry that uses the common logical_block_size BlockConf parameter is probably better than this. signature.asc Description: PGP signature

[PATCH 15/16] hw/block/nvme: support zone active excursions

2020-09-24 Thread Klaus Jensen
From: Klaus Jensen Allow the controller to release active resources by transitioning zones to the full state if enabled. Signed-off-by: Klaus Jensen --- docs/specs/nvme.txt | 5 ++ hw/block/nvme-ns.h| 3 + include/block/nvme.h | 30 ++-- hw/block/nvme-ns.c| 3 +

[PATCH 10/16] hw/block/nvme: add the zone management receive command

2020-09-24 Thread Klaus Jensen
From: Klaus Jensen Add the Zone Management Receive command. Signed-off-by: Klaus Jensen --- hw/block/nvme-ns.h| 8 +++ hw/block/nvme.h | 1 + include/block/nvme.h | 46 ++ hw/block/nvme-ns.c| 35 ++- hw/block/nvme.c | 135

[PATCH 09/16] hw/block/nvme: add basic read/write for zoned namespaces

2020-09-24 Thread Klaus Jensen
From: Klaus Jensen This adds basic read and write for zoned namespaces. A zoned namespace is created by setting the iocs namespace parameter to 0x2 and specifying the zns.zcap parameter (zone capacity) in number of logical blocks per zone. If a zone size (zns.zsze) is not specified, the

[PATCH 14/16] hw/block/nvme: allow open to close transitions by controller

2020-09-24 Thread Klaus Jensen
From: Klaus Jensen Allow the controller to release open resources by transitioning implicitly and explicitly opened zones to closed. This is done using a naive "least recently opened" strategy. Signed-off-by: Klaus Jensen --- hw/block/nvme-ns.h| 5 +++ hw/block/nvme-ns.c| 5 +++

[PATCH 13/16] hw/block/nvme: track and enforce zone resources

2020-09-24 Thread Klaus Jensen
From: Klaus Jensen Track number of open/active resources. Signed-off-by: Klaus Jensen --- docs/specs/nvme.txt | 7 + hw/block/nvme-ns.h | 7 + include/block/nvme.h | 2 ++ hw/block/nvme-ns.c | 25 +++-- hw/block/nvme.c | 65

[PATCH 12/16] hw/block/nvme: add the zone append command

2020-09-24 Thread Klaus Jensen
From: Klaus Jensen Add the Zone Append command. Signed-off-by: Klaus Jensen --- hw/block/nvme.h | 6 + include/block/nvme.h | 7 ++ hw/block/nvme.c | 52 +-- hw/block/trace-events | 1 + 4 files changed, 64 insertions(+), 2

[PATCH 06/16] hw/block/nvme: add support for dulbe and block utilization tracking

2020-09-24 Thread Klaus Jensen
From: Klaus Jensen This adds support for reporting the Deallocated or Unwritten Logical Block error (DULBE). This requires tracking the allocated/deallocated status of all logical blocks. Introduce a bitmap that does this. The bitmap is persisted on the new 'pstate' blockdev that is associated

Re: [PATCH v4 00/14] hw/block/nvme: Support Namespace Types and Zoned Namespace Command Set

2020-09-24 Thread Klaus Jensen
On Sep 24 03:20, Dmitry Fomichev wrote: > v3 -> v4 > > - Fix bugs introduced in v2/v3 for QD > 1 operation. Now, all writes >to a zone happen at the new write pointer variable, zone->w_ptr, >that is advanced right after submitting the backend i/o. The existing >zone->d.wp variable is

[PATCH 16/16] hw/block/nvme: support reset/finish recommended limits

2020-09-24 Thread Klaus Jensen
From: Klaus Jensen Add the rrl,rrld,frl and frld device parameters. The frld and rrld parameters specify the delay in seconds until the device sets the Finish and Reset Zone Recommended attributes on zones when they are transitioned to Full or an Opened state respectively. The rrl and frl

[PATCH 08/16] hw/block/nvme: support namespace types

2020-09-24 Thread Klaus Jensen
From: Klaus Jensen Implement support for TP 4056 ("Namespace Types"). This adds the 'iocs' (I/O Command Set) device parameter to the nvme-ns device. Signed-off-by: Klaus Jensen --- docs/specs/nvme.txt | 3 + hw/block/nvme-ns.h| 11 +- hw/block/nvme.h | 3 +

[PATCH 05/16] hw/block/nvme: consolidate read, write and write zeroes

2020-09-24 Thread Klaus Jensen
From: Klaus Jensen Consolidate the read/write and write zeroes functions. Signed-off-by: Klaus Jensen --- hw/block/nvme.h | 11 include/block/nvme.h | 2 ++ hw/block/nvme.c | 65 +++ hw/block/trace-events | 3 +- 4 files changed,

[PATCH 07/16] hw/block/nvme: add commands supported and effects log page

2020-09-24 Thread Klaus Jensen
From: Gollu Appalanaidu This is to support for the Commands Supported and Effects log page. See NVM Express Spec 1.3d, sec. 5.14.1.5 ("Commands Supported and Effects") Signed-off-by: Gollu Appalanaidu Signed-off-by: Klaus Jensen --- include/block/nvme.h | 21 + hw/block/nvme.c

[PATCH 03/16] hw/block/nvme: make lba data size configurable

2020-09-24 Thread Klaus Jensen
From: Klaus Jensen Allos the LBA data size (lbads) to be set between 9 and 12. Signed-off-by: Klaus Jensen Acked-by: Keith Busch Reviewed-by: Maxim Levitsky Reviewed-by: Philippe Mathieu-Daudé --- docs/specs/nvme.txt | 11 ++- hw/block/nvme-ns.h | 1 + hw/block/nvme-ns.c | 8

[PATCH 00/16] hw/block/nvme: zoned namespace command set

2020-09-24 Thread Klaus Jensen
From: Klaus Jensen While going through a few rounds of reviews on Dmitry's series I have also continued nursing my own implementation since originally posted. I did not receive any reviews originally, since it depended on a lot of preceding series, but now, with the staging of multiple

[PATCH 04/16] hw/block/nvme: reject io commands if only admin command set selected

2020-09-24 Thread Klaus Jensen
From: Klaus Jensen If the host sets CC.CSS to 111b, all commands submitted to I/O queues should be completed with status Invalid Command Opcode. Note that this is technically a v1.4 feature, but it does not hurt to implement before we finally bump the reported version implemented.

[PATCH 02/16] hw/block/nvme: add trace event for requests with non-zero status code

2020-09-24 Thread Klaus Jensen
From: Klaus Jensen If a command results in a non-zero status code, trace it. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 6 ++ hw/block/trace-events | 1 + 2 files changed, 7 insertions(+) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 84b6b516fa7b..3cbc3c7b75b1 100644

[PATCH 01/16] hw/block/nvme: add nsid to get/setfeat trace events

2020-09-24 Thread Klaus Jensen
From: Klaus Jensen Include the namespace id in the pci_nvme_{get,set}feat trace events. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 4 ++-- hw/block/trace-events | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index

Re: [PATCH v9 0/7] coroutines: generate wrapper code

2020-09-24 Thread no-reply
Patchew URL: https://patchew.org/QEMU/20200924185414.28642-1-vsement...@virtuozzo.com/ Hi, This series failed the docker-quick@centos7 build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally. === TEST SCRIPT

Re: [PATCH v7 4/5] block/io: fix bdrv_is_allocated_above

2020-09-24 Thread Eric Blake
On 9/24/20 2:40 PM, Vladimir Sementsov-Ogievskiy wrote: bdrv_is_allocated_above wrongly handles short backing files: it reports after-EOF space as UNALLOCATED which is wrong, as on read the data is generated on the level of short backing file (if all overlays has s/has/have/ unallocated area

Re: [PATCH v7 2/5] block/io: bdrv_common_block_status_above: support include_base

2020-09-24 Thread Eric Blake
On 9/24/20 2:40 PM, Vladimir Sementsov-Ogievskiy wrote: In order to reuse bdrv_common_block_status_above in bdrv_is_allocated_above, let's support include_base parameter. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia --- block/coroutines.h | 2 ++ block/io.c

Re: [PATCH v7 1/5] block/io: fix bdrv_co_block_status_above

2020-09-24 Thread Eric Blake
On 9/24/20 2:39 PM, Vladimir Sementsov-Ogievskiy wrote: bdrv_co_block_status_above has several design problems with handling short backing files: 1. With want_zeros=true, it may return ret with BDRV_BLOCK_ZERO but without BDRV_BLOCK_ALLOCATED flag, when actually short backing file which

[PATCH v7 4/5] block/io: fix bdrv_is_allocated_above

2020-09-24 Thread Vladimir Sementsov-Ogievskiy
bdrv_is_allocated_above wrongly handles short backing files: it reports after-EOF space as UNALLOCATED which is wrong, as on read the data is generated on the level of short backing file (if all overlays has unallocated area at that place). Reusing bdrv_common_block_status_above fixes the issue

Re: [PATCH v4 06/14] hw/block/nvme: Add support for active/inactive namespaces

2020-09-24 Thread Niklas Cassel
On Thu, Sep 24, 2020 at 08:55:24PM +0200, Klaus Jensen wrote: > On Sep 24 18:17, Niklas Cassel wrote: > > On Thu, Sep 24, 2020 at 02:12:03PM +0200, Klaus Jensen wrote: > > > On Sep 24 03:20, Dmitry Fomichev wrote: > > > > From: Niklas Cassel > > > > > > > > E.g., if the user sets CC.CSS to Admin

[PATCH v7 5/5] iotests: add commit top->base cases to 274

2020-09-24 Thread Vladimir Sementsov-Ogievskiy
These cases are fixed by previous patches around block_status and is_allocated. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia --- tests/qemu-iotests/274 | 20 +++ tests/qemu-iotests/274.out | 68

[PATCH v7 2/5] block/io: bdrv_common_block_status_above: support include_base

2020-09-24 Thread Vladimir Sementsov-Ogievskiy
In order to reuse bdrv_common_block_status_above in bdrv_is_allocated_above, let's support include_base parameter. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia --- block/coroutines.h | 2 ++ block/io.c | 21 ++--- 2 files changed, 16

[PATCH v7 1/5] block/io: fix bdrv_co_block_status_above

2020-09-24 Thread Vladimir Sementsov-Ogievskiy
bdrv_co_block_status_above has several design problems with handling short backing files: 1. With want_zeros=true, it may return ret with BDRV_BLOCK_ZERO but without BDRV_BLOCK_ALLOCATED flag, when actually short backing file which produces these after-EOF zeros is inside requested backing

[PATCH v7 3/5] block/io: bdrv_common_block_status_above: support bs == base

2020-09-24 Thread Vladimir Sementsov-Ogievskiy
We are going to reuse bdrv_common_block_status_above in bdrv_is_allocated_above. bdrv_is_allocated_above may be called with include_base == false and still bs == base (for ex. from img_rebase()). So, support this corner case. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Kevin Wolf

[PATCH v7 0/5] fix & merge block_status_above and is_allocated_above

2020-09-24 Thread Vladimir Sementsov-Ogievskiy
Hi all! These series are here to address the following problem: block-status-above functions may consider space after EOF of intermediate backing files as unallocated, which is wrong, as these backing files are the reason of producing zeroes, we never go further by backing chain after a short

Re: [PATCH v9 4/7] scripts: add block-coroutine-wrapper.py

2020-09-24 Thread Eric Blake
On 9/24/20 1:54 PM, Vladimir Sementsov-Ogievskiy wrote: We have a very frequent pattern of creating a coroutine from a function with several arguments: - create a structure to pack parameters - create _entry function to call original function taking parameters from struct - do

Re: [PATCH v9 0/7] coroutines: generate wrapper code

2020-09-24 Thread Eric Blake
On 9/24/20 1:54 PM, Vladimir Sementsov-Ogievskiy wrote: Hi all! The aim of the series is to reduce code-duplication and writing parameters structure-packing by hand around coroutine function wrappers. Benefits: - no code duplication - less indirection v9: Thanks to Eric, I used commit

Re: [PATCH v4 06/14] hw/block/nvme: Add support for active/inactive namespaces

2020-09-24 Thread Klaus Jensen
On Sep 24 18:17, Niklas Cassel wrote: > On Thu, Sep 24, 2020 at 02:12:03PM +0200, Klaus Jensen wrote: > > On Sep 24 03:20, Dmitry Fomichev wrote: > > > From: Niklas Cassel > > > > > > E.g., if the user sets CC.CSS to Admin Only, NVM namespaces should be > > > marked as inactive. > > > > > > >

[PATCH v9 6/7] block: drop bdrv_prwv

2020-09-24 Thread Vladimir Sementsov-Ogievskiy
Now that we are not maintaining boilerplate code for coroutine wrappers, there is no more sense in keeping the extra indirection layer of bdrv_prwv(). Let's drop it and instead generate pure bdrv_preadv() and bdrv_pwritev(). Currently, bdrv_pwritev() and bdrv_preadv() are returning bytes on

[PATCH v9 4/7] scripts: add block-coroutine-wrapper.py

2020-09-24 Thread Vladimir Sementsov-Ogievskiy
We have a very frequent pattern of creating a coroutine from a function with several arguments: - create a structure to pack parameters - create _entry function to call original function taking parameters from struct - do different magic to handle completion: set ret to NOT_DONE or

[PATCH v9 5/7] block: generate coroutine-wrapper code

2020-09-24 Thread Vladimir Sementsov-Ogievskiy
Use code generation implemented in previous commit to generated coroutine wrappers in block.c and block/io.c Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- block/coroutines.h| 6 +- include/block/block.h | 16 ++-- block.c

[PATCH v9 1/7] block: return error-code from bdrv_invalidate_cache

2020-09-24 Thread Vladimir Sementsov-Ogievskiy
This is the only coroutine wrapper from block.c and block/io.c which doesn't return a value, so let's convert it to the common behavior, to simplify moving to generated coroutine wrappers in a further commit. Also, bdrv_invalidate_cache is a void function, returning error only through **errp

[PATCH v9 2/7] block/io: refactor coroutine wrappers

2020-09-24 Thread Vladimir Sementsov-Ogievskiy
Most of our coroutine wrappers already follow this convention: We have 'coroutine_fn bdrv_co_()' as the core function, and a wrapper 'bdrv_()' which does parameter packing and calls bdrv_run_co(). The only outsiders are the bdrv_prwv_co and bdrv_common_block_status_above wrappers. Let's refactor

[PATCH v9 3/7] block: declare some coroutine functions in block/coroutines.h

2020-09-24 Thread Vladimir Sementsov-Ogievskiy
We are going to keep coroutine-wrappers code (structure-packing parameters, BDRV_POLL wrapper functions) in separate auto-generated files. So, we'll need a header with declaration of original _co_ functions, for those which are static now. As well, we'll need declarations for wrapper functions. Do

[PATCH v9 7/7] block/io: refactor save/load vmstate

2020-09-24 Thread Vladimir Sementsov-Ogievskiy
Like for read/write in a previous commit, drop extra indirection layer, generate directly bdrv_readv_vmstate() and bdrv_writev_vmstate(). Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- block/coroutines.h| 10 +++

[PATCH v9 0/7] coroutines: generate wrapper code

2020-09-24 Thread Vladimir Sementsov-Ogievskiy
Hi all! The aim of the series is to reduce code-duplication and writing parameters structure-packing by hand around coroutine function wrappers. Benefits: - no code duplication - less indirection v9: Thanks to Eric, I used commit message tweaks and rebase-conflict solving from his git. 01:

Re: [PATCH v8 4/7] scripts: add block-coroutine-wrapper.py

2020-09-24 Thread Vladimir Sementsov-Ogievskiy
24.09.2020 20:56, Eric Blake wrote: On 9/15/20 11:44 AM, Vladimir Sementsov-Ogievskiy wrote: We have a very frequent pattern of creating coroutine from function with several arguments: +++ b/docs/devel/block-coroutine-wrapper.rst @@ -0,0 +1,54 @@ +===

Re: [PATCH v4 06/14] hw/block/nvme: Add support for active/inactive namespaces

2020-09-24 Thread Niklas Cassel
On Thu, Sep 24, 2020 at 02:12:03PM +0200, Klaus Jensen wrote: > On Sep 24 03:20, Dmitry Fomichev wrote: > > From: Niklas Cassel > > > > E.g., if the user sets CC.CSS to Admin Only, NVM namespaces should be > > marked as inactive. > > > > Hmm. I'm not convinced that this is correct. Can you

Re: [PATCH v8 4/7] scripts: add block-coroutine-wrapper.py

2020-09-24 Thread Eric Blake
On 9/15/20 11:44 AM, Vladimir Sementsov-Ogievskiy wrote: We have a very frequent pattern of creating coroutine from function with several arguments: +++ b/docs/devel/block-coroutine-wrapper.rst @@ -0,0 +1,54 @@ +=== +block-coroutine-wrapper +=== + +A

Re: [PATCH v8 2/7] copy-on-read: add filter append/drop functions

2020-09-24 Thread Vladimir Sementsov-Ogievskiy
24.09.2020 20:40, Andrey Shinkevich wrote: On 24.09.2020 20:29, Andrey Shinkevich wrote: On 24.09.2020 18:00, Max Reitz wrote: On 24.09.20 16:51, Vladimir Sementsov-Ogievskiy wrote: 24.09.2020 16:25, Max Reitz wrote: On 23.09.20 16:38, Vladimir Sementsov-Ogievskiy wrote: 17.09.2020 19:09,

Re: [PATCH v8 2/7] copy-on-read: add filter append/drop functions

2020-09-24 Thread Andrey Shinkevich
On 24.09.2020 20:29, Andrey Shinkevich wrote: On 24.09.2020 18:00, Max Reitz wrote: On 24.09.20 16:51, Vladimir Sementsov-Ogievskiy wrote: 24.09.2020 16:25, Max Reitz wrote: On 23.09.20 16:38, Vladimir Sementsov-Ogievskiy wrote: 17.09.2020 19:09, Andrey Shinkevich wrote: On 04.09.2020

Re: [PATCH v6 08/15] block: introduce preallocate filter

2020-09-24 Thread Vladimir Sementsov-Ogievskiy
24.09.2020 19:50, Max Reitz wrote: On 18.09.20 20:19, Vladimir Sementsov-Ogievskiy wrote: It's intended to be inserted between format and protocol nodes to preallocate additional space (expanding protocol file) on writes crossing EOF. It improves performance for file-systems with slow

Re: [PATCH v8 2/7] copy-on-read: add filter append/drop functions

2020-09-24 Thread Andrey Shinkevich
On 24.09.2020 18:00, Max Reitz wrote: On 24.09.20 16:51, Vladimir Sementsov-Ogievskiy wrote: 24.09.2020 16:25, Max Reitz wrote: On 23.09.20 16:38, Vladimir Sementsov-Ogievskiy wrote: 17.09.2020 19:09, Andrey Shinkevich wrote: On 04.09.2020 14:22, Max Reitz wrote: On 28.08.20 18:52, Andrey

Re: [PATCH v2 00/31] block/export: Add infrastructure and QAPI for block exports

2020-09-24 Thread no-reply
Patchew URL: https://patchew.org/QEMU/20200924152717.287415-1-kw...@redhat.com/ Hi, This series seems to have some coding style problems. See output below for more information: Type: series Message-id: 20200924152717.287415-1-kw...@redhat.com Subject: [PATCH v2 00/31] block/export: Add

Re: [PATCH v6 09/15] qemu-io: add preallocate mode parameter for truncate command

2020-09-24 Thread Max Reitz
On 18.09.20 20:19, Vladimir Sementsov-Ogievskiy wrote: > This will be used in further test. > > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > qemu-io-cmds.c | 46 -- > 1 file changed, 32 insertions(+), 14 deletions(-) > > diff --git

Re: [PATCH v6 5/5] iotests: add commit top->base cases to 274

2020-09-24 Thread Alberto Garcia
On Wed 16 Sep 2020 02:20:08 PM CEST, Vladimir Sementsov-Ogievskiy wrote: > These cases are fixed by previous patches around block_status and > is_allocated. > > Signed-off-by: Vladimir Sementsov-Ogievskiy > Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Berto

Re: [PATCH v6 4/5] block/io: fix bdrv_is_allocated_above

2020-09-24 Thread Alberto Garcia
On Wed 16 Sep 2020 02:20:07 PM CEST, Vladimir Sementsov-Ogievskiy wrote: > bdrv_is_allocated_above wrongly handles short backing files: it reports > after-EOF space as UNALLOCATED which is wrong, as on read the data is > generated on the level of short backing file (if all overlays has >

Re: [PATCH v6 1/5] block/io: fix bdrv_co_block_status_above

2020-09-24 Thread Alberto Garcia
On Wed 16 Sep 2020 02:20:04 PM CEST, Vladimir Sementsov-Ogievskiy wrote: > bdrv_co_block_status_above has several design problems with handling > short backing files: > > 1. With want_zeros=true, it may return ret with BDRV_BLOCK_ZERO but > without BDRV_BLOCK_ALLOCATED flag, when actually short

Re: [PATCH v6 08/15] block: introduce preallocate filter

2020-09-24 Thread Max Reitz
On 18.09.20 20:19, Vladimir Sementsov-Ogievskiy wrote: > It's intended to be inserted between format and protocol nodes to > preallocate additional space (expanding protocol file) on writes > crossing EOF. It improves performance for file-systems with slow > allocation. > > Signed-off-by:

Re: [PATCH v8 4/7] scripts: add block-coroutine-wrapper.py

2020-09-24 Thread John Snow
On 9/23/20 8:00 PM, Eric Blake wrote: There's enough grammar fixes, and the fact that John is working on python cleanups, to make me wonder if we need a v9, or if I should just stage it where it is with any other cleanups as followups.  But I'm liking the reduced maintenance burden once it

[PATCH v2 29/31] iotests: Introduce qemu_nbd_list_log()

2020-09-24 Thread Kevin Wolf
Add a function to list the NBD exports offered by an NBD server. Signed-off-by: Kevin Wolf --- tests/qemu-iotests/iotests.py | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index

[PATCH v2 23/31] block/export: Create BlockBackend in blk_exp_add()

2020-09-24 Thread Kevin Wolf
Every export type will need a BlockBackend, so creating it centrally in blk_exp_add() instead of the .create driver callback avoids duplication. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- include/block/nbd.h | 4 ++-- block/export/export.c | 49

[PATCH v2 31/31] iotests: Test block-export-* QMP interface

2020-09-24 Thread Kevin Wolf
Signed-off-by: Kevin Wolf --- tests/qemu-iotests/307 | 132 + tests/qemu-iotests/307.out | 124 ++ tests/qemu-iotests/group | 1 + 3 files changed, 257 insertions(+) create mode 100755 tests/qemu-iotests/307 create

[PATCH v2 24/31] block/export: Add query-block-exports

2020-09-24 Thread Kevin Wolf
This adds a simple QMP command to query the list of block exports. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- qapi/block-export.json | 32 block/export/export.c | 23 +++ 2 files changed, 55 insertions(+) diff --git

[PATCH v2 30/31] iotests: Allow supported and unsupported formats at the same time

2020-09-24 Thread Kevin Wolf
This is useful for specifying 'generic' as supported (which includes only writable image formats), but still excluding some incompatible writable formats. It also removes more lines than it adds. Signed-off-by: Kevin Wolf --- tests/qemu-iotests/iotests.py | 6 +- 1 file changed, 1

[PATCH v2 26/31] nbd: Merge nbd_export_new() and nbd_export_create()

2020-09-24 Thread Kevin Wolf
There is no real reason any more why nbd_export_new() and nbd_export_create() should be separate functions. The latter only performs a few checks before it calls the former. What makes the current state stand out is that it's the only function in BlockExportDriver that is not a static function

[PATCH v2 17/31] block/export: Add blk_exp_close_all(_type)

2020-09-24 Thread Kevin Wolf
This adds a function to shut down all block exports, and another one to shut down the block exports of a single type. The latter is used for now when stopping the NBD server. As soon as we implement support for multiple NBD servers, we'll need a per-server list of exports and it will be replaced

[PATCH v2 15/31] block/export: Add node-name to BlockExportOptions

2020-09-24 Thread Kevin Wolf
Every block export needs a block node to export, so add a 'node-name' option to BlockExportOptions and remove the replaced option 'device' from BlockExportOptionsNbd. To maintain compatibility in nbd-server-add, BlockExportOptionsNbd needs to be wrapped by a new type NbdServerAddOptions that adds

[PATCH v2 13/31] block/export: Move refcount from NBDExport to BlockExport

2020-09-24 Thread Kevin Wolf
Having a refcount makes sense for all types of block exports. It is also a prerequisite for keeping a list of all exports at the BlockExport level. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- include/block/export.h | 15 + include/block/nbd.h| 2 -- block/export/export.c

[PATCH v2 18/31] block/export: Add 'id' option to block-export-add

2020-09-24 Thread Kevin Wolf
We'll need an id to identify block exports in monitor commands. This adds one. Note that this is different from the 'name' option in the NBD server, which is the externally visible export name. While block export ids need to be unique in the whole process, export names must be unique only for the

[PATCH v2 27/31] nbd: Deprecate nbd-server-add/remove

2020-09-24 Thread Kevin Wolf
These QMP commands are replaced by block-export-add/del. Signed-off-by: Kevin Wolf --- qapi/block-export.json | 11 +-- docs/system/deprecated.rst | 6 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/qapi/block-export.json b/qapi/block-export.json index

[PATCH v2 22/31] block/export: Move blk to BlockExport

2020-09-24 Thread Kevin Wolf
Every block export has a BlockBackend representing the disk that is exported. It should live in BlockExport therefore. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- include/block/export.h | 3 +++ block/export/export.c | 3 +++ nbd/server.c | 43

[PATCH v2 28/31] iotests: Factor out qemu_tool_pipe_and_status()

2020-09-24 Thread Kevin Wolf
We have three almost identical functions that call an external process and return its output and return code. Refactor them into small wrappers around a common function. Signed-off-by: Kevin Wolf --- tests/qemu-iotests/iotests.py | 49 --- 1 file changed, 23

[PATCH v2 04/31] block/export: Add BlockExport infrastructure and block-export-add

2020-09-24 Thread Kevin Wolf
We want to have a common set of commands for all types of block exports. Currently, this is only NBD, but we're going to add more types. This patch adds the basic BlockExport and BlockExportDriver structs and a QMP command block-export-add that creates a new export based on the given

[PATCH v2 08/31] nbd: Add max-connections to nbd-server-start

2020-09-24 Thread Kevin Wolf
This is a QMP equivalent of qemu-nbd's --shared option, limiting the maximum number of clients that can attach at the same time. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Eric Blake --- qapi/block-export.json | 10 +++-- include/block/nbd.h

[PATCH v2 01/31] nbd: Remove unused nbd_export_get_blockdev()

2020-09-24 Thread Kevin Wolf
Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Eric Blake --- include/block/nbd.h | 2 -- nbd/server.c| 5 - 2 files changed, 7 deletions(-) diff --git a/include/block/nbd.h b/include/block/nbd.h index 9bc3bfaeec..0451683d03 100644 --- a/include/block/nbd.h +++

[PATCH v2 20/31] block/export: Add block-export-del

2020-09-24 Thread Kevin Wolf
Implement a new QMP command block-export-del and make nbd-server-remove a wrapper around it. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- qapi/block-export.json | 32 - include/block/export.h | 1 + include/block/nbd.h| 1 -

[PATCH v2 19/31] block/export: Move strong user reference to block_exports

2020-09-24 Thread Kevin Wolf
The reference owned by the user/monitor that is created when adding the export and dropped when removing it was tied to the 'exports' list in nbd/server.c. Every block export will have a user reference, so move it to the block export level and tie it to the 'block_exports' list in

[PATCH v2 25/31] block/export: Move writable to BlockExportOptions

2020-09-24 Thread Kevin Wolf
The 'writable' option is a basic option that will probably be applicable to most if not all export types that we will implement. Move it from NBD to the generic BlockExport layer. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- qapi/block-export.json | 15 ++-

[PATCH v2 21/31] block/export: Add BLOCK_EXPORT_DELETED event

2020-09-24 Thread Kevin Wolf
Clients may want to know when an export has finally disappeard (block-export-del returns earlier than that in the general case), so add a QAPI event for it. Signed-off-by: Kevin Wolf --- qapi/block-export.json | 12 block/export/export.c | 2 ++ tests/qemu-iotests/140

[PATCH v2 16/31] block/export: Allocate BlockExport in blk_exp_add()

2020-09-24 Thread Kevin Wolf
Instead of letting the driver allocate and return the BlockExport object, allocate it already in blk_exp_add() and pass it. This allows us to initialise the generic part before calling into the driver so that the driver can just use these values instead of having to parse the options a second

[PATCH v2 14/31] block/export: Move AioContext from NBDExport to BlockExport

2020-09-24 Thread Kevin Wolf
Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- include/block/export.h | 3 +++ block/export/export.c | 2 ++ nbd/server.c | 26 +- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/include/block/export.h b/include/block/export.h index

[PATCH v2 12/31] nbd/server: Simplify export shutdown

2020-09-24 Thread Kevin Wolf
Closing export is somewhat convoluted because nbd_export_close() and nbd_export_put() call each other and the ways they actually end up being nested is not necessarily obvious. However, it is not really necessary to call nbd_export_close() from nbd_export_put() when putting the last reference

[PATCH v2 07/31] block/export: Remove magic from block-export-add

2020-09-24 Thread Kevin Wolf
nbd-server-add tries to be convenient and adds two questionable features that we don't want to share in block-export-add, even for NBD exports: 1. When requesting a writable export of a read-only device, the export is silently downgraded to read-only. This should be an error in the context

[PATCH v2 11/31] qemu-nbd: Use blk_exp_add() to create the export

2020-09-24 Thread Kevin Wolf
With this change, NBD exports are now only created through the BlockExport interface. This allows us finally to move things from the NBD layer to the BlockExport layer if they make sense for other export types, too. blk_exp_add() returns only a weak reference, so the explicit nbd_export_put()

[PATCH v2 10/31] nbd: Remove NBDExport.close callback

2020-09-24 Thread Kevin Wolf
The export close callback is unused by the built-in NBD server. qemu-nbd uses it only during shutdown to wait for the unrefed export to actually go away. It can just use nbd_export_close_all() instead and do without the callback. This removes the close callback from nbd_export_new() and makes

[PATCH v2 09/31] nbd: Add writethrough to block-export-add

2020-09-24 Thread Kevin Wolf
qemu-nbd allows use of writethrough cache modes, which mean that write requests made through NBD will cause a flush before they complete. Expose the same functionality in block-export-add. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- qapi/block-export.json | 7 ++- blockdev-nbd.c

[PATCH v2 03/31] qapi: Rename BlockExport to BlockExportOptions

2020-09-24 Thread Kevin Wolf
The name BlockExport will be used for the struct containing the runtime state of block exports, so change the name of export creation options. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Eric Blake --- qapi/block-export.json | 12 ++--

[PATCH v2 08/13] util/vhost-user-server: check EOF when reading payload

2020-09-24 Thread Stefan Hajnoczi
Unexpected EOF is an error that must be reported. Signed-off-by: Stefan Hajnoczi --- util/vhost-user-server.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/util/vhost-user-server.c b/util/vhost-user-server.c index 5a60e2ca2a..ec555abcb2 100644 ---

[PATCH v2 06/31] qemu-nbd: Use raw block driver for --offset

2020-09-24 Thread Kevin Wolf
Instead of implementing qemu-nbd --offset in the NBD code, just put a raw block node with the requested offset on top of the user image and rely on that doing the job. This does not only simplify the nbd_export_new() interface and bring it closer to the set of options that the nbd-server-add QMP

[PATCH v2 05/31] qemu-storage-daemon: Use qmp_block_export_add()

2020-09-24 Thread Kevin Wolf
No reason to duplicate the functionality locally, we can now just reuse the QMP command block-export-add for --export. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Eric Blake --- storage-daemon/qemu-storage-daemon.c | 13 + 1 file changed, 1 insertion(+), 12

[PATCH v2 02/31] qapi: Create block-export module

2020-09-24 Thread Kevin Wolf
Move all block export related types and commands from block-core to the new QAPI module block-export. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Eric Blake --- qapi/block-core.json | 166 - qapi/block-export.json | 175

[PATCH v2 00/31] block/export: Add infrastructure and QAPI for block exports

2020-09-24 Thread Kevin Wolf
We are planning to add more block export types than just NBD in the near future (e.g. vhost-user-blk and FUSE). This series lays the ground for this with some generic block export infrastructure and QAPI interfaces that will allow managing all of them (for now add/remove/query). As a side effect,

[PATCH v2 09/13] util/vhost-user-server: rework vu_client_trip() coroutine lifecycle

2020-09-24 Thread Stefan Hajnoczi
The vu_client_trip() coroutine is leaked during AioContext switching. It is also unsafe to destroy the vu_dev in panic_cb() since its callers still access it in some cases. Rework the lifecycle to solve these safety issues. Signed-off-by: Stefan Hajnoczi --- util/vhost-user-server.h

[PATCH v2 07/13] util/vhost-user-server: fix memory leak in vu_message_read()

2020-09-24 Thread Stefan Hajnoczi
fds[] is leaked when qio_channel_readv_full() fails. Use vmsg->fds[] instead of keeping a local fds[] array. Then we can reuse goto fail to clean up fds. vmsg->fd_num must be zeroed before the loop to make this safe. Signed-off-by: Stefan Hajnoczi --- util/vhost-user-server.c | 50

[PATCH v2 13/13] util/vhost-user-server: use static library in meson.build

2020-09-24 Thread Stefan Hajnoczi
Don't compile contrib/libvhost-user/libvhost-user.c again. Instead build the static library once and then reuse it throughout QEMU. Also switch from CONFIG_LINUX to CONFIG_VHOST_USER, which is what the vhost-user tools (vhost-user-gpu, etc) do. Signed-off-by: Stefan Hajnoczi ---

[PATCH v2 12/13] util/vhost-user-server: move header to include/

2020-09-24 Thread Stefan Hajnoczi
Headers used by other subsystems are located in include/. Also add the vhost-user-server and vhost-user-blk-server headers to MAINTAINERS. Signed-off-by: Stefan Hajnoczi --- MAINTAINERS| 4 +++- {util => include/qemu}/vhost-user-server.h | 0

[PATCH v2 10/13] block/export: report flush errors

2020-09-24 Thread Stefan Hajnoczi
Propagate the flush return value since errors are possible. Signed-off-by: Stefan Hajnoczi --- block/export/vhost-user-blk-server.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/block/export/vhost-user-blk-server.c b/block/export/vhost-user-blk-server.c index

[PATCH v2 11/13] block/export: convert vhost-user-blk server to block export API

2020-09-24 Thread Stefan Hajnoczi
Use the new QAPI block exports API instead of defining our own QOM objects. This is a large change because the lifecycle of VuBlockDev needs to follow BlockExportDriver. QOM properties are replaced by QAPI options objects. VuBlockDev is renamed VuBlkExport and contains a BlockExport field.

[PATCH v2 06/13] util/vhost-user-server: drop unused DevicePanicNotifier

2020-09-24 Thread Stefan Hajnoczi
The device panic notifier callback is not used. Drop it. Signed-off-by: Stefan Hajnoczi --- util/vhost-user-server.h | 3 --- block/export/vhost-user-blk-server.c | 3 +-- util/vhost-user-server.c | 6 -- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git

  1   2   >