[PATCH 1/2] preallocate: do not allow to change BDS permission improperly

2024-10-09 Thread Denis V. Lunev
RW permissions could not be lifted from the preallocation filter if truncate operation has not been finished. In the other case this would mean WRITE operation (image truncate) called after the return from inactivate call. This is definitely a contract violation. Signed-off-by: Denis V. Lunev

[PATCH v2 0/2] block/preallocate: fix image truncation logic

2024-10-09 Thread Denis V. Lunev
: Denis V. Lunev CC: Andrey Drobyshev CC: Vladimir Sementsov-Ogievskiy CC: Kevin Wolf

[PATCH 2/2] block/preallocate: fix image truncation logic

2024-10-09 Thread Denis V. Lunev
ensure that it has been really executed before completion of the section increments the amount of in-flight requests. Signed-off-by: Denis V. Lunev CC: Andrey Drobyshev CC: Vladimir Sementsov-Ogievskiy CC: Kevin Wolf --- block/preallocate.c| 42 ++ tests

Re: [PATCH 2/2] block/preallocate: fix image truncation logic

2024-10-09 Thread Denis V. Lunev
On 10/9/24 16:54, Andrey Drobyshev wrote: On 10/9/24 4:58 PM, Denis V. Lunev wrote: Recent QEMU changes around preallocate_set_perm mandates that it is not possible to poll on aio_context inside this function anymore. Thus truncate operation has been moved inside bottom half. This bottom half

[PATCH 1/2] preallocate: do not allow to change BDS permission improperly

2024-10-09 Thread Denis V. Lunev
RW permissions could not be lifted from the preallocation filter if truncate operation has not been finished. In the other case this would mean WRITE operation (image truncate) called after the return from inactivate call. This is definitely a contract violation. Signed-off-by: Denis V. Lunev CC

[PATCH 0/2] block/preallocate: fix image truncation logic

2024-10-09 Thread Denis V. Lunev
ensure that it has been really executed before completion of the section increments the amount of in-flight requests. In addition to this we should disable lifting WRITE permission when truncate() operation is not fully completed yet. Signed-off-by: Denis V. Lunev CC: Andrey Drobyshev CC: Vladimir

[PATCH 2/2] block/preallocate: fix image truncation logic

2024-10-09 Thread Denis V. Lunev
ensure that it has been really executed before completion of the section increments the amount of in-flight requests. Signed-off-by: Denis V. Lunev CC: Andrey Drobyshev CC: Vladimir Sementsov-Ogievskiy CC: Kevin Wolf --- block/preallocate.c| 38 ++ tests/qemu

[PATCH v2 1/1] system: improve migration debug

2024-09-05 Thread Denis V. Lunev
actually doing this job. Signed-off-by: Denis V. Lunev CC: Peter Xu CC: Fabiano Rosas CC: Paolo Bonzini --- Changes from v1: - adding tracepoint directly to cpu_throttle_set() as suggested by Peter system/cpu-throttle.c | 3 +++ system/trace-events | 3 +++ 2 files changed, 6 insertions(+) diff

Re: [PATCH 1/1] migration: improve migration_throttle tracepoint

2024-09-05 Thread Denis V. Lunev
On 9/5/24 19:52, Peter Xu wrote: On Thu, Sep 05, 2024 at 06:51:46PM +0200, Denis V. Lunev via wrote: Right now this tracepoint is just saying that the guest has been throttled, but this is not that good for debugging purposes. We should also know how much the guest is throttled in order to

[PATCH 1/1] migration: improve migration_throttle tracepoint

2024-09-05 Thread Denis V. Lunev
migration_trigger_throttle() to mig_throttle_guest_down() where this information is really available. This is not a problem as mig_throttle_guest_down() is called in the only one place. Signed-off-by: Denis V. Lunev CC: Peter Xu CC: Fabiano Rosas --- migration/ram.c| 9 ++--- migration/trace-events | 2

Re: [PATCH for-9.1 v4 0/7] CVE-2024-7409

2024-08-22 Thread Denis V. Lunev
On 8/7/24 19:43, Eric Blake wrote: v3 was here: https://lists.gnu.org/archive/html/qemu-devel/2024-08/msg00818.html since then: - re-add a minor patch from v2 (now patch 1) - refactor how the client opaque pointer is handled (patch 2) - add two new patches to prevent malicious clients from

Re: [PATCH 1/1] module: Prevent crash by resetting local_err in module_load_qom_all()

2024-08-09 Thread Denis V. Lunev
error_report_err(local_err); +local_err = NULL; } } module_loaded_qom_all = true; Reviewed-by: Denis V. Lunev

Re: [PATCH v3 1/3] block: zero data data corruption using prealloc-filter

2024-08-05 Thread Denis V. Lunev
On 8/5/24 13:59, Kevin Wolf wrote: Am 18.07.2024 um 21:46 hat Denis V. Lunev geschrieben: On 7/18/24 17:51, Kevin Wolf wrote: Am 16.07.2024 um 16:41 hat Andrey Drobyshev geschrieben: From: "Denis V. Lunev" We have observed that some clusters in the QCOW2 files are zeroed while pre

Re: [PATCH v3 1/3] block: zero data data corruption using prealloc-filter

2024-07-18 Thread Denis V. Lunev
On 7/18/24 17:51, Kevin Wolf wrote: Am 16.07.2024 um 16:41 hat Andrey Drobyshev geschrieben: From: "Denis V. Lunev" We have observed that some clusters in the QCOW2 files are zeroed while preallocation filter is used. We are able to trace down the following sequence when prealloc

Re: [PATCH v3 1/3] block: zero data data corruption using prealloc-filter

2024-07-18 Thread Denis V. Lunev
On 7/18/24 17:51, Kevin Wolf wrote: Am 16.07.2024 um 16:41 hat Andrey Drobyshev geschrieben: From: "Denis V. Lunev" We have observed that some clusters in the QCOW2 files are zeroed while preallocation filter is used. We are able to trace down the following sequence when prealloc

Re: [PATCH v2 1/2] block: zero data data corruption using prealloc-filter

2024-07-16 Thread Denis V. Lunev
On 7/12/24 13:55, Vladimir Sementsov-Ogievskiy wrote: On 12.07.24 12:46, Andrey Drobyshev wrote: From: "Denis V. Lunev" We have observed that some clusters in the QCOW2 files are zeroed while preallocation filter is used. We are able to trace down the following sequence when preal

Re: [PATCH 1/1] prealloc: add truncate mode for prealloc filter

2024-05-29 Thread Denis V. Lunev
On 5/29/24 04:33, Wang, Lei wrote: On 5/1/2024 1:05, Denis V. Lunev via wrote: Preallocate filter allows to implement really interesting setups. Assume that we have * shared block device, f.e. iSCSI LUN, implemented with some HW device * clustered LVM on top of it * QCOW2 image stored inside

Re: [PATCH 1/1] block: drop force_dup parameter of raw_reconfigure_getfd()

2024-05-28 Thread Denis V. Lunev
On 4/30/24 19:02, Denis V. Lunev wrote: This parameter is always passed as 'false' from the caller. Signed-off-by: Denis V. Lunev CC: Andrey Zhadchenko CC: Kevin Wolf CC: Hanna Reitz --- block/file-posix.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --g

Re: [PATCH 1/1] prealloc: add truncate mode for prealloc filter

2024-05-28 Thread Denis V. Lunev
On 4/30/24 19:05, Denis V. Lunev wrote: Preallocate filter allows to implement really interesting setups. Assume that we have * shared block device, f.e. iSCSI LUN, implemented with some HW device * clustered LVM on top of it * QCOW2 image stored inside LVM volume This allows very cheap

Re: [PATCH] qga: Add an interactive mode to guest-exec via VSOCK for Linux

2024-05-23 Thread Denis V. Lunev
On 5/22/24 18:10, Daniel P. Berrangé wrote: On Wed, May 22, 2024 at 05:06:57PM +0200, Alexander Ivanov wrote: Add an interactive mode to the guest-exec command in the QEMU Guest Agent using the VSOCK communication mechanism. It enables interactive sessions with the executed command in the guest,

Re: [PATCH 1/1] block: drop force_dup parameter of raw_reconfigure_getfd()

2024-05-17 Thread Denis V. Lunev
On 4/30/24 19:02, Denis V. Lunev wrote: This parameter is always passed as 'false' from the caller. Signed-off-by: Denis V. Lunev CC: Andrey Zhadchenko CC: Kevin Wolf CC: Hanna Reitz --- block/file-posix.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --g

Re: [PATCH 1/1] prealloc: add truncate mode for prealloc filter

2024-05-17 Thread Denis V. Lunev
On 4/30/24 19:05, Denis V. Lunev wrote: Preallocate filter allows to implement really interesting setups. Assume that we have * shared block device, f.e. iSCSI LUN, implemented with some HW device * clustered LVM on top of it * QCOW2 image stored inside LVM volume This allows very cheap

[PATCH 1/1] prealloc: add truncate mode for prealloc filter

2024-04-30 Thread Denis V. Lunev
is done effectively as resizing is done in chinks. The patch adds allocation mode for this purpose in order to distinguish 'fallocate' for ordinary file system and 'truncate'. Signed-off-by: Denis V. Lunev CC: Alexander Ivanov CC: Kevin Wolf CC: Hanna Reitz CC: Vladimir

[PATCH 1/1] block: drop force_dup parameter of raw_reconfigure_getfd()

2024-04-30 Thread Denis V. Lunev
This parameter is always passed as 'false' from the caller. Signed-off-by: Denis V. Lunev CC: Andrey Zhadchenko CC: Kevin Wolf CC: Hanna Reitz --- block/file-posix.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/block/file-posix.c b/block/file-pos

Re: [PATCH v4 12/21] parallels: Let image extensions work in RW mode

2024-02-28 Thread Denis V. Lunev
On 2/28/24 11:25, Alexander Ivanov wrote: On 1/18/24 14:31, Denis V. Lunev wrote: On 1/16/24 15:45, Denis V. Lunev wrote: On 12/28/23 11:12, Alexander Ivanov wrote: Now we support extensions saving and can let to work with them in read-write mode. Signed-off-by: Alexander Ivanov

Re: [PATCH] iotests/277: Use iotests.sock_dir for socket creation

2024-01-24 Thread Denis V. Lunev
On 1/24/24 18:43, Eric Blake wrote: On Wed, Jan 24, 2024 at 06:22:57PM +0200, Andrey Drobyshev wrote: If socket path is too long (longer than 108 bytes), socket can't be opened. This might lead to failure when test dir path is long enough. Make sure socket is created in iotests.sock_dir to avoi

Re: [PATCH v4 00/21] parallels: Add full dirty bitmap support

2024-01-18 Thread Denis V. Lunev
On 12/28/23 11:12, Alexander Ivanov wrote: Parallels format driver: * make some preparation * add dirty bitmap saving * make dirty bitmap RW * fix broken checks * refactor leak check * add parallels format support to several tests You could find these patches in my repo: https://github.com/Alexa

Re: [PATCH v4 18/21] parallels: Remove unnecessary data_end field

2024-01-18 Thread Denis V. Lunev
On 12/28/23 11:12, Alexander Ivanov wrote: Since we have used bitmap, field data_end in BDRVParallelsState is redundant and can be removed. Add parallels_data_end() helper and remove data_end handling. Signed-off-by: Alexander Ivanov --- block/parallels.c | 33 +--

Re: [PATCH v4 17/21] parallels: Check unused clusters in parallels_check_leak()

2024-01-18 Thread Denis V. Lunev
On 12/28/23 11:12, Alexander Ivanov wrote: Since we have used bitmap, leak check is useless. Transform parallels_truncate_unused_clusters() to parallels_check_unused_clusters() helper and use it in leak check. Signed-off-by: Alexander Ivanov --- block/parallels.c | 121 +++

Re: [PATCH v4 16/21] parallels: Truncate images on the last used cluster

2024-01-18 Thread Denis V. Lunev
ile, s->data_end << BDRV_SECTOR_BITS, -true, PREALLOC_MODE_OFF, 0, NULL); +ret = parallels_truncate_unused_clusters(bs); if (ret < 0) { error_report("Failed to truncate image: %s", strerror(-ret)); } Reviewed-by: Denis V. Lunev

Re: [PATCH v4 15/21] parallels: Reverse a conditional in parallels_check_leak() to reduce indents

2024-01-18 Thread Denis V. Lunev
s->data_end = res->image_end_offset >> BDRV_SECTOR_BITS; - -parallels_free_used_bitmap(bs); -ret = parallels_fill_used_bitmap(bs); -if (ret == -ENOMEM) { -res->check_errors++; - return ret; -} - -if (explicit) { -res->leaks_fixed += count; -} +res->leaks_fixed += count; } } Reviewed-by: Denis V. Lunev

Re: [PATCH v4 14/21] parallels: Make a loaded dirty bitmap persistent

2024-01-18 Thread Denis V. Lunev
; } +bdrv_dirty_bitmap_set_persistence(bitmap, true); bitmaps = g_slist_append(bitmaps, bitmap); break; Reviewed-by: Denis V. Lunev

Re: [PATCH v4 13/21] parallels: Handle L1 entries equal to one

2024-01-18 Thread Denis V. Lunev
On 12/28/23 11:12, Alexander Ivanov wrote: If all the bits in a dirty bitmap cluster are ones, the cluster shouldn't be written. Instead the corresponding L1 entry should be set to 1. Check if all bits in a memory region are ones and set 1 to L1 entries corresponding clusters filled with ones.

Re: [PATCH v4 12/21] parallels: Let image extensions work in RW mode

2024-01-18 Thread Denis V. Lunev
Anyway, this requires at least detailed thinking.From 2f70166ef640304726d5dfcee3e906b0ba1676dd Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Thu, 18 Jan 2024 13:29:56 +0100 Subject: [PATCH 1/1] parallels: drop dirty bitmap data if the image was not properly closed This data is obsolete. The approach is

Re: [PATCH v4 12/21] parallels: Let image extensions work in RW mode

2024-01-18 Thread Denis V. Lunev
On 1/16/24 15:45, Denis V. Lunev wrote: On 12/28/23 11:12, Alexander Ivanov wrote: Now we support extensions saving and can let to work with them in read-write mode. Signed-off-by: Alexander Ivanov ---   block/parallels-ext.c |  4   block/parallels.c | 17 -   2 files

Re: [PATCH v4 11/21] parallels: Add dirty bitmaps saving

2024-01-18 Thread Denis V. Lunev
On 12/28/23 11:12, Alexander Ivanov wrote: Now dirty bitmaps can be loaded but there is no their saving. Add code for dirty bitmap storage. Signed-off-by: Alexander Ivanov --- block/parallels-ext.c | 168 ++ block/parallels.c | 16 +++- block/par

Re: [PATCH v4 12/21] parallels: Let image extensions work in RW mode

2024-01-16 Thread Denis V. Lunev
rp); +if (ret < 0) { + goto fail; } } Reviewed-by: Denis V. Lunev

Re: [PATCH v4 10/21] parallels: Create used bitmap even if checks needed

2024-01-16 Thread Denis V. Lunev
On 12/28/23 11:12, Alexander Ivanov wrote: All the checks were fixed to work with used bitmap. Create used bitmap in parallels_open() even if need_check is true. Signed-off-by: Alexander Ivanov --- block/parallels.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git

Re: [PATCH v4 09/21] parallels: Add a note about used bitmap in parallels_check_duplicate()

2024-01-16 Thread Denis V. Lunev
pointing to this cluster. * Loop through the BAT entries, check bits relevant to an entry offset. * If bit is set, this entry is duplicated. Otherwise set the bit. Reviewed-by: Denis V. Lunev

Re: [PATCH v4 08/21] parallels: Recreate used bitmap in parallels_check_leak()

2024-01-16 Thread Denis V. Lunev
if (explicit) { res->leaks_fixed += count; } Reviewed-by: Denis V. Lunev

Re: [PATCH v4 07/21] parallels: Set data_end value in parallels_check_leak()

2024-01-16 Thread Denis V. Lunev
gt;data_end = res->image_end_offset >> BDRV_SECTOR_BITS; if (explicit) { res->leaks_fixed += count; } Reviewed-by: Denis V. Lunev

Re: [PATCH v4 06/21] parallels: Move host clusters allocation to a separate function

2024-01-16 Thread Denis V. Lunev
have had before this patch and after. On a error originally we have had data_end unchanged, now it points to a wrong location. May be this would be mitigated later, but I'd prefer to have data_end updated in mark_unused. That would make a lot of sense. Anyway, with data_end dropped at the end of the series, this would not worth efforts. Thus this is fine. With a note about comment, Reviewed-by: Denis V. Lunev

Re: [PATCH v4 05/21] parallels: Add parallels_mark_unused() helper

2024-01-16 Thread Denis V. Lunev
PH_RDLOCK parallels_read_format_extension(BlockDriverState *bs, int64_t ext_off, Reviewed-by: Denis V. Lunev

Re: [PATCH v4 04/21] parallels: Limit search in parallels_mark_used to the last marked claster

2024-01-16 Thread Denis V. Lunev
luster_index); +if (next_used < cluster_end) { return -EBUSY; } bitmap_set(bitmap, cluster_index, count); Reviewed-by: Denis V. Lunev

Re: [PATCH] block: allocate aligned write buffer for 'truncate -m full'

2023-12-11 Thread Denis V. Lunev
seek(fd, current_length, SEEK_SET); if (seek_result < 0) { @@ -2413,7 +2413,7 @@ out: } } -g_free(buf); +qemu_vfree(buf); return result; } Reviewed-by: Denis V. Lunev

Re: [PATCH 2/3] i386: kvm: disable KVM_CAP_PMU_CAPABILITY if "pmu" is disabled

2023-11-13 Thread Denis V. Lunev
On 11/19/22 13:29, Dongli Zhang wrote: The "perf stat" at the VM side still works even we set "-cpu host,-pmu" in the QEMU command line. That is, neither "-cpu host,-pmu" nor "-cpu EPYC" could disable the pmu virtualization in an AMD environment. We still see below at VM kernel side ... [0.

Re: [PATCH v2 1/1] qemu-img: do not erase destination file in qemu-img dd command

2023-11-01 Thread Denis V. Lunev
On 11/1/23 17:51, Daniel P. Berrangé wrote: On Tue, Oct 31, 2023 at 03:33:52PM +0100, Hanna Czenczek wrote: On 01.10.23 22:46, Denis V. Lunev wrote: Can you please not top-post. This makes the discussion complex. This approach is followed in this mailing list and in other similar lists like

Re: [PATCH] kvm: emit GUEST_PANICKED event in case of abnormal KVM exit

2023-11-01 Thread Denis V. Lunev
hing to do since in this case guest is no longer operational anyway. Signed-off-by: Andrey Drobyshev Acked-by: Denis V. Lunev --- accel/kvm/kvm-all.c | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index

Re: [PATCH v3 04/21] parallels: Add parallels_mark_unused() helper

2023-10-30 Thread Denis V. Lunev
On 10/30/23 10:06, Denis V. Lunev wrote: On 10/27/23 09:46, Alexander Ivanov wrote: Add a helper to set unused areas in the used bitmap. Signed-off-by: Alexander Ivanov ---   block/parallels.c | 17 +   block/parallels.h |  2 ++   2 files changed, 19 insertions(+) diff --git a

Re: [PATCH v3 04/21] parallels: Add parallels_mark_unused() helper

2023-10-30 Thread Denis V. Lunev
On 10/27/23 09:46, Alexander Ivanov wrote: Add a helper to set unused areas in the used bitmap. Signed-off-by: Alexander Ivanov --- block/parallels.c | 17 + block/parallels.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/block/parallels.c b/block/parallels.c inde

Re: [PATCH v3 03/21] parallels: Make mark_used() a global function

2023-10-30 Thread Denis V. Lunev
+int parallels_mark_used(BlockDriverState *bs, unsigned long *bitmap, +uint32_t bitmap_size, int64_t off, uint32_t count); + int parallels_read_format_extension(BlockDriverState *bs, int64_t ext_off, Error **errp); Reviewed-by: Denis V. Lunev

Re: [PATCH v3 02/21] parallels: Move inactivation code to a separate function

2023-10-30 Thread Denis V. Lunev
,7 @@ static BlockDriver bdrv_parallels = { .bdrv_co_check = parallels_co_check, .bdrv_co_pdiscard = parallels_co_pdiscard, .bdrv_co_pwrite_zeroes = parallels_co_pwrite_zeroes, +.bdrv_inactivate= parallels_inactivate, }; static void bdrv_parallels_init(void) Reviewed-by: Denis V. Lunev

Re: [PATCH v3 01/21] parallels: Set s->used_bmap to NULL in parallels_free_used_bitmap()

2023-10-30 Thread Denis V. Lunev
gt;opaque; s->used_bmap_size = 0; g_free(s->used_bmap); +s->used_bmap = NULL; } static int64_t coroutine_fn GRAPH_RDLOCK Reviewed-by: Denis V. Lunev

Re: [PATCH v2 0/3] vfio/pci: Fix buffer overrun when writing the VF token

2023-10-26 Thread Denis V. Lunev
| 2 +- util/uuid.c | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) Reviwed-by: Denis V. Lunev

Re: [PATCH 1/1] block: improve alignment detection and fix 271 test

2023-10-13 Thread Denis V. Lunev
On 9/7/23 23:53, Denis V. Lunev wrote: Unfortunately 271 IO test is broken if started in non-cached mode. Commits commit a6b257a08e3d72219f03e461a52152672fec0612 Author: Nir Soffer Date: Tue Aug 13 21:21:03 2019 +0300 file-posix: Handle undetectable alignment and

Re: [PATCH v2 03/21] preallocate: Don't poll during permission updates

2023-10-09 Thread Denis V. Lunev
On 10/6/23 20:10, Vladimir Sementsov-Ogievskiy wrote: On 06.10.23 11:56, Kevin Wolf wrote: Am 05.10.2023 um 21:55 hat Vladimir Sementsov-Ogievskiy geschrieben: On 11.09.23 12:46, Kevin Wolf wrote: When the permission related BlockDriver callbacks are called, we are in the middle of an operatio

Re: [PATCH 1/1] block: improve alignment detection and fix 271 test

2023-10-02 Thread Denis V. Lunev
On 9/7/23 23:53, Denis V. Lunev wrote: Unfortunately 271 IO test is broken if started in non-cached mode. Commits commit a6b257a08e3d72219f03e461a52152672fec0612 Author: Nir Soffer Date: Tue Aug 13 21:21:03 2019 +0300 file-posix: Handle undetectable alignment and

Re: [PATCH v2 1/1] qemu-img: do not erase destination file in qemu-img dd command

2023-10-01 Thread Denis V. Lunev
point of view. I would be glad to hear other opinions. Regards, Mike. On Sun, Oct 1, 2023 at 3:25 PM Denis V. Lunev wrote: On 9/30/23 22:31, Mike Maslenkin wrote: Add a check that destination file exists and do not call bdrv_create for this case. Currently `qemu-img dd` command destroys c

Re: [PATCH v2 1/1] qemu-img: do not erase destination file in qemu-img dd command

2023-10-01 Thread Denis V. Lunev
On 9/30/23 22:31, Mike Maslenkin wrote: Add a check that destination file exists and do not call bdrv_create for this case. Currently `qemu-img dd` command destroys content of destination file. Effectively this means that parameters (geometry) of destination image file are changing. This can be

Re: [PATCH 1/1] block: improve alignment detection and fix 271 test

2023-09-26 Thread Denis V. Lunev
On 9/7/23 23:53, Denis V. Lunev wrote: Unfortunately 271 IO test is broken if started in non-cached mode. Commits commit a6b257a08e3d72219f03e461a52152672fec0612 Author: Nir Soffer Date: Tue Aug 13 21:21:03 2019 +0300 file-posix: Handle undetectable alignment and

[PULL v2 16/22] parallels: update used bitmap in allocate_cluster

2023-09-21 Thread Denis V. Lunev
We should extend the bitmap if the file is extended and set the bit in the image used bitmap once the cluster is allocated. Sanity check at that moment also looks like a good idea. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 14 ++ 1 file

[PULL v2 17/22] parallels: naive implementation of allocate_clusters with used bitmap

2023-09-21 Thread Denis V. Lunev
The access to the bitmap is not optimized completely. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 51 --- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/block/parallels.c b/block/parallels.c

[PULL v2 11/22] parallels: add test which will validate data_off fixes through repair

2023-09-21 Thread Denis V. Lunev
We have only check through self-repair and that proven to be not enough. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- tests/qemu-iotests/tests/parallels-checks | 17 + tests/qemu-iotests/tests/parallels-checks.out | 18 ++ 2 files changed

[PULL v2 13/22] tests: fix broken deduplication check in parallels format test

2023-09-21 Thread Denis V. Lunev
the latter we write some content into the first one and validate that fact. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- tests/qemu-iotests/tests/parallels-checks | 14 ++ tests/qemu-iotests/tests/parallels-checks.out | 16 2 files changed, 22

[PULL v2 06/22] parallels: return earlier from parallels_open() function on error

2023-09-21 Thread Denis V. Lunev
At the beginning of the function we can return immediately until we really allocate s->header. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/block/parallels.c b/bl

[PULL v2 22/22] tests: extend test 131 to cover availability of the write-zeroes

2023-09-21 Thread Denis V. Lunev
This patch contains test which minimally tests write-zeroes on top of working discard. The following checks are added: * write 2 clusters, write-zero to the first allocated cluster * write 2 cluster, write-zero to the half the first allocated cluster Signed-off-by: Denis V. Lunev Reviewed-by

[PULL v2 09/22] tests: ensure that image validation will not cure the corruption

2023-09-21 Thread Denis V. Lunev
e and thus could be potentially repaired. This could ruin testing process. The patch forces read-only opening for reads. In that case repairing is impossible. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- tests/qemu-iotests/tests/parallels-checks | 9 + 1 file changed, 5

[PULL v2 04/22] parallels: invent parallels_opts_prealloc() helper to parse prealloc opts

2023-09-21 Thread Denis V. Lunev
assignment that the value is in bytes. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 72 +-- 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index af7be427c9..ae006e7fc7

[PULL v2 10/22] parallels: fix broken parallels_check_data_off()

2023-09-21 Thread Denis V. Lunev
Once we have repaired data_off field in the header we should update s->data_start which is calculated on the base of it. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels.c b/block/parallel

[PULL v2 15/22] parallels: accept multiple clusters in mark_used()

2023-09-21 Thread Denis V. Lunev
This would be useful in the next patch in allocate_clusters(). This change would not imply serious performance drawbacks as usually image is full of data or are at the end of the bitmap. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 18

[PULL v2 20/22] tests: extend test 131 to cover availability of the discard operation

2023-09-21 Thread Denis V. Lunev
-aligned to cluster offset (2 new clusters should be allocated) Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- tests/qemu-iotests/131 | 31 +++ tests/qemu-iotests/131.out | 38 ++ 2 files changed, 69 insertions

[PULL v2 08/22] parallels: create mark_used() helper which sets bit in used bitmap

2023-09-21 Thread Denis V. Lunev
This functionality is used twice already and next patch will add more code with it. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 34 +- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/block/parallels.c b

[PULL v2 18/22] parallels: improve readability of allocate_clusters

2023-09-21 Thread Denis V. Lunev
Replace 'space' representing the amount of data to preallocate with 'bytes'. Rationale: * 'space' at each place is converted to bytes * the unit is more close to the variable name Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallel

[PULL v2 12/22] parallels: collect bitmap of used clusters at open

2023-09-21 Thread Denis V. Lunev
be specifically noted that used bitmap must be recalculated if data_off has been fixed during image consistency check. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 73 +++ block/parallels.h | 3 ++ 2 files changed

[PULL v2 21/22] parallels: naive implementation of parallels_co_pwrite_zeroes

2023-09-21 Thread Denis V. Lunev
The zero flag is missed in the Parallels format specification. We can resort to discard if we have no backing file. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/block/parallels.c b/block

[PULL v2 14/22] tests: test self-cure of parallels image with duplicated clusters

2023-09-21 Thread Denis V. Lunev
The test is quite similar with the original one for duplicated clusters. There is the only difference in the operation which should fix the image. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- tests/qemu-iotests/tests/parallels-checks | 36 +++ tests/qemu

[PULL v2 19/22] parallels: naive implementation of parallels_co_pdiscard

2023-09-21 Thread Denis V. Lunev
* Discarding with backing stores is not supported by the format. * There is no buffering/queueing of the discard operation. * Only operations aligned to the cluster are supported. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 46

[PULL v2 05/22] parallels: return earler in fail_format branch in parallels_open()

2023-09-21 Thread Denis V. Lunev
We do not need to perform any deallocation/cleanup if wrong format is detected. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/parallels.c b/block/parallels.c index ae006e7fc7

[PULL v2 03/22] parallels: fix memory leak in parallels_open()

2023-09-21 Thread Denis V. Lunev
We should free opts allocated through qemu_opts_create() at the end. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels.c b/block/parallels.c index 428f72de1c..af7be427c9 100644 --- a/block

[PULL v2 02/22] parallels: mark driver as supporting CBT

2023-09-21 Thread Denis V. Lunev
bdrv_co_can_store_new_dirty_bitmap() and is different. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index 2ebd8e1301..428f72de1c 100644 --- a/block/parallels.c

[PULL v2 01/22] parallels: fix formatting in bdrv_parallels initialization

2023-09-21 Thread Denis V. Lunev
Old code is ugly and contains tabulations. There are no functional changes in this patch. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 36 +++- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/block

[PULL v2 07/22] parallels: refactor path when we need to re-check image in parallels_open

2023-09-21 Thread Denis V. Lunev
More conditions follows thus the check should be more scalable. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index bd26c8db63

[PULL v2 00/22] implement discard operation for Parallels images

2023-09-21 Thread Denis V. Lunev
tch 21: added GRAPH_RDLOCK specifier for parallels_co_pwrite_zeroes -------- Denis V. Lunev (22): parallels: fix formatting in bdrv_parallels initialization parallels: mark driver as supporting CBT parallels: fix memory leak in p

Re: [PULL 00/22] implement discard operation for Parallels images

2023-09-20 Thread Denis V. Lunev
On 9/20/23 19:55, Stefan Hajnoczi wrote: On Wed, 20 Sept 2023 at 05:22, Denis V. Lunev wrote: The following changes since commit 4907644841e3200aea6475c0f72d3d987e9f3d93: Merge tag 'mem-2023-09-19' of https://github.com/davidhildenbrand/qemu into staging (2023-09-19 13:22:19 -

[PULL 17/22] parallels: naive implementation of allocate_clusters with used bitmap

2023-09-20 Thread Denis V. Lunev
The access to the bitmap is not optimized completely. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 51 --- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/block/parallels.c b/block/parallels.c

[PULL 19/22] parallels: naive implementation of parallels_co_pdiscard

2023-09-20 Thread Denis V. Lunev
* Discarding with backing stores is not supported by the format. * There is no buffering/queueing of the discard operation. * Only operations aligned to the cluster are supported. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 46

[PULL 13/22] tests: fix broken deduplication check in parallels format test

2023-09-20 Thread Denis V. Lunev
the latter we write some content into the first one and validate that fact. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- tests/qemu-iotests/tests/parallels-checks | 14 ++ tests/qemu-iotests/tests/parallels-checks.out | 16 2 files changed, 22

[PULL 15/22] parallels: accept multiple clusters in mark_used()

2023-09-20 Thread Denis V. Lunev
This would be useful in the next patch in allocate_clusters(). This change would not imply serious performance drawbacks as usually image is full of data or are at the end of the bitmap. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 18

[PULL 04/22] parallels: invent parallels_opts_prealloc() helper to parse prealloc opts

2023-09-20 Thread Denis V. Lunev
assignment that the value is in bytes. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 72 +-- 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index af7be427c9..ae006e7fc7

[PULL 06/22] parallels: return earlier from parallels_open() function on error

2023-09-20 Thread Denis V. Lunev
At the beginning of the function we can return immediately until we really allocate s->header. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/block/parallels.c b/bl

[PULL 20/22] tests: extend test 131 to cover availability of the discard operation

2023-09-20 Thread Denis V. Lunev
-aligned to cluster offset (2 new clusters should be allocated) Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- tests/qemu-iotests/131 | 31 +++ tests/qemu-iotests/131.out | 38 ++ 2 files changed, 69 insertions

[PULL 10/22] parallels: fix broken parallels_check_data_off()

2023-09-20 Thread Denis V. Lunev
Once we have repaired data_off field in the header we should update s->data_start which is calculated on the base of it. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels.c b/block/parallel

[PULL 07/22] parallels: refactor path when we need to re-check image in parallels_open

2023-09-20 Thread Denis V. Lunev
More conditions follows thus the check should be more scalable. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index bd26c8db63

[PULL 01/22] parallels: fix formatting in bdrv_parallels initialization

2023-09-20 Thread Denis V. Lunev
Old code is ugly and contains tabulations. There are no functional changes in this patch. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 36 +++- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/block

[PULL 14/22] tests: test self-cure of parallels image with duplicated clusters

2023-09-20 Thread Denis V. Lunev
The test is quite similar with the original one for duplicated clusters. There is the only difference in the operation which should fix the image. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- tests/qemu-iotests/tests/parallels-checks | 36 +++ tests/qemu

[PULL 08/22] parallels: create mark_used() helper which sets bit in used bitmap

2023-09-20 Thread Denis V. Lunev
This functionality is used twice already and next patch will add more code with it. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 34 +- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/block/parallels.c b

[PULL 02/22] parallels: mark driver as supporting CBT

2023-09-20 Thread Denis V. Lunev
bdrv_co_can_store_new_dirty_bitmap() and is different. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index 2ebd8e1301..428f72de1c 100644 --- a/block/parallels.c

[PULL 16/22] parallels: update used bitmap in allocate_cluster

2023-09-20 Thread Denis V. Lunev
We should extend the bitmap if the file is extended and set the bit in the image used bitmap once the cluster is allocated. Sanity check at that moment also looks like a good idea. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 14 ++ 1 file

[PULL 21/22] parallels: naive implementation of parallels_co_pwrite_zeroes

2023-09-20 Thread Denis V. Lunev
The zero flag is missed in the Parallels format specification. We can resort to discard if we have no backing file. Signed-off-by: Denis V. Lunev Reviewed-by: Alexander Ivanov --- block/parallels.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/block/parallels.c b/block

[PULL 00/22] implement discard operation for Parallels images

2023-09-20 Thread Denis V. Lunev
unit tests covering new functionality -------- Denis V. Lunev (22): parallels: fix formatting in bdrv_parallels initialization parallels: mark driver as supporting CBT parallels: fix memory leak in parallels_open() paralle

  1   2   3   4   5   6   7   8   9   10   >