[PATCH v2 4/4] qcow2: Use BDRV_SECTOR_SIZE instead of the hardcoded value

2020-01-09 Thread Alberto Garcia
This replaces all remaining instances in the qcow2 code. Signed-off-by: Alberto Garcia --- block/qcow2-cluster.c | 2 +- block/qcow2.c | 10 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index

[PATCH v2 1/4] qcow2: Require that the virtual size is a multiple of the sector size

2020-01-09 Thread Alberto Garcia
The qcow2 header specifies the virtual size of the image in bytes, but BlockDriverState stores it as a number of 512-byte sectors. If the user tries to create an image with a size that is not a multiple of the sector size then this is fixed on creation by silently rounding the image size up (see

[PATCH v2 0/4] qcow2: Misc BDRV_SECTOR_SIZE updates

2020-01-09 Thread Alberto Garcia
This small series gets rid of all the remaining instances of hardcoded sector sizes in the qcow2 code and adds a check for images whose virtual size is not a multiple of the sector size. See the individual patches for details. Berto v2: - Modify output of iotest 080 to make it easier to

[PATCH v2 2/4] qcow2: Don't round the L1 table allocation up to the sector size

2020-01-09 Thread Alberto Garcia
The L1 table is read from disk using the byte-based bdrv_pread() and is never accessed beyond its last element, so there's no need to allocate more memory than that. Signed-off-by: Alberto Garcia --- block/qcow2-cluster.c | 5 ++--- block/qcow2-refcount.c | 2 +- block/qcow2-snapshot.c | 3 +--

[PATCH v2 3/4] qcow2: Tighten cluster_offset alignment assertions

2020-01-09 Thread Alberto Garcia
qcow2_alloc_cluster_offset() and qcow2_get_cluster_offset() always return offsets that are cluster-aligned so don't just check that they are sector-aligned. The check in qcow2_co_preadv_task() is also replaced by an assertion for the same reason. Signed-off-by: Alberto Garcia --- block/qcow2.c

[PATCH 1/4] qapi: Add a 'coroutine' flag for commands

2020-01-09 Thread Kevin Wolf
This patch adds a new 'coroutine' flag to QMP command definitions that tells the QMP dispatcher than the command handler is safe to be run in a coroutine. Signed-off-by: Kevin Wolf --- tests/qapi-schema/qapi-schema-test.json | 1 + docs/devel/qapi-code-gen.txt| 4

[PATCH 4/4] qmp: Move dispatcher to a coroutine

2020-01-09 Thread Kevin Wolf
This moves the QMP dispatcher to a coroutine and runs all QMP command handlers that declare 'coroutine': true in coroutine context so they can avoid blocking the main loop while doing I/O or waiting for other events. For commands that are not declared safe to run in a coroutine, the dispatcher

[PATCH 2/4] block: Mark 'block_resize' as coroutine

2020-01-09 Thread Kevin Wolf
block_resize is safe to run in a coroutine, so use it as an example for the new 'coroutine': true annotation in the QAPI schema. Signed-off-by: Kevin Wolf --- qapi/block-core.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qapi/block-core.json b/qapi/block-core.json

[PATCH 0/4] qmp: Optionally run handlers in coroutines

2020-01-09 Thread Kevin Wolf
Some QMP command handlers can block the main loop for a relatively long time, for example because they perform some I/O. This is quite nasty. Allowing such handlers to run in a coroutine where they can yield (and therefore release the BQL) while waiting for an event such as I/O completion solves

[PATCH 3/4] vl: Initialise main loop earlier

2020-01-09 Thread Kevin Wolf
We want to be able to use qemu_aio_context in the monitor initialisation. Signed-off-by: Kevin Wolf --- vl.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vl.c b/vl.c index 86474a55c9..4c79a00857 100644 --- a/vl.c +++ b/vl.c @@ -2903,6 +2903,11 @@ int main(int

Re: Pre-Christmas meeting notes

2020-01-09 Thread Thomas Huth
On 09/01/2020 16.03, Vladimir Sementsov-Ogievskiy wrote: > 06.01.2020 20:15, Max Reitz wrote: >> Misc >> >> >> The Wiki’s TODO list is horribly outdated. What should we do about >> it? Maybe archive it and start a new one? (Most of the things on the >> current list are either done or we

Re: Pre-Christmas meeting notes

2020-01-09 Thread Vladimir Sementsov-Ogievskiy
06.01.2020 20:15, Max Reitz wrote: > Misc > > > The Wiki’s TODO list is horribly outdated. What should we do about > it? Maybe archive it and start a new one? (Most of the things on the > current list are either done or we don’t want to do anymore.) May be, create block/TODO.txt

Re: [PATCH 3/3] qcow2: Use BDRV_SECTOR_SIZE instead of the hardcoded value

2020-01-09 Thread Kevin Wolf
Am 09.01.2020 um 13:30 hat Alberto Garcia geschrieben: > On Thu 09 Jan 2020 01:19:00 PM CET, Kevin Wolf wrote: > >> diff --git a/block/qcow2.c b/block/qcow2.c > >> index e8ce966f7f..6427c75409 100644 > >> --- a/block/qcow2.c > >> +++ b/block/qcow2.c > >> @@ -2175,7 +2175,7 @@ static coroutine_fn

Re: [PATCH 1/3] qcow2: Require that the virtual size is a multiple of the sector size

2020-01-09 Thread Alberto Garcia
On Wed 08 Jan 2020 08:46:11 PM CET, Nir Soffer wrote: >> However when an image is opened the virtual size is rounded down, >> which means that trying to access the last few advertised bytes will >> result in an error. As seen above QEMU cannot create such images and >> there's no good use case

Re: [PATCH 3/3] qcow2: Use BDRV_SECTOR_SIZE instead of the hardcoded value

2020-01-09 Thread Alberto Garcia
On Thu 09 Jan 2020 01:19:00 PM CET, Kevin Wolf wrote: >> diff --git a/block/qcow2.c b/block/qcow2.c >> index e8ce966f7f..6427c75409 100644 >> --- a/block/qcow2.c >> +++ b/block/qcow2.c >> @@ -2175,7 +2175,7 @@ static coroutine_fn int >> qcow2_co_preadv_task(BlockDriverState *bs, >>

Re: [PATCH 3/3] qcow2: Use BDRV_SECTOR_SIZE instead of the hardcoded value

2020-01-09 Thread Kevin Wolf
Am 08.01.2020 um 18:49 hat Alberto Garcia geschrieben: > This replaces all remaining instances in the qcow2 code. > > Signed-off-by: Alberto Garcia > diff --git a/block/qcow2.c b/block/qcow2.c > index e8ce966f7f..6427c75409 100644 > --- a/block/qcow2.c > +++ b/block/qcow2.c > @@ -2175,7 +2175,7

Re: [PATCH 1/3] qcow2: Require that the virtual size is a multiple of the sector size

2020-01-09 Thread Kevin Wolf
Am 08.01.2020 um 20:46 hat Nir Soffer geschrieben: > On Wed, Jan 8, 2020 at 7:52 PM Alberto Garcia wrote: > > > > The qcow2 header specifies the virtual size of the image in bytes, but > > BlockDriverState stores it as a number of 512-byte sectors. > > > > If the user tries to create an image

Re: [PATCH v4 20/24] nvme: add support for scatter gather lists

2020-01-09 Thread Beata Michalska
Hi Klaus, On Thu, 19 Dec 2019 at 13:09, Klaus Jensen wrote: > > For now, support the Data Block, Segment and Last Segment descriptor > types. > > See NVM Express 1.3d, Section 4.4 ("Scatter Gather List (SGL)"). > > Signed-off-by: Klaus Jensen > Acked-by: Fam Zheng > --- > block/nvme.c

Re: [PATCH v4 17/24] nvme: allow multiple aios per command

2020-01-09 Thread Beata Michalska
Hi Klaus, On Thu, 19 Dec 2019 at 13:09, Klaus Jensen wrote: > > This refactors how the device issues asynchronous block backend > requests. The NvmeRequest now holds a queue of NvmeAIOs that are > associated with the command. This allows multiple aios to be issued for > a command. Only when all

Re: [PATCH v4 19/24] nvme: handle dma errors

2020-01-09 Thread Beata Michalska
Hi Klaus, On Thu, 19 Dec 2019 at 13:09, Klaus Jensen wrote: > > Handling DMA errors gracefully is required for the device to pass the > block/011 test ("disable PCI device while doing I/O") in the blktests > suite. > > With this patch the device passes the test by retrying "critical" > transfers

Re: [PATCH] nbd/server: improve nbd_negotiate_send_rep_list

2020-01-09 Thread Vladimir Sementsov-Ogievskiy
08.01.2020 1:01, Eric Blake wrote: > On 12/26/19 2:15 AM, Vladimir Sementsov-Ogievskiy wrote: >> Don't try to write zero-lenght strings. > > length > >> >> Signed-off-by: Vladimir Sementsov-Ogievskiy >> --- >>   nbd/server.c | 16 ++-- >>   1 file changed, 10 insertions(+), 6

[PATCH v2 3/4] qemu-img: allow qemu-img measure --object without a filename

2020-01-09 Thread Stefan Hajnoczi
In most qemu-img sub-commands the --object option only makes sense when there is a filename. qemu-img measure is an exception because objects may be referenced from the image creation options instead of an existing image file. Allow --object without a filename. Signed-off-by: Stefan Hajnoczi

[PATCH v2 2/4] luks: implement .bdrv_measure()

2020-01-09 Thread Stefan Hajnoczi
Add qemu-img measure support in the "luks" block driver. Signed-off-by: Stefan Hajnoczi --- block/crypto.c | 82 ++ 1 file changed, 82 insertions(+) diff --git a/block/crypto.c b/block/crypto.c index ed32202fa2..51f37bb1f6 100644 ---

[PATCH v2 4/4] iotests: add 282 luks qemu-img measure test

2020-01-09 Thread Stefan Hajnoczi
This test exercises the block/crypto.c "luks" block driver .bdrv_measure() code. Signed-off-by: Stefan Hajnoczi --- tests/qemu-iotests/282 | 93 ++ tests/qemu-iotests/282.out | 30 tests/qemu-iotests/group | 1 + 3 files changed, 124

[PATCH v2 1/4] luks: extract block_crypto_calculate_payload_offset()

2020-01-09 Thread Stefan Hajnoczi
The qcow2 .bdrv_measure() code calculates the crypto payload offset. This logic really belongs in block/crypto.c where it can be reused by other image formats. The "luks" block driver will need this same logic in order to implement .bdrv_measure(), so extract the

[PATCH v2 0/4] luks: add qemu-img measure support

2020-01-09 Thread Stefan Hajnoczi
v2: * Fix uint64_t <-> size_t type mismatch in block_crypto_measure() so that 32-bit builds pass This patch series adds qemu-img measure support to the "luks" block driver. We just need to take into account the LUKS header when sizing the image. Stefan Hajnoczi (4): luks: extract

Re: [PATCH 0/4] luks: add qemu-img measure support

2020-01-09 Thread Stefan Hajnoczi
On Wed, Jan 08, 2020 at 04:16:09AM -0800, no-re...@patchew.org wrote: > === TEST SCRIPT BEGIN === > #! /bin/bash > export ARCH=x86_64 > make docker-image-fedora V=1 NETWORK=1 > time make docker-test-mingw@fedora J=14 NETWORK=1 > === TEST SCRIPT END === > > CC io/channel-websock.o > CC