Re: [PATCH v3 1/3] block: Add blk_new_with_bs() helper

2020-04-27 Thread Max Reitz
On 27.04.20 16:03, Eric Blake wrote: > On 4/27/20 5:00 AM, Max Reitz wrote: >> On 24.04.20 21:09, Eric Blake wrote: >>> There are several callers that need to create a new block backend from >>> an existing BDS; make the task slightly easier with a common helper >>> routine. >>> >>> Suggested-by: M

Re: [PATCH v20 3/4] qcow2: add zstd cluster compression

2020-04-27 Thread Max Reitz
On 27.04.20 21:26, Denis Plotnikov wrote: > > > On 27.04.2020 15:35, Max Reitz wrote: >> On 21.04.20 10:11, Denis Plotnikov wrote: >>> zstd significantly reduces cluster compression time. >>> It provides better compression performance maintaining >>> the same level of the compression ratio in com

fdatasync semantics and block device backup

2020-04-27 Thread Bryan S Rosenburg
Blockdev community, Our group would like to write block device backups directly to an object store, using an interface such as s3fs or rclone-mount. We've run into problems with both interfaces, and in both cases the problems revolve around fdatasync system calls. With s3fs, fdatasync calls are

Re: [PATCH v20 3/4] qcow2: add zstd cluster compression

2020-04-27 Thread Denis Plotnikov
On 27.04.2020 15:35, Max Reitz wrote: On 21.04.20 10:11, Denis Plotnikov wrote: zstd significantly reduces cluster compression time. It provides better compression performance maintaining the same level of the compression ratio in comparison with zlib, which, at the moment, is the only compre

Re: [PATCH v4 24/30] qcow2: Clear the L2 bitmap when allocating a compressed cluster

2020-04-27 Thread Alberto Garcia
On Mon 27 Apr 2020 09:49:00 AM CEST, Max Reitz wrote: >> The point is this: Consider 'write -P 0xff 0 64k', then 'write -z 16k >> 16k', then 'read 0 64k'. For normal clusters, we can just do a >> scatter-gather iov read of read 0-16k and 32-64k, plus a memset of >> 16-32k. But for compressed cluste

Re: [PATCH v7 00/10] block: Fix resize (extending) of short overlays

2020-04-27 Thread Kevin Wolf
Am 24.04.2020 um 14:54 hat Kevin Wolf geschrieben: > v7: > - Allocate smaller zero buffer [Vladimir] > - Added missing error_setg_errno() [Max] > - Code cleanup in the iotest, enabled mapping for 'metadata' [Vladimir] > - Don't assign to errp twice [Eric] Thanks for the review, applied to the bloc

[PATCH v2 9/9] block/io: expand in_flight inc/dec section: bdrv_make_zero

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
It's safer to expand in_flight request to start before enter to coroutine in synchronous wrappers and end after BDRV_POLL_WHILE loop. Note that qemu_coroutine_enter may only schedule the coroutine in some circumstances. bdrv_make_zero update includes refactoring: move the whole loop into coroutine

[PATCH v2 2/9] block/io: refactor bdrv_co_ioctl: move aio stuff to corresponding block

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- block/io.c | 23 +++ 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/block/io.c b/block/io.c index 94ab8eaa0f..880871e691 100644 --- a/block/io.c +++ b/block/io.c @@ -3125,31 +3125,38

[PATCH v2 7/9] block/io: add bdrv_do_pwrite_zeroes

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
We'll need a bdrv_co_pwrite_zeroes version without inc/dec in_flight to be used in further implementation of bdrv_make_zero. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- block/io.c | 23 +++ 1 file changed, 19 insertions(+), 4 deletions(-) di

[PATCH v2 5/9] block/io: expand in_flight inc/dec section: simple cases

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
It's safer to expand in_flight request to start before enter to coroutine in synchronous wrappers, due to the following (theoretical) problem: Consider write. It's possible, that qemu_coroutine_enter only schedules execution, assume such case. Then we may possibly have the following: 1. Somehow

[PATCH v2 8/9] block/io: move bdrv_make_zero under block-status

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
We are going to use bdrv_co_block_status in bdrv_make_zero, so move it now down. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- block/io.c | 82 +++--- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/b

[PATCH v2 6/9] block/io: expand in_flight inc/dec section: block-status

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
It's safer to expand in_flight request to start before enter to coroutine in synchronous wrappers and end after BDRV_POLL_WHILE loop. Note that qemu_coroutine_enter may only schedule the coroutine in some circumstances. block-status requests are complex, they involve querying different block drive

[PATCH v2 4/9] block/io: move bdrv_rw_co_entry and friends down

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
We are going to use bdrv_co_pwritev_part and bdrv_co_preadv_part in bdrv_rw_co_entry, so move it down. Note: Comment formatting was changed to conform to coding style and function order was changed. Otherwise the code is unmodified. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan

[PATCH v2 3/9] block/io: move flush and pdiscard stuff down

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
bdrv_co_flush and bdrv_co_pdiscard will become static in further patch, move their usage down. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- block/io.c | 56 +++--- 1 file changed, 28 insertions(+), 28 deletions(-)

[PATCH v2 1/9] block/io: refactor bdrv_is_allocated_above to run only one coroutine

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
bdrv_is_allocated_above creates new coroutine on each iteration if called from non-coroutine context. To simplify expansion of in_flight inc/dec sections in further patch let's refactor it. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/io.c | 76 ++

[PATCH v2 0/9] block/io: safer inc/dec in_flight sections

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
Hi all! This is inspired by Kevin's "block: Fix blk->in_flight during blk_wait_while_drained()" series. So, like it's now done for block-backends, let's expand in_flight-protected sections for bdrv_ interfaces, including coroutine_enter and BDRV_POLL_WHILE loop into these sections. v2: 01: drop

Re: [PATCH v2 00/17] 64bit block-layer

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
Hmm. I definitely should rebase it onto "[PATCH for-5.0? 0/9] block/io: safer inc/dec in_flight sections"... 27.04.2020 11:23, Vladimir Sementsov-Ogievskiy wrote: Hi all! v1 was "[RFC 0/3] 64bit block-layer part I", please refer to initial cover-letter https://lists.gnu.org/archive/html/qem

Re: [PATCH 4/9] block/io: move bdrv_rw_co_entry and friends down

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
20.04.2020 19:04, Stefan Hajnoczi wrote: On Wed, Apr 08, 2020 at 12:30:46PM +0300, Vladimir Sementsov-Ogievskiy wrote: We are going to use bdrv_co_pwritev_part and bdrv_co_preadv_part in bdrv_rw_co_entry, so move it down. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/io.c | 361 +

Re: [PATCH v2 01/17] block/throttle-groups: throttle_group_co_io_limits_intercept(): 64bit bytes

2020-04-27 Thread Eric Blake
On 4/27/20 5:05 AM, Philippe Mathieu-Daudé wrote: On 4/27/20 10:23 AM, Vladimir Sementsov-Ogievskiy wrote: The function is called from 64bit io handlers, and bytes is just passed to throttle_account() which is 64bit too (unsigned though). So, let's convert intermediate argument to 64bit too. W

Re: [PATCH v3 1/3] block: Add blk_new_with_bs() helper

2020-04-27 Thread Eric Blake
On 4/27/20 5:00 AM, Max Reitz wrote: On 24.04.20 21:09, Eric Blake wrote: There are several callers that need to create a new block backend from an existing BDS; make the task slightly easier with a common helper routine. Suggested-by: Max Reitz Signed-off-by: Eric Blake --- +++ b/block/cr

Re: [PATCH v20 4/4] iotests: 287: add qcow2 compression type test

2020-04-27 Thread Max Reitz
On 21.04.20 10:11, Denis Plotnikov wrote: > The test checks fulfilling qcow2 requirements for the compression > type feature and zstd compression type operability. > > Signed-off-by: Denis Plotnikov > --- > tests/qemu-iotests/287 | 146 + > tests/qemu-iote

Re: [PATCH v4 23/30] qcow2: Update L2 bitmap in qcow2_alloc_cluster_link_l2()

2020-04-27 Thread Alberto Garcia
On Fri 24 Apr 2020 09:39:25 PM CEST, Eric Blake wrote: >> +/* Update bitmap with the subclusters that were just written */ >> +if (has_subclusters(s)) { >> +unsigned written_from = m->cow_start.offset; >> +unsigned written_to = m->cow_end.offset + m->cow_end.

Re: [PATCH v20 2/4] qcow2: rework the cluster compression routine

2020-04-27 Thread Max Reitz
On 21.04.20 10:11, Denis Plotnikov wrote: > The patch enables processing the image compression type defined > for the image and chooses an appropriate method for image clusters > (de)compression. > > Signed-off-by: Denis Plotnikov > Reviewed-by: Vladimir Sementsov-Ogievskiy > Reviewed-by: Albert

Re: [PATCH v20 3/4] qcow2: add zstd cluster compression

2020-04-27 Thread Max Reitz
On 21.04.20 10:11, Denis Plotnikov wrote: > zstd significantly reduces cluster compression time. > It provides better compression performance maintaining > the same level of the compression ratio in comparison with > zlib, which, at the moment, is the only compression > method available. > > The p

Re: [PATCH v20 1/4] qcow2: introduce compression type feature

2020-04-27 Thread Max Reitz
On 21.04.20 10:11, Denis Plotnikov wrote: > The patch adds some preparation parts for incompatible compression type > feature to qcow2 allowing the use different compression methods for > image clusters (de)compressing. > > It is implied that the compression type is set on the image creation and >

Re: [PATCH v4 26/30] qcow2: Restrict qcow2_co_pwrite_zeroes() to full clusters only

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
17.03.2020 21:16, Alberto Garcia wrote: Ideally it should be possible to zero individual subclusters using this function, but this is currently not implemented. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy -- Best regards, Vladimir

Re: [PATCH v4 25/30] qcow2: Add subcluster support to handle_alloc_space()

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
17.03.2020 21:16, Alberto Garcia wrote: The bdrv_co_pwrite_zeroes() call here fills complete clusters with zeroes, but it can happen that some subclusters are not part of the write request or the copy-on-write. This patch makes sure that only the affected subclusters are overwritten. A potential

Re: [PATCH v2 02/17] block: use int64_t as bytes type in tracked requests

2020-04-27 Thread Philippe Mathieu-Daudé
On 4/27/20 1:26 PM, Vladimir Sementsov-Ogievskiy wrote: 27.04.2020 13:11, Philippe Mathieu-Daudé wrote: On 4/27/20 10:23 AM, Vladimir Sementsov-Ogievskiy wrote: We are generally moving to int64_t for both offset and bytes parameters on all io paths. Convert tracked requests now. This doesn't

Re: [PATCH v2 02/17] block: use int64_t as bytes type in tracked requests

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
27.04.2020 13:11, Philippe Mathieu-Daudé wrote: On 4/27/20 10:23 AM, Vladimir Sementsov-Ogievskiy wrote: We are generally moving to int64_t for both offset and bytes parameters on all io paths. Convert tracked requests now. This doesn't seem a strong justification... If I understand correctly

Re: [PATCH v2 02/17] block: use int64_t as bytes type in tracked requests

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
27.04.2020 11:23, Vladimir Sementsov-Ogievskiy wrote: We are generally moving to int64_t for both offset and bytes parameters on all io paths. Convert tracked requests now. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- include/block/block_int.h | 4 ++-- bloc

Re: [PATCH v2 02/17] block: use int64_t as bytes type in tracked requests

2020-04-27 Thread Philippe Mathieu-Daudé
On 4/27/20 10:23 AM, Vladimir Sementsov-Ogievskiy wrote: We are generally moving to int64_t for both offset and bytes parameters on all io paths. Convert tracked requests now. This doesn't seem a strong justification... If I understand correctly this patch, it is safer to use positive signed t

Re: [PATCH v2 00/17] 64bit block-layer

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

Re: [PATCH v2 01/17] block/throttle-groups: throttle_group_co_io_limits_intercept(): 64bit bytes

2020-04-27 Thread Philippe Mathieu-Daudé
On 4/27/20 10:23 AM, Vladimir Sementsov-Ogievskiy wrote: The function is called from 64bit io handlers, and bytes is just passed to throttle_account() which is 64bit too (unsigned though). So, let's convert intermediate argument to 64bit too. What is the meaning of negative bytes in this functi

Re: [PATCH v2 00/17] 64bit block-layer

2020-04-27 Thread no-reply
Patchew URL: https://patchew.org/QEMU/20200427082325.10414-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 BEG

Re: [PATCH v3 1/3] block: Add blk_new_with_bs() helper

2020-04-27 Thread Max Reitz
On 24.04.20 21:09, Eric Blake wrote: > There are several callers that need to create a new block backend from > an existing BDS; make the task slightly easier with a common helper > routine. > > Suggested-by: Max Reitz > Signed-off-by: Eric Blake > --- > include/sysemu/block-backend.h | 2 ++ >

Re: [RFC PATCH v1 3/7] char-socket: initialize reconnect timer only if close is emitted

2020-04-27 Thread Dima Stepanov
On Sun, Apr 26, 2020 at 03:26:58PM +0800, Li Feng wrote: > This patch is trying to fix the same issue with me. > However, our fix is different. > > I think that check the s->reconnect_timer is better. I also thought about your solution: - if (s->reconnect_time) { + if (s->reconnect_time && !s

Re: [PATCH v2 00/17] 64bit block-layer

2020-04-27 Thread no-reply
Patchew URL: https://patchew.org/QEMU/20200427082325.10414-1-vsement...@virtuozzo.com/ Hi, This series failed the asan build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally. === TEST SCRIPT BEGIN === #!/bin/bas

[PATCH v2 17/17] block: use int64_t instead of int in driver discard handlers

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
We are generally moving to int64_t for both offset and bytes parameters on all io paths. Convert driver discard handlers bytes parameter to int64_t. This patch just converts handlers where it is obvious that bytes parameter is passed further to 64bit interfaces, and add simple wrappers where it is

[PATCH v2 11/17] block/io: use int64_t bytes in copy_range

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
We are generally moving to int64_t for both offset and bytes parameters on all io paths. Convert copy_range parameters which are already 64bit to signed type. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block.h | 6 +++--- include/block/block_int.h | 12 ++-- block

[PATCH v2 13/17] block: use int64_t instead of uint64_t in driver read handlers

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
We are generally moving to int64_t for both offset and bytes parameters on all io paths. Convert driver read handlers parameters which are already 64bit to signed type. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 6 +++--- block/backup-top.c| 2 +- block

[PATCH v2 14/17] block: use int64_t instead of uint64_t in driver write handlers

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
We are generally moving to int64_t for both offset and bytes parameters on all io paths. Convert driver write handlers parameters which are already 64bit to signed type. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 10 +- block/backup-top.c| 3 +--

[PATCH v2 15/17] block: use int64_t instead of uint64_t in copy_range driver handlers

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
We are generally moving to int64_t for both offset and bytes parameters on all io paths. Convert driver copy_range handlers parameters which are already 64bit to signed type. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 12 ++-- block/file-posix.c|

[PATCH v2 12/17] block/block-backend: convert blk io path to use int64_t parameters

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
We are generally moving to int64_t for both offset and bytes parameters on all io paths. Now bdrv layer is converted, convert blk layer too. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/sysemu/block-backend.h | 26 +++ block/block-backend.c | 60 ++

[PATCH v2 10/17] block/io: support int64_t bytes in read/write wrappers

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
Now, when bdrv_co_preadv_part() and bdrv_co_pwritev_part() updated, update all their wrappers. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block.h | 10 +- include/block/block_int.h | 4 ++-- block/blkverify.c | 2 +- block/io.c| 17 +++

[PATCH v2 09/17] block/io: support int64_t bytes in bdrv_co_p{read, write}v_part()

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
We are generally moving to int64_t for both offset and bytes parameters on all io paths. Prepare bdrv_co_preadv_part() and bdrv_co_pwritev_part() and their remaining dependencies now. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 4 ++-- block/io.c|

[PATCH v2 16/17] block: use int64_t instead of int in driver write_zeroes handlers

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
We are generally moving to int64_t for both offset and bytes parameters on all io paths. Convert driver write_zeroes handlers bytes parameter to int64_t. This patch just converts handlers where it is obvious that bytes parameter is passed further to 64bit interfaces, and add simple wrappers where

[PATCH v2 08/17] block/io: support int64_t bytes in bdrv_aligned_preadv()

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
We are generally moving to int64_t for both offset and bytes parameters on all io paths. Prepare bdrv_aligned_preadv() now. Make byte variable in bdrv_padding_rmw_read() int64_t, as it defined only to be passed to bdrv_aligned_preadv(). Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/io.c

[PATCH v2 07/17] block/io: support int64_t bytes in bdrv_co_do_copy_on_readv()

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
We are generally moving to int64_t for both offset and bytes parameters on all io paths. Prepare bdrv_co_do_copy_on_readv() now. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/io.c | 6 +++--- block/trace-events | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git

[PATCH v2 03/17] block/io: use int64_t bytes parameter in bdrv_check_byte_request()

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
We are generally moving to int64_t for both offset and bytes parameters on all io paths. Convert bdrv_check_byte_request() now. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/io.c b/block/io.c index 7cbb8

[PATCH v2 05/17] block/io: support int64_t bytes in bdrv_co_do_pwrite_zeroes()

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
We are generally moving to int64_t for both offset and bytes parameters on all io paths. Prepare bdrv_co_do_pwrite_zeroes() now. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/io.c b/block/io.c index 4796

[PATCH v2 06/17] block/io: support int64_t bytes in bdrv_aligned_pwritev()

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
We are generally moving to int64_t for both offset and bytes parameters on all io paths. Prepare bdrv_aligned_pwritev() now (and convert the dependencies: bdrv_co_write_req_prepare() and bdrv_co_write_req_finish() to signed type bytes) Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/io.c |

[PATCH v2 04/17] block/io: use int64_t bytes in driver wrappers

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
We are generally moving to int64_t for both offset and bytes parameters on all io paths. Convert driver wrappers parameters which are already 64bit to signed type. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/io.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git

[PATCH v2 00/17] 64bit block-layer

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
Hi all! v1 was "[RFC 0/3] 64bit block-layer part I", please refer to initial cover-letter https://lists.gnu.org/archive/html/qemu-devel/2020-03/msg08723.html for motivation. v2: patch 02 is unchanged, add Stefan's r-b. Everything other is changed a lot. What's new: - conversion of block/io.c i

[PATCH v2 01/17] block/throttle-groups: throttle_group_co_io_limits_intercept(): 64bit bytes

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
The function is called from 64bit io handlers, and bytes is just passed to throttle_account() which is 64bit too (unsigned though). So, let's convert intermediate argument to 64bit too. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/throttle-groups.h | 2 +- block/throttle-groups.

[PATCH v2 02/17] block: use int64_t as bytes type in tracked requests

2020-04-27 Thread Vladimir Sementsov-Ogievskiy
We are generally moving to int64_t for both offset and bytes parameters on all io paths. Convert tracked requests now. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- include/block/block_int.h | 4 ++-- block/io.c| 11 ++- 2 files changed, 8

Re: [PATCH v4 24/30] qcow2: Clear the L2 bitmap when allocating a compressed cluster

2020-04-27 Thread Max Reitz
On 24.04.20 20:47, Eric Blake wrote: > On 4/24/20 1:37 PM, Alberto Garcia wrote: >> On Fri 24 Apr 2020 08:25:45 PM CEST, Vladimir Sementsov-Ogievskiy >> wrote: > Reading the entire cluster will be interesting - you'll have to > decompress the entire memory, then overwrite the zeroed portio