Re: [PATCH] nbd: Prevent NULL pointer dereference in nbd_blockdev_client_closed()

2024-06-10 Thread Alexander Ivanov
On 6/10/24 14:33, Eric Blake wrote: On Sat, Jun 08, 2024 at 11:36:59AM GMT, Alexander Ivanov wrote: There is a bug reproducer in the attachment. Summarizing the reproducer, you are repeatedly calling QMP nbd-server-start/nbd-server-stop on qemu as NBD server in one thread, and repeatedly

Re: [PATCH] nbd: Prevent NULL pointer dereference in nbd_blockdev_client_closed()

2024-06-08 Thread Alexander Ivanov
There is a bug reproducer in the attachment. On 6/7/24 17:00, Alexander Ivanov wrote: In some cases, the NBD server can be stopped before nbd_blockdev_client_closed() is called, causing the nbd_server variable to be nullified. This leads to a NULL pointer dereference when accessing nbd_server

[PATCH] nbd: Prevent NULL pointer dereference in nbd_blockdev_client_closed()

2024-06-07 Thread Alexander Ivanov
NULL pointer dereference. Signed-off-by: Alexander Ivanov --- blockdev-nbd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/blockdev-nbd.c b/blockdev-nbd.c index 213012435f..fb1f30ae0d 100644 --- a/blockdev-nbd.c +++ b/blockdev-nbd.c @@ -52,6 +52,9 @@ int nbd_server_max_connections(void

Re: [PATCH v3] block: Use LVM tools for LV block device truncation

2024-06-04 Thread Alexander Ivanov
ping 2 On 3/15/24 09:58, Alexander Ivanov wrote: If a block device is an LVM logical volume we can resize it using standard LVM tools. Add a helper to detect if a device is a DM device. In raw_co_truncate() check if the block device is DM and resize it executing lvresize. Signed-off

Re: [PATCH v2 11/11] iotests/271: add test cases for subcluster-based discard/unmap

2024-05-21 Thread Alexander Ivanov
8 +L2 entry #0: 0x8005 +write -q -P PATTERN 0 64k +L2 entry #0: 0x8005 +discard -q 0 8k +file_do_fallocate fd=N mode=0x03 offset=327680 len=8192 +L2 entry #0: 0x8005 0000 +discard -q 8k 56k +file_do_fallocate fd=N mode=0x03 off

Re: [PATCH v2 10/11] qcow2: zero_l2_subclusters: fall through to discard operation when requested

2024-05-21 Thread Alexander Ivanov
if (ret < 0) { return ret; Reviewed-by: Alexander Ivanov -- Best regards, Alexander Ivanov

Re: [PATCH v2 09/11] qcow2: make subclusters discardable

2024-05-21 Thread Alexander Ivanov
## -# Test qcow2_cluster_discard() with full and normal discards +# Test qcow2_subcluster_discard() with full and normal discards for use_backing_file in yes no; do echo echo "### Discarding clusters with non-zero bitmaps (backing file: $use_backing_file) ###" Reviewed-by: Alexander Ivanov -- Best regards, Alexander Ivanov

Re: [PATCH v2 08/11] qcow2: zeroize the entire cluster when there're no non-zero subclusters

2024-05-21 Thread Alexander Ivanov
tail)); +ret = zero_l2_subclusters(bs, end_offset, + size_to_subclusters(s, tail), flags); if (ret < 0) { goto fail; } Reviewed-by: Alexander Ivanov -- Best regards, Alexander Ivanov

Re: [PATCH v2 07/11] qcow2: add get_sc_range_info() helper for working with subcluster ranges

2024-05-21 Thread Alexander Ivanov
bitmap != scri.l2_bitmap) { +set_l2_bitmap(s, scri.l2_slice, scri.l2_index, new_l2_bitmap); +qcow2_cache_entry_mark_dirty(s->l2_table_cache, scri.l2_slice); } -ret = 0; -out: -qcow2_cache_put(s->l2_table_cache, (void **) _slice); - - return ret; +retur

Re: [PATCH v2 06/11] iotests/290: add test case to check 'discard-no-unref' option behavior

2024-05-21 Thread Alexander Ivanov
quot;: true, "zero": false, "data": true, "compressed": false, "offset": OFFSET}, +{ "start": 65536, "length": 65536, "depth": 0, "present": true, "zero": true, "data": false, "compressed": false}] +# Output of qemu-img map for the image with kept reference +[{ "start": 0, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": OFFSET}, +{ "start": 65536, "length": 65536, "depth": 0, "present": true, "zero": true, "data": false, "compressed": false, "offset": OFFSET}] *** done Reviewed-by: Alexander Ivanov -- Best regards, Alexander Ivanov

Re: [PATCH v2 05/11] iotests/common.rc: add disk_usage function

2024-05-21 Thread Alexander Ivanov
" | awk '{print $1}' +} + # Set the variables to the empty string to turn Valgrind off # for specific processes, e.g. # $ VALGRIND_QEMU_IO= ./check -qcow2 -valgrind 015 Reviewed-by: Alexander Ivanov -- Best regards, Alexander Ivanov

Re: [PATCH v2 04/11] block/file-posix: add trace event for fallocate() calls

2024-05-21 Thread Alexander Ivanov
t_off, int64_t bytes, int flags, int64_t ret) "bs %p src_fd %d offset %"PRIu64" dst_fd %d offset %"PRIu64" bytes %"PRIu64" flags %d ret %"PRId64 file_FindEjectableOpticalMedia(const char *media) "Matching using %s" file_setup_cdrom(const ch

Re: [PATCH v2 03/11] qcow2: put discard requests in the common queue when discard-no-unref enabled

2024-05-21 Thread Alexander Ivanov
_l2_entry & L2E_OFFSET_MASK, -s->cluster_size); +discard_no_unref_any_file(bs, old_l2_entry & L2E_OFFSET_MASK, + s->cluster_size, type, + QCOW2_DISCARD_REQ

Re: [PATCH v2 02/11] qcow2: simplify L2 entries accounting for discard-no-unref

2024-05-21 Thread Alexander Ivanov
if (old_l2_entry == new_l2_entry && old_l2_bitmap == new_l2_bitmap) { continue; } Reviewed-by: Alexander Ivanov -- Best regards, Alexander Ivanov

Re: [PATCH v2 01/11] qcow2: make function update_refcount_discard() global

2024-05-21 Thread Alexander Ivanov
void GRAPH_RDLOCK qcow2_process_discards(BlockDriverState *bs, int ret); +void qcow2_queue_discard(BlockDriverState *bs, uint64_t offset, + uint64_t length); int GRAPH_RDLOCK qcow2_check_metadata_overlap(BlockDriverState *bs, int ign, int64_t offset, Reviewed-by: Alexa

Re: [PATCH v3] block: Use LVM tools for LV block device truncation

2024-05-10 Thread Alexander Ivanov
ping Is there any update of the patch status? Thank you. On 3/15/24 09:58, Alexander Ivanov wrote: If a block device is an LVM logical volume we can resize it using standard LVM tools. Add a helper to detect if a device is a DM device. In raw_co_truncate() check if the block device is DM

[PATCH v5] blockcommit: Reopen base image as RO after abort

2024-04-04 Thread Alexander Ivanov
base image is in RW mode at the end of blockcommit and was in RO mode before blockcommit, reopen the base BDS in RO. Signed-off-by: Alexander Ivanov Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/mirror.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/block/mirro

[PATCH v4] blockcommit: Reopen base image as RO after abort

2024-03-28 Thread Alexander Ivanov
base image is in RW mode at the end of blockcommit and was in RO mode before blockcommit, reopen the base BDS in RO. Signed-off-by: Alexander Ivanov --- block/mirror.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index 1bdce3b657.

Re: [PATCH v3] blockcommit: Reopen base image as RO after abort

2024-03-15 Thread Alexander Ivanov
On 2/28/24 17:48, Vladimir Sementsov-Ogievskiy wrote: On 09.02.24 15:29, Alexander Ivanov wrote: Could you please review the patch? Sorry for long delay. Honestly, I don't like refcnt in block-driver. It violate incapsulation, refcnt is interal thing of common block layer. And actually

[PATCH v3] block: Use LVM tools for LV block device truncation

2024-03-15 Thread Alexander Ivanov
If a block device is an LVM logical volume we can resize it using standard LVM tools. Add a helper to detect if a device is a DM device. In raw_co_truncate() check if the block device is DM and resize it executing lvresize. Signed-off-by: Alexander Ivanov --- block/file-posix.c | 61

Re: [PATCH v2] block: Use LVM tools for LV block device truncation

2024-03-14 Thread Alexander Ivanov
On 3/14/24 13:44, Daniel P. Berrangé wrote: On Wed, Mar 13, 2024 at 11:43:27AM +0100, Alexander Ivanov wrote: If a block device is an LVM logical volume we can resize it using standard LVM tools. Add a helper to detect if a device is a DM device. In raw_co_truncate() check if the block

[PATCH v2] block: Use LVM tools for LV block device truncation

2024-03-13 Thread Alexander Ivanov
If a block device is an LVM logical volume we can resize it using standard LVM tools. Add a helper to detect if a device is a DM device. In raw_co_truncate() check if the block device is DM and resize it executing lvresize. Signed-off-by: Alexander Ivanov --- block/file-posix.c | 61

Re: [PATCH] block: Use LVM tools for LV block device truncation

2024-03-12 Thread Alexander Ivanov
Thank you for the review. On 3/11/24 19:24, Daniel P. Berrangé wrote: On Mon, Mar 11, 2024 at 06:40:44PM +0100, Alexander Ivanov wrote: If a block device is an LVM logical volume we can resize it using standard LVM tools. In raw_co_truncate() check if the block device is a LV using lvdisplay

[PATCH v5 06/22] parallels: Move host clusters allocation to a separate function

2024-03-11 Thread Alexander Ivanov
. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 123 +- block/parallels.h | 3 ++ 2 files changed, 71 insertions(+), 55 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 13726fb3d5..c6d82961c9

[PATCH v5 12/22] parallels: drop dirty bitmap data if the image was not properly closed

2024-03-11 Thread Alexander Ivanov
From: "Denis V. Lunev" This data is obsolete. The approach is exactly the same like we use with QCOW2. Signed-off-by: Denis V. Lunev --- block/parallels-ext.c | 8 1 file changed, 8 insertions(+) diff --git a/block/parallels-ext.c b/block/parallels-ext.c index

[PATCH v5 04/22] parallels: Limit search in parallels_mark_used to the last marked claster

2024-03-11 Thread Alexander Ivanov
There is no necessity to search to the end of the bitmap. Limit the search area as cluster_index + count. Add cluster_end variable to avoid its calculation in a few places. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 9 + 1 file changed, 5

[PATCH v5 15/22] parallels: Handle L1 entries equal to one

2024-03-11 Thread Alexander Ivanov
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. Signed-off-by: Alexander Ivanov --- block

[PATCH v5 11/22] parallels: Add dirty bitmaps saving

2024-03-11 Thread Alexander Ivanov
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 | 187 ++ block/parallels.c | 16 +++- block/parallels.h | 5 ++ 3 files changed, 206

[PATCH v5 19/22] parallels: Remove unnecessary data_end field

2024-03-11 Thread Alexander Ivanov
called for all such clusters. Signed-off-by: Alexander Ivanov --- block/parallels.c | 45 + block/parallels.h | 1 - 2 files changed, 13 insertions(+), 33 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index fd80179642..11b6f97454

[PATCH v5 17/22] parallels: Reverse a conditional in parallels_check_leak() to reduce indents

2024-03-11 Thread Alexander Ivanov
Let the function return a success code if a file size is not bigger than image_end_offset. Thus we can decrease indents in the next code block. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 72 +++ 1 file changed

[PATCH v5 13/22] parallels: Let image extensions work in RW mode

2024-03-11 Thread Alexander Ivanov
Now we support extensions saving and can let to work with them in read-write mode. Place dirty bitmap loading after used bitmap initialization - in the next patch we will work with used bitmap during dirty bitmap loading. Signed-off-by: Alexander Ivanov --- block/parallels-ext.c | 4

[PATCH v5 20/22] tests: Add parallels images support to test 165

2024-03-11 Thread Alexander Ivanov
Use a different bitmap name for parallels images because their has own ID format, and can't contain an arbitrary string. Replace image reopen by shutdown/launch VM because parallels images doesn't support reopen. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/165 | 40

[PATCH v5 10/22] parallels: Create used bitmap even if checks needed

2024-03-11 Thread Alexander Ivanov
All the checks were fixed to work with used bitmap. Create used bitmap in parallels_open() even if need_check is true. In some checks (like duplication check) we need to work with used bitmap so it have to be created before checks are running. Signed-off-by: Alexander Ivanov --- block

[PATCH v5 08/22] parallels: Recreate used bitmap in parallels_check_leak()

2024-03-11 Thread Alexander Ivanov
In parallels_check_leak() file can be truncated. In this case the used bitmap would not comply to the file. Recreate the bitmap after file truncation. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 8 1 file changed, 8 insertions(+) diff --git

[PATCH v5 18/22] parallels: Check unused clusters in parallels_check_leak()

2024-03-11 Thread Alexander Ivanov
because it will be used during work. At image inactivation we can skip it. Signed-off-by: Alexander Ivanov --- block/parallels.c | 106 +- 1 file changed, 68 insertions(+), 38 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 5155b8ac48

[PATCH v5 21/22] tests: Turned on 256, 299, 304 and block-status-cache for parallels format

2024-03-11 Thread Alexander Ivanov
These tests pass with parallels format. Add parallels to supporting formats for these tests. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/256 | 2 +- tests/qemu-iotests/299 | 2 +- tests/qemu-iotests/304 | 2 +- tests/qemu

[PATCH v5 00/22] parallels: Add full dirty bitmap support

2024-03-11 Thread Alexander Ivanov
15: Fixed (end_off != s->used_bmap_size) handling in parallels_truncate_unused_clusters(). 16,17: Changed the sequence of the patches - in this way we have correct leaks check. Alexander Ivanov (21): parallels: Set s->used_bmap to NULL in parallels_free_used_bitmap() parallels: Move ina

[PATCH v5 09/22] parallels: Add a note about used bitmap in parallels_check_duplicate()

2024-03-11 Thread Alexander Ivanov
In parallels_check_duplicate() We use a bitmap for duplication detection. This bitmap is not related to used_bmap field in BDRVParallelsState. Add a comment about it to avoid confusion. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 5 - 1 file changed

[PATCH v5 16/22] parallels: Make a loaded dirty bitmap persistent

2024-03-11 Thread Alexander Ivanov
After bitmap loading the bitmap is not persistent and is removed on image saving. Set bitmap persistence to true. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels-ext.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels-ext.c b/block/parallels

[PATCH v5 14/22] parallels: Preserve extensions cluster for non-transient extensions

2024-03-11 Thread Alexander Ivanov
There could be non-transient extensions that require presence of the extensions cluster during work. Mark extensions cluster as used at extensions loading end nullify l1 tables of dirty bitmaps. Use this cluster at dirty bitmap saving if it exists. Signed-off-by: Alexander Ivanov --- block

[PATCH v5 01/22] parallels: Set s->used_bmap to NULL in parallels_free_used_bitmap()

2024-03-11 Thread Alexander Ivanov
After used bitmap freeng s->used_bmap points to the freed memory. If we try to free used bitmap one more time it leads to double free error. Set s->used_bmap to NULL to exclude double free error. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 1 +

[PATCH v5 03/22] parallels: Make mark_used() a global function

2024-03-11 Thread Alexander Ivanov
We will need this function and a function for marking unused clusters (will be added in the next patch) in parallels-ext.c too. Let it be a global function parallels_mark_used(). Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 14 -- block

[PATCH v5 22/22] tests: Add parallels format support to image-fleecing

2024-03-11 Thread Alexander Ivanov
Use a different bitmap name for parallels images because their has own ID format, and can't contain an arbitrary string. Replace hardcoded 'qcow2' format to iotests.imgfmt. Add 'parallels' to supported formats. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/tests/image-fleecing | 13

[PATCH v5 07/22] parallels: Set data_end value in parallels_check_leak()

2024-03-11 Thread Alexander Ivanov
In parallels_check_leak() we change file size but don't correct data_end field of BDRVParallelsState structure. Fix it. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels.c b/block/parallels.c

[PATCH v5 02/22] parallels: Move inactivation code to a separate function

2024-03-11 Thread Alexander Ivanov
We are going to add parallels image extensions storage and need a separate function for inactivation code. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/block

[PATCH v5 05/22] parallels: Add parallels_mark_unused() helper

2024-03-11 Thread Alexander Ivanov
Add a helper to set unused areas in the used bitmap. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 18 ++ block/parallels.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index 4470519656

[PATCH] block: Use LVM tools for LV block device truncation

2024-03-11 Thread Alexander Ivanov
If a block device is an LVM logical volume we can resize it using standard LVM tools. In raw_co_truncate() check if the block device is a LV using lvdisplay and resize it executing lvresize. Signed-off-by: Alexander Ivanov --- block/file-posix.c | 27 +++ 1 file changed

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

2024-02-29 Thread Alexander Ivanov
On 1/18/24 14:37, Denis V. Lunev wrote: 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

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

2024-02-28 Thread Alexander Ivanov
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 ---   block/parallels-ext.c |  4   block

Re: [PATCH v3] blockcommit: Reopen base image as RO after abort

2024-02-09 Thread Alexander Ivanov
Could you please review the patch? On 1/30/24 10:14, Alexander Ivanov wrote: If a blockcommit is aborted the base image remains in RW mode, that leads to a fail of subsequent live migration. How to reproduce: $ virsh snapshot-create-as vm snp1 --disk-only *** write something to the disk

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

2024-02-07 Thread Alexander Ivanov
On 1/18/24 14:27, Denis V. Lunev wrote: 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

[PATCH v3] blockcommit: Reopen base image as RO after abort

2024-01-30 Thread Alexander Ivanov
base BDS in RO in this case. Signed-off-by: Alexander Ivanov --- block/mirror.c | 38 -- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index 5145eb53e1..52a7fee75e 100644 --- a/block/mirror.c +++ b/block/mirror.c

[PATCH v2] blockcommit: Reopen base image as RO after abort

2024-01-09 Thread Alexander Ivanov
base image in RO mode in mirror_exit_common() if the blockjob is aborted and the base image was opened in RO mode before the blockcommit. Signed-off-by: Alexander Ivanov --- block/mirror.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/block/mirror.c b/block/mir

[PATCH v4 21/21] tests: Add parallels format support to image-fleecing

2023-12-28 Thread Alexander Ivanov
Use a different bitmap name for parallels images because their has own ID format, and can't contain an arbitrary string. Replace hardcoded 'qcow2' format to iotests.imgfmt. Add 'parallels' to supported formats. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/tests/image-fleecing | 13

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

2023-12-28 Thread Alexander Ivanov
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. Signed-off-by: Alexander Ivanov --- block

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

2023-12-28 Thread Alexander Ivanov
In parallels_check_duplicate() We use a bitmap for duplication detection. This bitmap is not related to used_bmap field in BDRVParallelsState. Add a comment about it to avoid confusion. Signed-off-by: Alexander Ivanov --- block/parallels.c | 5 - 1 file changed, 4 insertions(+), 1 deletion

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

2023-12-28 Thread Alexander Ivanov
Let the function return a success code if a file size is not bigger than image_end_offset. Thus we can decrease indents in the next code block. Signed-off-by: Alexander Ivanov --- block/parallels.c | 72 +++ 1 file changed, 36 insertions(+), 36

[PATCH v4 20/21] tests: Turned on 256, 299, 304 and block-status-cache for parallels format

2023-12-28 Thread Alexander Ivanov
These tests pass with parallels format. Add parallels to supporting formats for these tests. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/256 | 2 +- tests/qemu-iotests/299 | 2 +- tests/qemu-iotests/304 | 2 +- tests/qemu

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

2023-12-28 Thread Alexander Ivanov
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/parallels.h | 5 ++ 3 files changed, 187

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

2023-12-28 Thread Alexander Ivanov
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 changed, 4 insertions(+), 17 deletions(-) diff --git a/block/parallels-ext.c b/block

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

2023-12-28 Thread Alexander Ivanov
On an image closing there can be unused clusters in the end of the image. Truncate these clusters and update data_end field. Signed-off-by: Alexander Ivanov --- block/parallels.c | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/block/parallels.c b/block

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

2023-12-28 Thread Alexander Ivanov
In parallels_check_leak() we change file size but don't correct data_end field of BDRVParallelsState structure. Fix it. Signed-off-by: Alexander Ivanov --- block/parallels.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels.c b/block/parallels.c index 658902ae51..8a6e2ba7ee

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

2023-12-28 Thread Alexander Ivanov
After bitmap loading the bitmap is not persistent and is removed on image saving. Set bitmap persistence to true. Signed-off-by: Alexander Ivanov --- block/parallels-ext.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels-ext.c b/block/parallels-ext.c index 033ca3ec3a

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

2023-12-28 Thread Alexander Ivanov
Add a helper to set unused areas in the used bitmap. Signed-off-by: Alexander Ivanov --- block/parallels.c | 18 ++ block/parallels.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index 4470519656..13726fb3d5 100644 --- a/block

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

2023-12-28 Thread Alexander Ivanov
After used bitmap freeng s->used_bmap points to the freed memory. If we try to free used bitmap one more time it leads to double free error. Set s->used_bmap to NULL to exclude double free error. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 1 +

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

2023-12-28 Thread Alexander Ivanov
There is no necessity to search to the end of the bitmap. Limit the search area as cluster_index + count. Add cluster_end variable to avoid its calculation in a few places. Signed-off-by: Alexander Ivanov --- block/parallels.c | 9 + 1 file changed, 5 insertions(+), 4 deletions

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

2023-12-28 Thread Alexander Ivanov
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 + block/parallels.h | 1 - 2 files changed

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

2023-12-28 Thread Alexander Ivanov
We are going to add parallels image extensions storage and need a separate function for inactivation code. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/block

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

2023-12-28 Thread Alexander Ivanov
. Signed-off-by: Alexander Ivanov --- block/parallels.c | 128 -- block/parallels.h | 3 ++ 2 files changed, 71 insertions(+), 60 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 13726fb3d5..658902ae51 100644 --- a/block/parallels.c

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

2023-12-28 Thread Alexander Ivanov
We will need this function and a function for marking unused clusters (will be added in the next patch) in parallels-ext.c too. Let it be a global function parallels_mark_used(). Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 14 -- block

[PATCH v4 19/21] tests: Add parallels images support to test 165

2023-12-28 Thread Alexander Ivanov
Use a different bitmap name for parallels images because their has own ID format, and can't contain an arbitrary string. Replace image reopen by shutdown/launch VM because parallels images doesn't support reopen. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/165 | 40

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

2023-12-28 Thread Alexander Ivanov
In parallels_check_leak() file can be truncated. In this case the used bitmap would not comply to the file. Recreate the bitmap after file truncation. Signed-off-by: Alexander Ivanov --- block/parallels.c | 8 1 file changed, 8 insertions(+) diff --git a/block/parallels.c b/block

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

2023-12-28 Thread Alexander Ivanov
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 a/block/parallels.c b/block/parallels.c index

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

2023-12-28 Thread Alexander Ivanov
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 +- 1 file changed, 67

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

2023-12-28 Thread Alexander Ivanov
orrect leaks check. Alexander Ivanov (21): parallels: Set s->used_bmap to NULL in parallels_free_used_bitmap() parallels: Move inactivation code to a separate function parallels: Make mark_used() a global function parallels: Limit search in parallels_mark_used to the last marked

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

2023-12-28 Thread Alexander Ivanov
Sorry, incorrect patch set, please ignore. On 12/28/23 10:41, Alexander Ivanov wrote: After used bitmap freeng s->used_bmap points to the freed memory. If we try to free used bitmap one more time it leads to double free error. Set s->used_bmap to NULL to exclude double free error. Sign

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

2023-12-28 Thread Alexander Ivanov
In parallels_check_duplicate() We use a bitmap for duplication detection. This bitmap is not related to used_bmap field in BDRVParallelsState. Add a comment about it to avoid confusion. Signed-off-by: Alexander Ivanov --- block/parallels.c | 5 - 1 file changed, 4 insertions(+), 1 deletion

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

2023-12-28 Thread Alexander Ivanov
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 +- 1 file changed, 67

[PATCH 19/21] tests: Add parallels images support to test 165

2023-12-28 Thread Alexander Ivanov
Use a different bitmap name for parallels images because their has own ID format, and can't contain an arbitrary string. Replace image reopen by shutdown/launch VM because parallels images doesn't support reopen. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/165 | 40

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

2023-12-28 Thread Alexander Ivanov
Let the function return a success code if a file size is not bigger than image_end_offset. Thus we can decrease indents in the next code block. Signed-off-by: Alexander Ivanov --- block/parallels.c | 72 +++ 1 file changed, 36 insertions(+), 36

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

2023-12-28 Thread Alexander Ivanov
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. Signed-off-by: Alexander Ivanov --- block

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

2023-12-28 Thread Alexander Ivanov
After bitmap loading the bitmap is not persistent and is removed on image saving. Set bitmap persistence to true. Signed-off-by: Alexander Ivanov --- block/parallels-ext.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels-ext.c b/block/parallels-ext.c index 033ca3ec3a

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

2023-12-28 Thread Alexander Ivanov
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/parallels.h | 5 ++ 3 files changed, 187

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

2023-12-28 Thread Alexander Ivanov
On an image closing there can be unused clusters in the end of the image. Truncate these clusters and update data_end field. Signed-off-by: Alexander Ivanov --- block/parallels.c | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/block/parallels.c b/block

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

2023-12-28 Thread Alexander Ivanov
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 + block/parallels.h | 1 - 2 files changed

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

2023-12-28 Thread Alexander Ivanov
In parallels_check_leak() file can be truncated. In this case the used bitmap would not comply to the file. Recreate the bitmap after file truncation. Signed-off-by: Alexander Ivanov --- block/parallels.c | 8 1 file changed, 8 insertions(+) diff --git a/block/parallels.c b/block

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

2023-12-28 Thread Alexander Ivanov
We will need this function and a function for marking unused clusters (will be added in the next patch) in parallels-ext.c too. Let it be a global function parallels_mark_used(). Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 14 -- block

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

2023-12-28 Thread Alexander Ivanov
Add a helper to set unused areas in the used bitmap. Signed-off-by: Alexander Ivanov --- block/parallels.c | 18 ++ block/parallels.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index 4470519656..13726fb3d5 100644 --- a/block

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

2023-12-28 Thread Alexander Ivanov
There is no necessity to search to the end of the bitmap. Limit the search area as cluster_index + count. Add cluster_end variable to avoid its calculation in a few places. Signed-off-by: Alexander Ivanov --- block/parallels.c | 9 + 1 file changed, 5 insertions(+), 4 deletions

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

2023-12-28 Thread Alexander Ivanov
. Signed-off-by: Alexander Ivanov --- block/parallels.c | 128 -- block/parallels.h | 3 ++ 2 files changed, 71 insertions(+), 60 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 13726fb3d5..658902ae51 100644 --- a/block/parallels.c

[PATCH 21/21] tests: Add parallels format support to image-fleecing

2023-12-28 Thread Alexander Ivanov
Use a different bitmap name for parallels images because their has own ID format, and can't contain an arbitrary string. Replace hardcoded 'qcow2' format to iotests.imgfmt. Add 'parallels' to supported formats. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/tests/image-fleecing | 13

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

2023-12-28 Thread Alexander Ivanov
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 a/block/parallels.c b/block/parallels.c index

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

2023-12-28 Thread Alexander Ivanov
In parallels_check_leak() we change file size but don't correct data_end field of BDRVParallelsState structure. Fix it. Signed-off-by: Alexander Ivanov --- block/parallels.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels.c b/block/parallels.c index 658902ae51..8a6e2ba7ee

[PATCH 20/21] tests: Turned on 256, 299, 304 and block-status-cache for parallels format

2023-12-28 Thread Alexander Ivanov
These tests pass with parallels format. Add parallels to supporting formats for these tests. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/256 | 2 +- tests/qemu-iotests/299 | 2 +- tests/qemu-iotests/304 | 2 +- tests/qemu

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

2023-12-28 Thread Alexander Ivanov
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 changed, 4 insertions(+), 17 deletions(-) diff --git a/block/parallels-ext.c b/block

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

2023-12-28 Thread Alexander Ivanov
We are going to add parallels image extensions storage and need a separate function for inactivation code. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/block

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

2023-12-28 Thread Alexander Ivanov
After used bitmap freeng s->used_bmap points to the freed memory. If we try to free used bitmap one more time it leads to double free error. Set s->used_bmap to NULL to exclude double free error. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 1 +

Re: [PATCH] blockcommit: Reopen base image as RO after abort

2023-12-25 Thread Alexander Ivanov
Ping. Could someone please review the code? On 11/30/23 11:11, Alexander Ivanov wrote: If a blockcommit is aborted the base image remains in RW mode, that leads to a fail of subsequent live migration. How to reproduce: $ virsh snapshot-create-as vm snp1 --disk-only *** write something

[PATCH] blockcommit: Reopen base image as RO after abort

2023-11-30 Thread Alexander Ivanov
blockjob is aborted. Signed-off-by: Alexander Ivanov --- block/mirror.c | 4 1 file changed, 4 insertions(+) diff --git a/block/mirror.c b/block/mirror.c index dcd88de2e3..50a2825b1c 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -789,6 +789,10 @@ static int mirror_exit_common(

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

2023-11-13 Thread Alexander Ivanov
On 10/30/23 10:09, Denis V. Lunev wrote: 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

  1   2   3   4   5   >