[PATCH v7 5/8] parallels: Add checking and repairing duplicate offsets in BAT

2023-07-01 Thread Alexander Ivanov
new clusters are allocated, the file size increases by 128 Mb. Call parallels_check_leak() to fix this leak. Signed-off-by: Alexander Ivanov --- block/parallels.c | 144 ++ 1 file changed, 144 insertions(+) diff --git a/block/parallels.c b/block

[PATCH v7 3/8] parallels: Add "explicit" argument to parallels_check_leak()

2023-07-01 Thread Alexander Ivanov
In the on of the next patches we need to repair leaks without changing leaks and leaks_fixed info in res. Also we don't want to print any warning about leaks. Add "explicit" argument to skip info changing if the argument is false. Signed-off-by: Alexander Ivanov --- block/parall

[PATCH v7 7/8] parallels: Use bdrv_co_getlength() in parallels_check_outside_image()

2023-07-01 Thread Alexander Ivanov
bdrv_co_getlength() should be used in coroutine context. Replace bdrv_getlength() by bdrv_co_getlength() in parallels_check_outside_image(). Signed-off-by: Alexander Ivanov --- block/parallels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/parallels.c b/block

[PATCH v7 0/8] parallels: Add duplication check, repair at open, fix bugs

2023-07-01 Thread Alexander Ivanov
r 6): Fixed comments. Added O_INACTIVE check in the condition. Replaced inuse detection by header_unclean checking. Replaced playing with corutines by bdrv_check() usage. Alexander Ivanov (8): parallels: Incorrect data end calculation in parallels_open() parallels:

[PATCH v2 7/7] iotests: Add test for data_off check

2023-07-01 Thread Alexander Ivanov
Write a pattern to the first cluster. Corrupt the data_off field and check if the field was repaired on image opening and the pattern has not changed. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/tests/parallels-checks | 15 +++ tests/qemu-iotests/tests/parallels

[PATCH v2 6/7] iotests: Fix test 131 after repair was added to parallels_open()

2023-07-01 Thread Alexander Ivanov
Images repairing in parallels_open() was added, thus parallels tests fail. Access to an image leads to repairing the image. Further image check don't detect any corruption. Remove reads after image creation in test 131. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/131 | 6

[PATCH v2 5/7] iotests: Fix cluster size in parallels images tests (131)

2023-07-01 Thread Alexander Ivanov
In this test cluster size is 64k, but modern tools generate images with cluster size 1M. Calculate cluster size using track field from image header. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/131 | 5 - tests/qemu-iotests/131.out | 44

[PATCH v2 4/7] iotests: Refactor tests of parallels images checks (131)

2023-07-01 Thread Alexander Ivanov
Replace hardcoded numbers by variables. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/131 | 29 - 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/tests/qemu-iotests/131 b/tests/qemu-iotests/131 index a847692b4c..601546c84c 100755 --- a/tests

[PATCH v2 2/7] iotests: Add leak check test for parallels format

2023-07-01 Thread Alexander Ivanov
Write a pattern to the last cluster, extend the image by 1 claster, repair and check that the last cluster still has the same pattern. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/tests/parallels-checks | 27 +++ tests/qemu-iotests/tests/parallels-checks.out | 22

[PATCH v2 1/7] iotests: Add out-of-image check test for parallels format

2023-07-01 Thread Alexander Ivanov
Fill the image with a pattern to generate entries in the BAT, set the first BAT entry outside the image, try to read the corrupted image. At the image opening it should be repaired, check for zeroes in the first cluster. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/tests/parallels

[PATCH v2 3/7] iotests: Add test for BAT entries duplication check

2023-07-01 Thread Alexander Ivanov
Fill a parallels image with a pattern and write another pattern to the second cluster. Corrupt the image and check if the pattern changes. Repair the image and check the patterns on guest and host sides. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/tests/parallels-checks | 32

[PATCH v2 0/7] iotests/parallels: Add new tests and fix old

2023-07-01 Thread Alexander Ivanov
to parallels_open(). v2: 5: Fix a typo. 7: Add a test for data_off check. Alexander Ivanov (7): iotests: Add out-of-image check test for parallels format iotests: Add leak check test for parallels format iotests: Add test for BAT entries duplication check iotests: Refactor tests of parallels images

[PATCH v7 8/8] parallels: Add data_off check

2023-07-01 Thread Alexander Ivanov
data_off field of the parallels image header can be corrupted. Check if this field greater than the header + BAT size and less than file size. Change checking code in parallels_open() accordingly. Signed-off-by: Alexander Ivanov --- block/parallels.c | 98

[PATCH v7 4/8] parallels: Add data_start field to BDRVParallelsState

2023-07-01 Thread Alexander Ivanov
In the next patch we will need the offset of the data area for host cluster index calculation. Add this field and setting up code. Signed-off-by: Alexander Ivanov --- block/parallels.c | 7 --- block/parallels.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/block

[PATCH v7 1/8] parallels: Incorrect data end calculation in parallels_open()

2023-07-01 Thread Alexander Ivanov
t data_end contains the offset in bytes. Replace the alignment to sector size by division by sector size and fix the comparision with s->header_size. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev Reviewed-by: Hanna Czenczek --- block/parallels.c | 4 ++-- 1 file changed, 2 ins

[PATCH v7 6/8] parallels: Image repairing in parallels_open()

2023-07-01 Thread Alexander Ivanov
Repair an image at opening if the image is unclean or out-of-image corruption was detected. Signed-off-by: Alexander Ivanov --- block/parallels.c | 70 +-- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/block/parallels.c b/block

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

2023-05-04 Thread Alexander Ivanov
Could you check this case? Regards, Mike. On Thu, Apr 27, 2023 at 3:29 PM Alexander Ivanov wrote: Good point. Thank you. Best regards, Alexander Ivanov On 4/26/23 23:56, Mike Maslenkin wrote: On Mon, Apr 24, 2023 at 12:44 PM Alexander Ivanov wrote: Cluster offsets must be unique among all the BA

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

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] 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 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 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 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 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

[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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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

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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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] 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(

[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

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

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 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

[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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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

[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 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

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] 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] 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 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.

<    1   2   3   4   5   6   >