[PATCH 2/2] block: add missed block_acct_setup with new block device init procedure

2022-08-24 Thread Denis V. Lunev
. There are the following constraints: * new default value in block_acct_init() is set to true * block_acct_setup() inside blockdev_init() is called before blkconf_apply_backend_options() * thus newly created option in block device properties has precedence if specified Signed-off-by: Denis V. Lunev

[PATCH v5 0/2] block: add missed block_acct_setup with new block device init procedure

2022-08-24 Thread Denis V. Lunev
patch 2 Changes from v1: * set account_invalid/account_failed to true by default * pass OnOffAuto to block_acct_init() to handle double initialization (patch 1) * changed properties on BLK device to OnOffAuto Signed-off-by: Denis V. Lunev CC: Peter Krempa CC: Markus Armbruster CC: John Snow CC

Re: [PATCH v5 1/9] parallels: Out of image offset in BAT leads to image inflation

2022-08-23 Thread Denis V. Lunev
On 23.08.2022 11:58, Vladimir Sementsov-Ogievskiy wrote: On 8/23/22 12:20, Denis V. Lunev wrote: On 23.08.2022 09:23, Alexander Ivanov wrote: On 23.08.2022 08:58, Vladimir Sementsov-Ogievskiy wrote: On 8/22/22 12:05, Alexander Ivanov wrote: data_end field in BDRVParallelsState is set

Re: [PATCH v5 1/9] parallels: Out of image offset in BAT leads to image inflation

2022-08-23 Thread Denis V. Lunev
On 23.08.2022 11:47, Vladimir Sementsov-Ogievskiy wrote: On 8/23/22 12:34, Denis V. Lunev wrote: On 23.08.2022 08:58, Vladimir Sementsov-Ogievskiy wrote: On 8/22/22 12:05, Alexander Ivanov wrote: data_end field in BDRVParallelsState is set to the biggest offset present in BAT. If this offset

[PATCH 1/2] block: pass OnOffAuto instead of bool to block_acct_setup()

2022-08-23 Thread Denis V. Lunev
We would have one more place for block_acct_setup() calling, which should not corrupt original value. Signed-off-by: Denis V. Lunev CC: Peter Krempa CC: Markus Armbruster CC: John Snow CC: Kevin Wolf CC: Hanna Reitz CC: Vladimir Sementsov-Ogievskiy --- block/accounting.c | 22

[PATCH 2/2] block: add missed block_acct_setup with new block device init procedure

2022-08-23 Thread Denis V. Lunev
. There are the following constraints: * new default value in block_acct_init() is set to true * block_acct_setup() inside blockdev_init() is called before blkconf_apply_backend_options() * thus newly created option in block device properties has precedence if specified Signed-off-by: Denis V. Lunev CC

[PATCH v4 0/2] block: add missed block_acct_setup with new block device init procedure

2022-08-23 Thread Denis V. Lunev
to block_acct_init() to handle double initialization (patch 1) * changed properties on BLK device to OnOffAuto Signed-off-by: Denis V. Lunev CC: Peter Krempa CC: Markus Armbruster CC: John Snow CC: Kevin Wolf CC: Hanna Reitz CC: Vladimir Sementsov-Ogievskiy

Re: [PATCH 1/1] MAINTAINERS: add tree to keep parallels format driver changes

2022-08-23 Thread Denis V. Lunev
On 23.08.2022 11:42, Vladimir Sementsov-Ogievskiy wrote: On 8/23/22 11:40, Denis V. Lunev wrote: Parallels driver changes are driving by me for now. At least we need to get functionally complete check and repair procedure for now. This would be a good educational task for new people from

Re: [PATCH v5 1/9] parallels: Out of image offset in BAT leads to image inflation

2022-08-23 Thread Denis V. Lunev
fail; +} + if (le32_to_cpu(ph.inuse) == HEADER_INUSE_MAGIC) { /* Image was not closed correctly. The check is mandatory */ s->header_unclean = true; Reviewed-by: Denis V. Lunev

Re: [PATCH v5 7/9] parallels: Move check of leaks to a separate function

2022-08-23 Thread Denis V. Lunev
On 22.08.2022 11:05, Alexander Ivanov wrote: We will add more and more checks so we need a better code structure in parallels_co_check. Let each check performs in a separate loop in a separate helper. Signed-off-by: Alexander Ivanov --- block/parallels.c | 87

Re: [PATCH v5 4/9] parallels: Use generic infrastructure for BAT writing in parallels_co_check()

2022-08-23 Thread Denis V. Lunev
check(BlockDriverState *bs, s->data_end = size >> BDRV_SECTOR_BITS; out: qemu_co_mutex_unlock(>lock); + +if (ret == 0) { +ret = bdrv_co_flush(bs); +if (ret < 0) { +res->check_errors++; + } +} + return ret; } Reviewed-by: Denis V. Lunev

Re: [PATCH v5 1/9] parallels: Out of image offset in BAT leads to image inflation

2022-08-23 Thread Denis V. Lunev
On 23.08.2022 08:58, Vladimir Sementsov-Ogievskiy wrote: On 8/22/22 12:05, Alexander Ivanov wrote: data_end field in BDRVParallelsState is set to the biggest offset present in BAT. If this offset is outside of the image, any further write will create the cluster at this offset and/or the

Re: [PATCH v5 2/9] parallels: Fix data_end field value in parallels_co_check()

2022-08-23 Thread Denis V. Lunev
On 22.08.2022 11:05, Alexander Ivanov wrote: Make data_end pointing to the end of the last cluster if a leak was fixed. Otherwise set the file size to data_end. Signed-off-by: Alexander Ivanov --- block/parallels.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git

Re: [PATCH v5 1/9] parallels: Out of image offset in BAT leads to image inflation

2022-08-23 Thread Denis V. Lunev
On 23.08.2022 09:23, Alexander Ivanov wrote: On 23.08.2022 08:58, Vladimir Sementsov-Ogievskiy wrote: On 8/22/22 12:05, Alexander Ivanov wrote: data_end field in BDRVParallelsState is set to the biggest offset present in BAT. If this offset is outside of the image, any further write will

[PATCH 1/1] MAINTAINERS: add tree to keep parallels format driver changes

2022-08-23 Thread Denis V. Lunev
Parallels driver changes are driving by me for now. At least we need to get functionally complete check and repair procedure for now. This would be a good educational task for new people from Virtuozzo. Signed-off-by: Denis V. Lunev CC: Vladimir Sementsov-Ogievskiy CC: Stefan Hajnoczi

Re: [PATCH v3 0/2] block: add missed block_acct_setup with new block device init procedure

2022-08-22 Thread Denis V. Lunev
On 22.08.2022 12:31, Denis V. Lunev wrote: Commit 5f76a7aac156ca75680dad5df4a385fd0b58f6b1 is looking harmless from the first glance, but it has changed things a lot. 'libvirt' uses it to detect that it should follow new initialization way and this changes things considerably

[PATCH 1/2] target/hppa: Fix proberi instruction emulation for linux-user

2022-08-22 Thread Denis V. Lunev
From: Helge Deller The proberi assembler instruction checks the read/write access rights for the page of a given address and shall return a value of 1 if the test succeeds and a value of 0 on failure in the target register. But when run in linux-user mode, qemu currently simply returns the

[PATCH 2/2] block: pass OnOffAuto instead of bool to block_acct_setup()

2022-08-22 Thread Denis V. Lunev
We would have one more place for block_acct_setup() calling, which should not corrupt original value. Signed-off-by: Denis V. Lunev CC: Peter Krempa CC: Markus Armbruster CC: John Snow CC: Kevin Wolf CC: Hanna Reitz CC: Vladimir Sementsov-Ogievskiy --- block/accounting.c | 26

[PATCH v3 0/2] block: add missed block_acct_setup with new block device init procedure

2022-08-22 Thread Denis V. Lunev
Signed-off-by: Denis V. Lunev CC: Peter Krempa CC: Markus Armbruster CC: John Snow CC: Kevin Wolf CC: Hanna Reitz CC: Vladimir Sementsov-Ogievskiy

Re: [PATCH 2/9] parallels: Fix data_end field value in parallels_co_check()

2022-08-19 Thread Denis V. Lunev
On 18.08.2022 17:14, Alexander Ivanov wrote: When an image is opened for check there is no error if an offset in the BAT points outside the image. In such a way we can repair the image. Out-of-image offsets are repaired in the check, but data_end field still points outside. Fix this field by

Re: [PATCH 6/9] parallels: Move check of cluster outside image to a separate function

2022-08-19 Thread Denis V. Lunev
On 18.08.2022 17:14, Alexander Ivanov wrote: We will add more and more checks so we need a better code structure in parallels_co_check. Let each check performs in a separate loop in a separate helper. s->data_end fix relates to out-of-image check so move it to the helper too. Signed-off-by:

Re: [PATCH 9/9] parallels: Replace qemu_co_mutex_lock by WITH_QEMU_LOCK_GUARD

2022-08-19 Thread Denis V. Lunev
On 18.08.2022 17:14, Alexander Ivanov wrote: Replace the way we use mutex in parallels_co_check() for simplier and less error prone code. Signed-off-by: Alexander Ivanov --- block/parallels.c | 26 -- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git

Re: [PATCH 0/9] parallels: Refactor the code of images checks and fix a bug

2022-08-19 Thread Denis V. Lunev
On 18.08.2022 17:14, Alexander Ivanov wrote: Fix image inflation when offset in BAT is out of image. Replace whole BAT syncing by flushing only dirty blocks. Move all the checks outside the main check function in separate functions Use WITH_QEMU_LOCK_GUARD for simplier code. v4 changes:

Re: [PATCH v3 3/8] parallels: Use generic infrastructure for BAT writing in parallels_co_check()

2022-08-17 Thread Denis V. Lunev
On 17.08.2022 21:48, Vladimir Sementsov-Ogievskiy wrote: On 8/15/22 12:02, Alexander Ivanov wrote: BAT is written in the context of conventional operations over the image inside bdrv_co_flush() when it calls parallels_co_flush_to_os() callback. Thus we should not modify BAT array directly, but

Re: [PATCH v3 1/8] parallels: Out of image offset in BAT leads to image inflation

2022-08-17 Thread Denis V. Lunev
On 17.08.2022 21:43, Vladimir Sementsov-Ogievskiy wrote: On 8/17/22 22:27, Denis V. Lunev wrote: On 17.08.2022 21:13, Vladimir Sementsov-Ogievskiy wrote: On 8/15/22 12:02, Alexander Ivanov wrote: data_end field in BDRVParallelsState is set to the biggest offset present in BAT. If this offset

Re: [PATCH v3 1/8] parallels: Out of image offset in BAT leads to image inflation

2022-08-17 Thread Denis V. Lunev
On 17.08.2022 21:13, Vladimir Sementsov-Ogievskiy wrote: On 8/15/22 12:02, Alexander Ivanov wrote: data_end field in BDRVParallelsState is set to the biggest offset present in BAT. If this offset is outside of the image, any further write will create the cluster at this offset and/or the

[PATCH 2/2] block: add missed block_acct_setup with new block device init procedure

2022-08-17 Thread Denis V. Lunev
. There are the following constraints: * new default value in block_acct_init() is set to true * block_acct_setup() inside blockdev_init() is called before blkconf_apply_backend_options() * thus newly created option in block device properties has precedence if specified Signed-off-by: Denis V. Lunev CC

[PATCH 1/2] block: pass OnOffAuto instead of bool to block_acct_setup()

2022-08-17 Thread Denis V. Lunev
We would have one more place for block_acct_setup() calling, which should not corrupt original value. Signed-off-by: Denis V. Lunev CC: Peter Krempa CC: Markus Armbruster CC: John Snow CC: Kevin Wolf CC: Hanna Reitz CC: Vladimir Sementsov-Ogievskiy --- block/accounting.c | 24

[PATCH v2] block: add missed block_acct_setup with new block device init procedure

2022-08-17 Thread Denis V. Lunev
account_invalid/account_failed to true by default * pass OnOffAuto to block_acct_init() to handle double initialization (patch 1) * changed properties on BLK device to OnOffAuto Signed-off-by: Denis V. Lunev CC: Peter Krempa CC: Markus Armbruster CC: John Snow CC: Kevin Wolf CC: Hanna Reitz CC: Vladimir

[PATCH 1/2] block: use bdrv_is_sg() helper instead of raw bs->sg reading

2022-08-17 Thread Denis V. Lunev
I believe that if the helper exists, it must be used always for reading of the value. It breaks expectations in the other case. Signed-off-by: Denis V. Lunev CC: Kevin Wolf CC: Hanna Reitz CC: Stefan Hajnoczi CC: Fam Zheng CC: Ronnie Sahlberg CC: Paolo Bonzini CC: Peter Lieven CC

[PATCH 2/2] block: make serializing requests functions 'void'

2022-08-17 Thread Denis V. Lunev
Return codes of the following functions are never used in the code: * bdrv_wait_serialising_requests_locked * bdrv_wait_serialising_requests * bdrv_make_request_serialising Signed-off-by: Denis V. Lunev CC: Kevin Wolf CC: Hanna Reitz CC: Stefan Hajnoczi CC: Fam Zheng CC: Ronnie Sahlberg CC

[PATCH for 7.2] minor fixups in block code

2022-08-17 Thread Denis V. Lunev
These 2 patches are just minor improvements to make code a bit better. Signed-off-by: Denis V. Lunev CC: Kevin Wolf CC: Hanna Reitz CC: Stefan Hajnoczi CC: Fam Zheng CC: Ronnie Sahlberg CC: Paolo Bonzini CC: Peter Lieven CC: Vladimir Sementsov-Ogievskiy

Re: [PATCH v3 0/8] parallels: Refactor the code of images checks and fix a bug

2022-08-16 Thread Denis V. Lunev
-- 1 file changed, 132 insertions(+), 56 deletions(-) Reviewed-by: Denis V. Lunev I am happy with this code now. Stefan, Vova, can we take this to block-next via one of your trees? Den

Re: [PATCH v2 0/8] parallels: Refactor the code of images checks and fix a bug

2022-08-12 Thread Denis V. Lunev
On 11.08.2022 17:00, Alexander Ivanov wrote: Fix image inflation when offset in BAT is out of image. Replace whole BAT syncing by flushing only dirty blocks. Move all the checks outside the main check function in separate functions Use WITH_QEMU_LOCK_GUARD for more clean code. Alexander

Re: [PATCH v2 8/8] parallels: Replace qemu_co_mutex_lock by WITH_QEMU_LOCK_GUARD

2022-08-12 Thread Denis V. Lunev
On 11.08.2022 17:00, Alexander Ivanov wrote: Replace the way we use mutex in parallels_co_check() for more clean code. I think that "cleaness" is the same, but new code would be just shorter ;) or less error prone. v2: Fix an incorrect usage of WITH_QEMU_LOCK_GUARD. Signed-off-by: Alexander

Re: [PATCH v2 7/8] parallels: Move statistic collection to a separate function

2022-08-12 Thread Denis V. Lunev
On 11.08.2022 17:00, Alexander Ivanov wrote: v2: Move fragmentation counting code to this function too. same note here about ChnageLog and motivation Signed-off-by: Alexander Ivanov --- block/parallels.c | 54 +++ 1 file changed, 31

Re: [PATCH v2 6/8] parallels: Move check of leaks to a separate function

2022-08-12 Thread Denis V. Lunev
On 11.08.2022 17:00, Alexander Ivanov wrote: v2: No changes. same notes about motivation, changelog as before Signed-off-by: Alexander Ivanov --- block/parallels.c | 85 +-- 1 file changed, 52 insertions(+), 33 deletions(-) diff --git

Re: [PATCH v2 5/8] parallels: Move check of cluster outside image to a separate function

2022-08-12 Thread Denis V. Lunev
On 11.08.2022 17:00, Alexander Ivanov wrote: v2: Move unrelated helper parallels_set_bat_entry creation to a separate patch. same notes as for previous patch Signed-off-by: Alexander Ivanov --- block/parallels.c | 48 ++- 1 file changed,

Re: [PATCH v2 4/8] parallels: Move check of unclean image to a separate function

2022-08-12 Thread Denis V. Lunev
On 11.08.2022 17:00, Alexander Ivanov wrote: v2: Revert the condition with s->header_unclean. same comment about change log as previously And commit message misses motivation part, why we are doing this rework. What is the goal of this change? The code part is clean. Signed-off-by:

Re: [PATCH v2 3/8] parallels: Replace bdrv_co_pwrite_sync by bdrv_co_flush for BAT flushing

2022-08-12 Thread Denis V. Lunev
-by: Denis V. Lunev Signed-off-by: Alexander Ivanov --- block/parallels.c | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 7f68f3cbc9..6879ea4597 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -42

Re: [PATCH v2 2/8] parallels: Move BAT entry setting to a separate function

2022-08-12 Thread Denis V. Lunev
h - a part of a splitted patch. Same note about version tracking With above taken into account: Reviewed-by: Denis V. Lunev Signed-off-by: Alexander Ivanov --- block/parallels.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/block/parallels.c b/block/paralle

Re: [PATCH v2 1/8] parallels: Out of image offset in BAT leads to image inflation

2022-08-12 Thread Denis V. Lunev
itely not correct and should be fixed." With this change: Reviewed-by: Denis V. Lunev Signed-off-by: Alexander Ivanov --- block/parallels.c | 17 + 1 file changed, 17 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index a229c06f25..a76cf9d993 100644 -

Re: [PATCH 7/9] parallels: Out of image offset in BAT leads to image inflation

2022-08-08 Thread Denis V. Lunev
On 08.08.2022 14:07, Alexander Ivanov wrote: When an image is opened, data_end field in BDRVParallelsState is setted as the biggest offset in the BAT plus cluster size. If there is a corrupted offset pointing outside the image, the image size increase accordingly. It potentially leads to

Re: [PATCH 1/9] parallels: Move check of unclean image to a separate function

2022-08-08 Thread Denis V. Lunev
On 08.08.2022 14:07, Alexander Ivanov wrote: Signed-off-by: Alexander Ivanov --- block/parallels.c | 29 +++-- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index a229c06f25..108aa907b8 100644 ---

Re: [PATCH 8/9] parallels: Replace bdrv_co_pwrite_sync by bdrv_co_flush for BAT flushing

2022-08-08 Thread Denis V. Lunev
On 08.08.2022 14:07, Alexander Ivanov wrote: It's too costly to write all the BAT to the disk. Let the flush function write only dirty blocks. Signed-off-by: Alexander Ivanov --- block/parallels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/parallels.c

Re: [PATCH 2/9] parallels: Move check of cluster outside image to a separate function

2022-08-08 Thread Denis V. Lunev
On 08.08.2022 14:19, Denis V. Lunev wrote: On 08.08.2022 14:07, Alexander Ivanov wrote: Signed-off-by: Alexander Ivanov ---   block/parallels.c | 76 +--   1 file changed, 53 insertions(+), 23 deletions(-) diff --git a/block/parallels.c b/block

Re: [PATCH 5/9] parallels: Move statistic collection to a separate function

2022-08-08 Thread Denis V. Lunev
On 08.08.2022 14:07, Alexander Ivanov wrote: Signed-off-by: Alexander Ivanov --- block/parallels.c | 25 ++--- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 0edbb812dd..b0982d60d0 100644 --- a/block/parallels.c

Re: [PATCH 9/9] parallels: Merge parallels_check_fragmentation to parallels_collect_statistics

2022-08-08 Thread Denis V. Lunev
On 08.08.2022 14:07, Alexander Ivanov wrote: Frgamentation is a part of statistics so it is better to count the statistics in one function. Signed-off-by: Alexander Ivanov --- block/parallels.c | 31 --- 1 file changed, 8 insertions(+), 23 deletions(-) diff

Re: [PATCH 2/9] parallels: Move check of cluster outside image to a separate function

2022-08-08 Thread Denis V. Lunev
On 08.08.2022 14:07, Alexander Ivanov wrote: Signed-off-by: Alexander Ivanov --- block/parallels.c | 76 +-- 1 file changed, 53 insertions(+), 23 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 108aa907b8..7b400ecdcc 100644

Re: [PATCH v2 2/3] parallels: Add checking and repairing duplicate offsets in BAT

2022-08-06 Thread Denis V. Lunev
On 06.08.2022 22:45, Vladimir Sementsov-Ogievskiy wrote: On 8/5/22 18:47, alexander.iva...@virtuozzo.com wrote: From: Alexander Ivanov There could be corruptions in the image file: two guest memory areas refer to the same host cluster. Is that written in parallels spec

Re: [PATCH 0/3] Check and repair duplicated clusters in parallels images

2022-08-04 Thread Denis V. Lunev
On 04.08.2022 17:01, Denis V. Lunev wrote: On 04.08.2022 16:51, alexander.iva...@virtuozzo.com wrote: From: Alexander Ivanov Parallels image file can be corrupted this way: two guest memory areas refer to the same host memory area (duplicated offsets in BAT). qemu-img check copies data from

Re: [PATCH 3/3] iotests, parallels: Add a test for duplicated clusters

2022-08-04 Thread Denis V. Lunev
On 04.08.2022 16:52, alexander.iva...@virtuozzo.com wrote: From: Alexander Ivanov Check if original and duplicated offsets refer to the same cluster. Repair the image and check that writing to a referred cluster doesn't affects another referred cluster. Signed-off-by: Natalia Kuzmina

Re: [PATCH 2/3] parallels: Let duplicates repairing pass without unwanted messages

2022-08-04 Thread Denis V. Lunev
On 04.08.2022 16:51, alexander.iva...@virtuozzo.com wrote: From: Alexander Ivanov When duplicates are repaired a new space area is allocated and further leak check considers it as a leak. Let fix it without printing any messages. Signed-off-by: Alexander Ivanov --- block/parallels.c | 19

Re: [PATCH 1/3] parallels: Add checking and repairing duplicate offsets in BAT

2022-08-04 Thread Denis V. Lunev
On 04.08.2022 16:51, alexander.iva...@virtuozzo.com wrote: From: Alexander Ivanov There could be corruptions in the image file: two quest memory areas refer to the same host cluster. If a duplicate offset is found fix it by copying the content of the referred cluster to a new allocated

Re: [PATCH 0/3] Check and repair duplicated clusters in parallels images

2022-08-04 Thread Denis V. Lunev
all, pls run iris ~/src/qemu $ ./scripts/get_maintainer.pl 0001-parallels-Add-checking-and-repairing-duplicate-offse.patch Stefan Hajnoczi (supporter:parallels) "Denis V. Lunev" (supporter:parallels) Vladimir Sementsov-Ogievskiy (supporter:parallels) Kevin Wolf (supporter:Blo

Re: [PATCH 1/1] block: add missed block_acct_setup with new block device init procedure

2022-07-29 Thread Denis V. Lunev
On 29.07.2022 11:13, Kevin Wolf wrote: Am 28.07.2022 um 21:27 hat Denis V. Lunev geschrieben: On 28.07.2022 16:42, Vladimir Sementsov-Ogievskiy wrote: On 7/11/22 14:07, Denis V. Lunev wrote: Commit 5f76a7aac156ca75680dad5df4a385fd0b58f6b1 is looking harmless from the first glance, but it has

Re: [PATCH 1/1] block: add missed block_acct_setup with new block device init procedure

2022-07-28 Thread Denis V. Lunev
On 28.07.2022 16:42, Vladimir Sementsov-Ogievskiy wrote: On 7/11/22 14:07, Denis V. Lunev wrote: Commit 5f76a7aac156ca75680dad5df4a385fd0b58f6b1 is looking harmless from the first glance, but it has changed things a lot. 'libvirt' uses it to detect that it should follow new initialization way

Re: [RFC patch 0/1] block: vhost-blk backend

2022-07-26 Thread Denis V. Lunev
On 26.07.2022 15:51, Michael S. Tsirkin wrote: On Mon, Jul 25, 2022 at 11:55:26PM +0300, Andrey Zhadchenko wrote: Although QEMU virtio-blk is quite fast, there is still some room for improvements. Disk latency can be reduced if we handle virito-blk requests in host kernel so we avoid a lot of

Re: [PATCH 1/1] block: add missed block_acct_setup with new block device init procedure

2022-07-26 Thread Denis V. Lunev
On 11.07.2022 13:07, Denis V. Lunev wrote: Commit 5f76a7aac156ca75680dad5df4a385fd0b58f6b1 is looking harmless from the first glance, but it has changed things a lot. 'libvirt' uses it to detect that it should follow new initialization way and this changes things considerably

Re: [PATCH 1/1] block: add missed block_acct_setup with new block device init procedure

2022-07-18 Thread Denis V. Lunev
On 11.07.2022 13:07, Denis V. Lunev wrote: Commit 5f76a7aac156ca75680dad5df4a385fd0b58f6b1 is looking harmless from the first glance, but it has changed things a lot. 'libvirt' uses it to detect that it should follow new initialization way and this changes things considerably

Re: [PATCH 2/2] iotests/131: Add parallels regression test

2022-07-18 Thread Denis V. Lunev
X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 65472/65472 bytes at offset 64 +63.938 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 67043328/67043328 bytes at offset 65536 +63.938 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) *** done Reviewed-by: Denis V. Lunev

Re: [PATCH 1/2] block/parallels: Fix buffer-based write call

2022-07-18 Thread Denis V. Lunev
end * BDRV_SECTOR_SIZE, + nb_cow_bytes, buf, 0); qemu_vfree(buf); if (ret < 0) { return ret; Reviewed-by: Denis V. Lunev

[PATCH 1/1] block: add missed block_acct_setup with new block device init procedure

2022-07-11 Thread Denis V. Lunev
account_invalid/account_failed properties to BlockConf and setups them accordingly. Signed-off-by: Denis V. Lunev CC: Peter Krempa CC: Markus Armbruster CC: John Snow CC: Kevin Wolf CC: Hanna Reitz --- hw/block/block.c | 2 + include/hw/block/block.h | 7 +++- tests/qemu-iotests

Re: [PATCH v2 1/1] nbd: trace long NBD operations

2022-06-13 Thread Denis V. Lunev
On 30.05.2022 12:39, Denis V. Lunev wrote: At the moment there are 2 sources of lengthy operations if configured: * open connection, which could retry inside and * reconnect of already opened connection These operations could be quite lengthy and cumbersome to catch thus it would be quite

Re: [PATCH 1/1] block: use 'unsigned' for in_flight field on driver state

2022-06-13 Thread Denis V. Lunev
On 30.05.2022 12:39, Denis V. Lunev wrote: This patch makes in_flight field 'unsigned' for BDRVNBDState and MirrorBlockJob. This matches the definition of this field on BDS and is generically correct - we should never get negative value here. Signed-off-by: Denis V. Lunev CC: John Snow CC

Re: [PATCH 1/1] block: use 'unsigned' for in_flight field on driver state

2022-06-06 Thread Denis V. Lunev
On 30.05.2022 12:39, Denis V. Lunev wrote: This patch makes in_flight field 'unsigned' for BDRVNBDState and MirrorBlockJob. This matches the definition of this field on BDS and is generically correct - we should never get negative value here. Signed-off-by: Denis V. Lunev CC: John Snow CC

Re: [PATCH v2 1/1] nbd: trace long NBD operations

2022-06-06 Thread Denis V. Lunev
On 30.05.2022 12:39, Denis V. Lunev wrote: At the moment there are 2 sources of lengthy operations if configured: * open connection, which could retry inside and * reconnect of already opened connection These operations could be quite lengthy and cumbersome to catch thus it would be quite

[PATCH 1/1] block: use 'unsigned' for in_flight field on driver state

2022-05-30 Thread Denis V. Lunev
This patch makes in_flight field 'unsigned' for BDRVNBDState and MirrorBlockJob. This matches the definition of this field on BDS and is generically correct - we should never get negative value here. Signed-off-by: Denis V. Lunev CC: John Snow CC: Vladimir Sementsov-Ogievskiy CC: Kevin Wolf

[PATCH v2 1/1] nbd: trace long NBD operations

2022-05-30 Thread Denis V. Lunev
is based on the original downstream work made by Vladimir. Signed-off-by: Denis V. Lunev CC: Eric Blake CC: Vladimir Sementsov-Ogievskiy CC: Kevin Wolf CC: Hanna Reitz CC: Paolo Bonzini --- block/nbd.c | 6 +- block/trace-events | 2 ++ nbd/client-connection.c | 2 ++ nbd

Re: [PATCH 1/1] nbd: trace long NBD operations

2022-05-27 Thread Denis V. Lunev
On 27.05.2022 11:36, Vladimir Sementsov-Ogievskiy wrote: On 5/27/22 11:43, Denis V. Lunev wrote: +++ b/nbd/client-connection.c @@ -23,6 +23,7 @@    */     #include "qemu/osdep.h" +#include "trace.h"     #include "block/nbd.h"   @@ -210,6 +211,7 @@ static void *co

Re: [PATCH 1/1] nbd: trace long NBD operations

2022-05-27 Thread Denis V. Lunev
On 27.05.2022 11:33, Vladimir Sementsov-Ogievskiy wrote: On 5/27/22 11:43, Denis V. Lunev wrote: At the moment there are 2 sources of lengthy operations if configured: * open connection, which could retry inside and * reconnect of already opened connection These operations could be quite

[PATCH 1/1] nbd: trace long NBD operations

2022-05-27 Thread Denis V. Lunev
is based on the original downstream work made by Vladimir. Signed-off-by: Denis V. Lunev CC: Eric Blake CC: Vladimir Sementsov-Ogievskiy CC: Kevin Wolf CC: Hanna Reitz CC: Paolo Bonzini --- block/nbd.c | 11 --- block/trace-events | 2 ++ nbd/client-connection.c | 2

Re: [PATCH 1/3] qemu-img check: fixing duplicated clusters for parallels format

2022-04-18 Thread Denis V. Lunev
On 18.04.2022 14:04, Natalia Kuzmina wrote: Let qemu-img check fix corruption in the image file: two guest memory areas refer to the same host memory area (duplicated offsets in BAT). The code below requires big fat comment, what is reversed BAT, why it is needed and how it helps us to detect

Re: [PATCH 3/3] docs: parallels image format supports consistency checks

2022-04-18 Thread Denis V. Lunev
On 18.04.2022 14:04, Natalia Kuzmina wrote: Add parallels to list of formats that support consistency checks by qemu-img check. Signed-off-by: Natalia Kuzmina --- docs/tools/qemu-img.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tools/qemu-img.rst

[PATCH v3 for 7.1 1/1] block: add 'force' parameter to 'blockdev-change-medium' command

2022-04-12 Thread Denis V. Lunev
' by passing flag 'force' inside. Thus is seems reasonable to add the same capability for 'blockdev-change-medium' too. Signed-off-by: Denis V. Lunev Reviewed-by: Vladimir Sementsov-Ogievskiy Acked-by: "Dr. David Alan Gilbert" CC: Kevin Wolf CC: Hanna Reitz CC: Eric Blake CC: Markus

Re: [PATCH v2 for 7.1 1/1] block: add 'force' parameter to 'blockdev-change-medium' command

2022-04-12 Thread Denis V. Lunev
On 12.04.2022 16:17, Vladimir Sementsov-Ogievskiy wrote: 12.04.2022 12:50, Denis V. Lunev wrote: 'blockdev-change-medium' is a convinient wrapper for the following sequence of commands:   * blockdev-open-tray   * blockdev-remove-medium   * blockdev-insert-medium   * blockdev-close-tray

[PATCH v2 for 7.1 1/1] block: add 'force' parameter to 'blockdev-change-medium' command

2022-04-12 Thread Denis V. Lunev
' by passing flag 'force' inside. Thus is seems reasonable to add the same capability for 'blockdev-change-medium' too. Signed-off-by: Denis V. Lunev CC: Kevin Wolf CC: Hanna Reitz CC: "Dr. David Alan Gilbert" CC: Eric Blake CC: Markus Armbruster CC: Vladimir Sementsov-Ogievskiy ---

Re: [PATCH for 7.1 1/1] block: add 'force' parameter to 'blockdev-change-medium' command

2022-04-07 Thread Denis V. Lunev
On 08.04.2022 00:51, 'Vladimir Sementsov-Ogievskiy' via den wrote: 07.04.2022 23:48, Denis V. Lunev wrote: 'blockdev-change-medium' is a convinient wrapper for the following sequence of commands:   * blockdev-open-tray   * blockdev-remove-medium   * blockdev-insert-medium   * blockdev-close

[PATCH for 7.1 1/1] block: add 'force' parameter to 'blockdev-change-medium' command

2022-04-07 Thread Denis V. Lunev
' by passing flag 'force' inside. Thus is seems reasonable to add the same capability for 'blockdev-change-medium' too. Signed-off-by: Denis V. Lunev CC: Kevin Wolf CC: Hanna Reitz CC: "Dr. David Alan Gilbert" CC: Eric Blake CC: Markus Armbruster --- block/qapi-sysemu.c | 3 ++- monitor/

[PATCH 1/1] qemu-img: properly list formats which have consistency check implemented

2022-04-07 Thread Denis V. Lunev
V. Lunev CC: Kevin Wolf CC: Hanna Reitz --- docs/tools/qemu-img.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst index 8885ea11cf..85a6e05b35 100644 --- a/docs/tools/qemu-img.rst +++ b/docs/tools/qemu-img.rst @@ -332,8

Re: [PATCH-for-7.0 1/2] block: Fix misleading hexadecimal format

2022-03-23 Thread Denis V. Lunev
xtension(BlockDriverState *bs, break; default: -error_setg(errp, "Unknown feature: 0x%" PRIu64, fh.magic); +error_setg(errp, "Unknown feature: 0x%" PRIx64, fh.magic); goto fail; } Reviewed-by: Denis V. Lunev

Re: [PATCH] drop libxml2 checks since libxml is not actually used (for parallels)

2022-01-19 Thread Denis V. Lunev
On 1/19/22 12:35 PM, Daniel P. Berrangé wrote: > Copying the maintainers for block/parallels.c > > On Wed, Jan 19, 2022 at 12:04:23PM +0300, Michael Tokarev wrote: >> [This is a trivial patch, but due to the number of files it touches >> I'm not using qemu-trivial@ route.] >> >> For a long time,

Re: [PATCH-for-6.1 v2] block/export/fuse.c: fix musl build

2021-08-09 Thread Denis V. Lunev
, >> offset += size; >> length -= size; >> } while (ret == 0 && length > 0); >> - } else if (!mode) { >> +} >> +#endif /* CONFIG_FALLOCATE_ZERO_RANGE */ >> +else if (!mode) { >> /* We can only fallocate at the EOF with a truncate */ >> if (offset < blk_len) { >> fuse_reply_err(req, EOPNOTSUPP); >> > Reviewed-by: Philippe Mathieu-Daudé > Reviewed-by: Denis V. Lunev

Re: [PATCH v2] docs: document file-posix locking protocol

2021-07-05 Thread Denis V. Lunev
On 7/5/21 10:55 AM, Vladimir Sementsov-Ogievskiy wrote: > 03.07.2021 17:50, Nir Soffer wrote: >> On Sat, Jul 3, 2021 at 4:51 PM Vladimir Sementsov-Ogievskiy >> wrote: >>> >>> Let's document how we use file locks in file-posix driver, to allow >>> external programs to "communicate" in this way

Re: [PATCH v2 3/6] block/parallels: BDRVParallelsState: add cluster_size field

2021-03-04 Thread Denis V. Lunev
b_sectors are used for image size.         This patch implements support of this for qemu-img and also adds specific     check for an incorrect image. Images with block size greater than     INT_MAX/513 are not supported. The biggest available Parallels image     cluster size in the field is 1 Mb.

Re: [PATCH v2 7/6] MAINTAINERS: update parallels block driver

2021-03-04 Thread Denis V. Lunev
ile changed, 2 insertions(+) >> >> diff --git a/MAINTAINERS b/MAINTAINERS >> index 9b2aa18e1f..92ba1fce5e 100644 >> --- a/MAINTAINERS >> +++ b/MAINTAINERS >> @@ -3117,9 +3117,11 @@ F: block/dmg.c >>   parallels >>   M: Stefan Hajnoczi >>  

Re: [PATCH v2 7/6] MAINTAINERS: update parallels block driver

2021-03-04 Thread Denis V. Lunev
ndex 9b2aa18e1f..92ba1fce5e 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -3117,9 +3117,11 @@ F: block/dmg.c > parallels > M: Stefan Hajnoczi > M: Denis V. Lunev > +M: Vladimir Sementsov-Ogievskiy > L: qemu-bl...@nongnu.org > S: Supported > F: block/p

Re: [PATCH v3 2/5] monitor: drain requests queue with 'channel closed' event

2021-03-02 Thread Denis V. Lunev
On 3/2/21 6:25 PM, Vladimir Sementsov-Ogievskiy wrote: > 02.03.2021 16:53, Markus Armbruster wrote: >> Andrey Shinkevich via writes: >> >>> When CHR_EVENT_CLOSED comes, the QMP requests queue may still contain >>> unprocessed commands. It can happen with QMP capability OOB enabled. >>> Let the

Re: [PATCH v2 4/6] parallels: support bitmap extension for read-only mode

2021-02-26 Thread Denis V. Lunev
block_int.h" > #include "block/qdict.h" > @@ -843,6 +844,23 @@ static int parallels_open(BlockDriverState *bs, QDict > *options, int flags, > goto fail_options; > } > > +if (ph.ext_off) { > +if (flags & BDRV_O_RDWR) { > +/* > + * It's unsafe to open image RW if there is an extension (as we > + * don't support it). But parallels driver in QEMU historically > + * ignores the extension, so print warning and don't care. > + */ > +warn_report("Format Extension ignored in RW mode"); > +} else { > +ret = parallels_read_format_extension( > +bs, le64_to_cpu(ph.ext_off) << BDRV_SECTOR_BITS, errp); > +if (ret < 0) { > +goto fail; > +} > +} > +} > + > if ((flags & BDRV_O_RDWR) && !(flags & BDRV_O_INACTIVE)) { > s->header->inuse = cpu_to_le32(HEADER_INUSE_MAGIC); > ret = parallels_update_header(bs); > diff --git a/block/meson.build b/block/meson.build > index eeaefe5809..d21990ec95 100644 > --- a/block/meson.build > +++ b/block/meson.build > @@ -57,7 +57,8 @@ block_ss.add(when: 'CONFIG_QED', if_true: files( >'qed-table.c', >'qed.c', > )) > -block_ss.add(when: [libxml2, 'CONFIG_PARALLELS'], if_true: > files('parallels.c')) > +block_ss.add(when: [libxml2, 'CONFIG_PARALLELS'], > + if_true: files('parallels.c', 'parallels-ext.c')) > block_ss.add(when: 'CONFIG_WIN32', if_true: files('file-win32.c', > 'win32-aio.c')) > block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'), coref, > iokit]) > block_ss.add(when: libiscsi, if_true: files('iscsi-opts.c')) Reviewed-by: Denis V. Lunev

Re: [PATCH v2 6/6] iotests: add parallels-read-bitmap test

2021-02-26 Thread Denis V. Lunev
assert c['start'] % cluster == 0 > +assert c['length'] % cluster == 0 > +if c['data']: > +continue > + > +a = c['start'] // cluster > +b = (c['start'] + c['length']) // cluster > +if b - a > 1: > +log(f'{a}-{b-1}') > +else: > +log(a) > diff --git a/tests/qemu-iotests/tests/parallels-read-bitmap.out > b/tests/qemu-iotests/tests/parallels-read-bitmap.out > new file mode 100644 > index 00..e8f6bc9e96 > --- /dev/null > +++ b/tests/qemu-iotests/tests/parallels-read-bitmap.out > @@ -0,0 +1,6 @@ > +Start NBD server > +dirty clusters (cluster size is 64K): > +5-6 > +10-12 > +30 > +Kill NBD server Reviewed-by: Denis V. Lunev

Re: [PATCH v2 2/6] parallels.txt: fix bitmap L1 table description

2021-02-24 Thread Denis V. Lunev
it contains corresponding cluster offset > +(in 512b sectors). Given an offset in bytes into the bitmap data the offset > in > +bytes into the image file can be obtained as follows: > + > +offset = l1_table[offset / cluster_size] * 512 + (offset % cluster_size) Reviewed-by: Denis V. Lunev

Re: [PATCH v2 5/6] iotests.py: add unarchive_sample_image() helper

2021-02-24 Thread Denis V. Lunev
shutil.copyfileobj(f_in, f_out) > + > > def qemu_tool_pipe_and_status(tool: str, args: Sequence[str], >connect_stderr: bool = True) -> Tuple[str, > int]: Reviewed-by: Denis V. Lunev

Re: [PATCH v2 3/6] block/parallels: BDRVParallelsState: add cluster_size field

2021-02-24 Thread Denis V. Lunev
quot; : "ERROR", > size - res->image_end_offset); > @@ -771,6 +770,7 @@ static int parallels_open(BlockDriverState *bs, QDict > *options, int flags, > ret = -EFBIG; > goto fail; > } > +s->cluster_size = s->tracks << BDRV_SECTOR_BITS; > > s->bat_size = le32_to_cpu(ph.bat_entries); > if (s->bat_size > INT_MAX / sizeof(uint32_t)) { Reviewed-by: Denis V. Lunev

Re: [PATCH 5/5] iotests: add parallels-read-bitmap test

2021-02-19 Thread Denis V. Lunev
On 2/16/21 7:45 PM, Vladimir Sementsov-Ogievskiy wrote: > Test support for reading bitmap from parallels image format. > parallels-with-bitmap.bz2 is generated on Virtuozzo by > parallels-with-bitmap.sh > > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- >

Re: [PATCH 3/5] parallels: support bitmap extension for read-only mode

2021-02-19 Thread Denis V. Lunev
On 2/16/21 7:45 PM, Vladimir Sementsov-Ogievskiy wrote: > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > block/parallels.h | 6 +- > block/parallels-ext.c | 286 ++ > block/parallels.c | 18 +++ > block/meson.build | 3 +- > 4 files

Re: [PATCH 2/5] parallels.txt: fix bitmap L1 table description

2021-02-18 Thread Denis V. Lunev
On 2/16/21 7:45 PM, Vladimir Sementsov-Ogievskiy wrote: > Actually L1 table entry offset is in 512 bytes sectors. Fix the spec. > > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > docs/interop/parallels.txt | 15 +-- > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff

Re: [PATCH 1/5] qcow2-bitmap: make bytes_covered_by_bitmap_cluster() public

2021-02-18 Thread Denis V. Lunev
); > for (i = 0, offset = 0; i < tab_size; ++i, offset += limit) { > uint64_t count = MIN(bm_size - offset, limit); > uint64_t entry = bitmap_table[i]; > @@ -1303,7 +1291,7 @@ static uint64_t *store_bitmap_data(BlockDriverState *bs, > } > > buf = g_malloc(s->cluster_size); > -limit = bytes_covered_by_bitmap_cluster(s, bitmap); > +limit = bdrv_dirty_bitmap_serialization_coverage(s->cluster_size, > bitmap); > assert(DIV_ROUND_UP(bm_size, limit) == tb_size); > > offset = 0; Reviewed-by: Denis V. Lunev

Re: [PATCH 0/7] qcow2: compressed write cache

2021-02-09 Thread Denis V. Lunev
On 2/9/21 9:36 PM, Vladimir Sementsov-Ogievskiy wrote: > 09.02.2021 19:39, Vladimir Sementsov-Ogievskiy wrote: >> 09.02.2021 17:47, Max Reitz wrote: >>> On 09.02.21 15:10, Vladimir Sementsov-Ogievskiy wrote: 09.02.2021 16:25, Max Reitz wrote: > On 29.01.21 17:50, Vladimir

Re: [PATCH 0/7] qcow2: compressed write cache

2021-02-09 Thread Denis V. Lunev
On 2/9/21 5:47 PM, Max Reitz wrote: > On 09.02.21 15:10, Vladimir Sementsov-Ogievskiy wrote: >> 09.02.2021 16:25, Max Reitz wrote: >>> On 29.01.21 17:50, Vladimir Sementsov-Ogievskiy wrote: Hi all! I know, I have several series waiting for a resend, but I had to switch to

Re: [PATCH 1/1] docs: fix mistake in dirty bitmap feature description

2021-02-03 Thread Denis V. Lunev
On 2/3/21 2:08 AM, Eric Blake wrote: > On 2/2/21 4:50 PM, Denis V. Lunev wrote: >> On 2/3/21 1:15 AM, Eric Blake wrote: >>> On 1/28/21 11:21 AM, Vladimir Sementsov-Ogievskiy wrote: >>>> 28.01.2021 20:13, Denis V. Lunev wrote: >>>>> Original specific

<    1   2   3   4   5   6   7   8   9   10   >