[PATCH 0/2] qga: Add ZFS TRIM support for FreeBSD

2022-11-15 Thread Alexander Ivanov
Move Linux-specific FS TRIM code to commands-linux.c and add support of ZFS TRIM for FreeBSD. Alexander Ivanov (2): qga: Move FS TRIM code to commands-linux.c qga: Add ZFS TRIM support for FreeBSD qga/commands-bsd.c| 109 ++ qga/commands-common.h

[PATCH 2/2] qga: Add ZFS TRIM support for FreeBSD

2022-11-15 Thread Alexander Ivanov
Use zpool tool for ZFS pools trimming in FreeBSD. Signed-off-by: Alexander Ivanov --- qga/commands-bsd.c| 109 ++ qga/commands-common.h | 1 + 2 files changed, 110 insertions(+) diff --git a/qga/commands-bsd.c b/qga/commands-bsd.c index 15cade2d4c

[PATCH 1/2] qga: Move FS TRIM code to commands-linux.c

2022-11-15 Thread Alexander Ivanov
In the next patch ZFS TRIM support for FreeBSD will be added. Move Linux-specific TRIM code to commands-linux.c file. Signed-off-by: Alexander Ivanov --- qga/commands-linux.c | 73 qga/commands-posix.c | 72

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

2022-08-04 Thread alexander . ivanov
From: Alexander Ivanov Parallels image file can be corrupted this way: two guest memory areas refer to the same host memory area (duplicated offsets in BAT). qemu-img check copies data from duplicated cluster to the new cluster and writes new corresponding offset to BAT instead of duplicated one

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

2022-08-04 Thread alexander . ivanov
From: Alexander Ivanov When duplicates are repaired a new space area is allocated and further leak check considers it as a leak. Let fix it without printing any messages. Signed-off-by: Alexander Ivanov --- block/parallels.c | 19 +-- 1 file changed, 13 insertions(+), 6

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

2022-08-04 Thread alexander . ivanov
From: Alexander Ivanov There could be corruptions in the image file: two quest memory areas refer to the same host cluster. If a duplicate offset is found fix it by copying the content of the referred cluster to a new allocated cluster and replace one of the two referring entries by the new

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

2022-08-04 Thread alexander . ivanov
From: Alexander Ivanov Check if original and duplicated offsets refer to the same cluster. Repair the image and check that writing to a referred cluster doesn't affects another referred cluster. Signed-off-by: Natalia Kuzmina Signed-off-by: Alexander Ivanov --- tests/qemu-iotest

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

2022-08-05 Thread alexander . ivanov
From: Alexander Ivanov We will add more and more checks of images so we need to reorganize the code. Put each check to a separate helper function with a separate loop. Add two helpers: truncate_file() and sync_header(). They will be used in multiple functions. Parallels image file can be

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

2022-08-05 Thread alexander . ivanov
From: Alexander Ivanov There could be corruptions in the image file: two guest memory areas refer to the same host cluster. If a duplicate offset is found fix it by copying the content of the referred cluster to a new allocated cluster and replace one of the two referring entries by the new

[PATCH v2 1/3] parallels: Put the image checks in separate functions

2022-08-05 Thread alexander . ivanov
From: Alexander Ivanov We will add more and more checks of images so we need to reorganize the code. Put each check to a separate helper function with a separate loop. Add two helpers: truncate_file() and sync_header(). They will be used in multiple functions. Signed-off-by: Alexander Ivanov

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

2022-08-05 Thread alexander . ivanov
From: Alexander Ivanov Check if original and duplicated offsets refer to the same cluster. Repair the image and check that writing to a referred cluster doesn't affects another referred cluster. Signed-off-by: Natalia Kuzmina Signed-off-by: Alexander Ivanov --- tests/qemu-iotest

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

2022-08-08 Thread Alexander Ivanov
Signed-off-by: Alexander Ivanov --- block/parallels.c | 29 +++-- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index a229c06f25..108aa907b8 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -413,6 +413,23

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

2022-08-08 Thread Alexander Ivanov
bdrv_co_pwrite_sync by bdrv_co_flush for writing to the disk only dirty blocks. Merge parallels_check_fragmentation to parallels_collect_statistics. Alexander Ivanov (9): parallels: Move check of unclean image to a separate function parallels: Move check of cluster outside image to a separate

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

2022-08-08 Thread Alexander Ivanov
data_end field with the original file size if the image was opened for checking and repairing purposes or raise an error. Signed-off-by: Alexander Ivanov --- block/parallels.c | 17 + 1 file changed, 17 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index

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

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

[PATCH 3/9] parallels: Move check of leaks to a separate function

2022-08-08 Thread Alexander Ivanov
Signed-off-by: Alexander Ivanov --- block/parallels.c | 96 --- 1 file changed, 58 insertions(+), 38 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 7b400ecdcc..6d4cfb738b 100644 --- a/block/parallels.c +++ b/block/parallels.c

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

2022-08-08 Thread Alexander Ivanov
It's too costly to write all the BAT to the disk. Let the flush function write only dirty blocks. Signed-off-by: Alexander Ivanov --- block/parallels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/parallels.c b/block/parallels.c index 72cf7499c1..38b1482e81 1

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

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

[PATCH 4/9] parallels: Move check of fragmentation to a separate function

2022-08-08 Thread Alexander Ivanov
Signed-off-by: Alexander Ivanov --- block/parallels.c | 38 +- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 6d4cfb738b..0edbb812dd 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -530,12

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

2022-08-08 Thread Alexander Ivanov
Signed-off-by: Alexander Ivanov --- block/parallels.c | 25 ++--- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 0edbb812dd..b0982d60d0 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -553,13 +553,29

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

2022-08-08 Thread Alexander Ivanov
Replace the way that we use mutex in parallels_co_check() for more clean code. Signed-off-by: Alexander Ivanov --- block/parallels.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index b0982d60d0..3cb5452613 100644 --- a

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

2022-08-11 Thread Alexander Ivanov
ne in parallels_co_check. Now we use a helper to set BAT entry and mark the block dirty. Signed-off-by: Alexander Ivanov --- block/parallels.c | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 7f68f3cbc9..6879e

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

2022-08-11 Thread Alexander Ivanov
v2: Move fragmentation counting code to this function too. Signed-off-by: Alexander Ivanov --- block/parallels.c | 54 +++ 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 8737eadfb4

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

2022-08-11 Thread Alexander Ivanov
v2: Move unrelated helper parallels_set_bat_entry creation to a separate patch. Signed-off-by: Alexander Ivanov --- block/parallels.c | 48 ++- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/block/parallels.c b/block/parallels.c

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

2022-08-11 Thread Alexander Ivanov
Fix image inflation when offset in BAT is out of image. Replace whole BAT syncing by flushing only dirty blocks. Move all the checks outside the main check function in separate functions Use WITH_QEMU_LOCK_GUARD for more clean code. Alexander Ivanov (8): parallels: Out of image offset in BAT

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

2022-08-11 Thread Alexander Ivanov
v2: Revert the condition with s->header_unclean. Signed-off-by: Alexander Ivanov --- block/parallels.c | 31 +-- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 6879ea4597..c53b2810cf 100644 --- a/bl

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

2022-08-11 Thread Alexander Ivanov
data_end field with the original file size if the image was opened for checking and repairing purposes or raise an error. v2: No changes. Signed-off-by: Alexander Ivanov --- block/parallels.c | 17 + 1 file changed, 17 insertions(+) diff --git a/block/parallels.c b/block

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

2022-08-11 Thread Alexander Ivanov
Will need to set BAT entry in multiple places. Move the code of settings entries and marking relevant blocks dirty to a separate helper parallels_set_bat_entry. v2: A new patch - a part of a splitted patch. Signed-off-by: Alexander Ivanov --- block/parallels.c | 12 +--- 1 file changed

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

2022-08-11 Thread Alexander Ivanov
Replace the way we use mutex in parallels_co_check() for more clean code. v2: Fix an incorrect usage of WITH_QEMU_LOCK_GUARD. Signed-off-by: Alexander Ivanov --- block/parallels.c | 26 -- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/block/parallels.c

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

2022-08-11 Thread Alexander Ivanov
v2: No changes. Signed-off-by: Alexander Ivanov --- block/parallels.c | 85 +-- 1 file changed, 52 insertions(+), 33 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 12104ba5ad..8737eadfb4 100644 --- a/block/parallels.c +++ b

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

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

2024-01-30 Thread Alexander Ivanov
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 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

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

2024-03-28 Thread Alexander Ivanov
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.

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

2024-04-04 Thread Alexander Ivanov
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] 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

[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
ixed clusters leaks. 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()

[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 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 9cb8e65c0d..7fa14b057d

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

[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 19/22] parallels: Remove unnecessary data_end field

2024-03-11 Thread Alexander Ivanov
ready 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..11b6f

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

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

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

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

[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

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

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

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 and

[PATCH v2 4/5] parallels: Replace fprintf by qemu_log in check

2023-01-12 Thread Alexander Ivanov
If the check is called during normal work, tracking of the check must be present in VM logs to have some clues if something going wrong with user's data. Signed-off-by: Alexander Ivanov --- block/parallels.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --

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

2023-01-12 Thread Alexander Ivanov
mer 5): Fixed formatting. 5 (former 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 (5): parallels: Incorrect data end calculati

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

2023-01-12 Thread Alexander Ivanov
deduplicate the code. Move parallels_fix_leak() call to parallels_co_check() to fix both types of leak: real corruption and a leak produced by allocate_clusters() during deduplication. Signed-off-by: Alexander Ivanov --- block/parallels.c | 168 +- 1 file

[PATCH v2 1/5] parallels: Incorrect data end calculation in parallels_open()

2023-01-12 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 --- block/parallels.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)

[PATCH v2 2/5] parallels: Split image leak handling to separate check and fix helpers

2023-01-12 Thread Alexander Ivanov
We need to fix leak after deduplication in the next patch. Move leak fixing to a separate helper parallels_fix_leak() and add parallels_get_leak_size() helper wich used in parallels_fix_leak() and parallels_check_leak(). Signed-off-by: Alexander Ivanov --- block/parallels.c | 88

[PATCH v2 5/5] parallels: Image repairing in parallels_open()

2023-01-12 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 | 67 +-- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/block/parallels.c b/block

[PATCH v8 04/11] parallels: create parallels_set_bat_entry_helper() to assign BAT value

2023-01-15 Thread Alexander Ivanov
This helper will be reused in next patches during parallels_co_check rework to simplify its code. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/parallels.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff

[PATCH v8 00/11] parallels: Refactor the code of images checks and fix a bug

2023-01-15 Thread Alexander Ivanov
to set BAT entry and mark the block dirty. 4: Revert the condition with s->header_unclean. 5: Move unrelated helper parallels_set_bat_entry creation to a separate patch. 7: Move fragmentation counting code to this function too. 8: Fix an incorrect usage of WITH_QEMU_LOCK_GUARD. Alexander Ivanov (

[PATCH v8 07/11] parallels: Move check of cluster outside image to a separate function

2023-01-15 Thread Alexander Ivanov
We will add more and more checks so we need a better code structure in parallels_co_check. Let each check performs in a separate loop in a separate helper. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 59 ++- 1

[PATCH v8 08/11] parallels: Move check of leaks to a separate function

2023-01-15 Thread Alexander Ivanov
We will add more and more checks so we need a better code structure in parallels_co_check. Let each check performs in a separate loop in a separate helper. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 84 +-- 1

[PATCH v8 11/11] parallels: Incorrect condition in out-of-image check

2023-01-15 Thread Alexander Ivanov
All the offsets in the BAT must be lower than the file size. Fix the check condition for correct check. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/parallels.c b/block/parallels.c

[PATCH v8 06/11] parallels: Move check of unclean image to a separate function

2023-01-15 Thread Alexander Ivanov
We will add more and more checks so we need a better code structure in parallels_co_check. Let each check performs in a separate loop in a separate helper. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/parallels.c | 31

[PATCH v8 02/11] parallels: Fix high_off calculation in parallels_co_check()

2023-01-15 Thread Alexander Ivanov
Don't let high_off be more than the file size even if we don't fix the image. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index

[PATCH v8 10/11] parallels: Replace qemu_co_mutex_lock by WITH_QEMU_LOCK_GUARD

2023-01-15 Thread Alexander Ivanov
Replace the way we use mutex in parallels_co_check() for simplier and less error prone code. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 33 ++--- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/block

[PATCH v8 05/11] parallels: Use generic infrastructure for BAT writing in parallels_co_check()

2023-01-15 Thread Alexander Ivanov
manually write BAT and track its modification. This makes code more generic and allows to split parallels_set_bat_entry() for independent pieces. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 23 ++- 1 file changed, 10 insertions(+), 13

[PATCH v8 01/11] parallels: Out of image offset in BAT leads to image inflation

2023-01-15 Thread Alexander Ivanov
parallels_open() if data_end points outside the image and it is not a check (let the check to repaire the image). Set data_end to the end of the cluster with the last correct offset. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 17 + 1 file changed

[PATCH v8 09/11] parallels: Move statistic collection to a separate function

2023-01-15 Thread Alexander Ivanov
We will add more and more checks so we need a better code structure in parallels_co_check. Let each check performs in a separate loop in a separate helper. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/parallels.c | 53

[PATCH v8 03/11] parallels: Fix data_end after out-of-image check

2023-01-15 Thread Alexander Ivanov
Set data_end to the end of the last cluster inside the image. In such a way we can be sure that corrupted offsets in the BAT can't affect on the image size. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 2 ++ 1 file changed, 2 insertions(+) diff --

Re: [PATCH v2 0/5] parallels: Add duplication check, repair at open, fix bugs

2023-01-15 Thread Alexander Ivanov
This patchset should be applied on the top of *[PATCH v8 00/11] parallels: Refactor the code of images checks and fix a bug* On 12.01.2023 16:01, Alexander Ivanov wrote: Fix incorrect data end calculation in parallels_open(). Split image leak handling to separate check and fix helpers. Add

Re: [PATCH v8 07/11] parallels: Move check of cluster outside image to a separate function

2023-01-20 Thread Alexander Ivanov
On 18.01.2023 15:45, Hanna Czenczek wrote: On 15.01.23 16:58, Alexander Ivanov wrote: We will add more and more checks so we need a better code structure in parallels_co_check. Let each check performs in a separate loop in a separate helper. Signed-off-by: Alexander Ivanov Reviewed-by

Re: [PATCH v8 11/11] parallels: Incorrect condition in out-of-image check

2023-01-20 Thread Alexander Ivanov
On 18.01.2023 15:46, Hanna Czenczek wrote: On 15.01.23 16:58, Alexander Ivanov wrote: All the offsets in the BAT must be lower than the file size. Fix the check condition for correct check. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev ---   block/parallels.c | 2 +-   1 file

[PATCH v9 02/12] parallels: Fix high_off calculation in parallels_co_check()

2023-01-31 Thread Alexander Ivanov
Don't let high_off be more than the file size even if we don't fix the image. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index

[PATCH v9 03/12] parallels: Fix image_end_offset and data_end after out-of-image check

2023-01-31 Thread Alexander Ivanov
Set data_end to the end of the last cluster inside the image. In such a way we can be sure that corrupted offsets in the BAT can't affect on the image size. If there are no allocated clusters set image_end_offset by data_end. Signed-off-by: Alexander Ivanov --- block/parallels.c | 8 ++

[PATCH v9 08/12] parallels: Fix statistics calculation

2023-01-31 Thread Alexander Ivanov
Exclude out-of-image clusters from allocated and fragmented clusters calculation. Signed-off-by: Alexander Ivanov --- block/parallels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/parallels.c b/block/parallels.c index f9acee1fa8..7382c01191 100644 --- a/block

[PATCH v9 00/11] parallels: Refactor the code of images checks and fix a bug

2023-01-31 Thread Alexander Ivanov
rk the block dirty. 4: Revert the condition with s->header_unclean. 5: Move unrelated helper parallels_set_bat_entry creation to a separate patch. 7: Move fragmentation counting code to this function too. 8: Fix an incorrect usage of WITH_QEMU_LOCK_GUARD. Alexander Ivanov (12): parallels

[PATCH v9 10/12] parallels: Move statistic collection to a separate function

2023-01-31 Thread Alexander Ivanov
We will add more and more checks so we need a better code structure in parallels_co_check. Let each check performs in a separate loop in a separate helper. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/parallels.c | 52

[PATCH v9 12/12] parallels: Incorrect condition in out-of-image check

2023-01-31 Thread Alexander Ivanov
All the offsets in the BAT must be lower than the file size. Fix the check condition for correct check. Signed-off-by: Alexander Ivanov --- block/parallels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/parallels.c b/block/parallels.c index e4faa14add..e469fe3f78

[PATCH v9 11/12] parallels: Replace qemu_co_mutex_lock by WITH_QEMU_LOCK_GUARD

2023-01-31 Thread Alexander Ivanov
Replace the way we use mutex in parallels_co_check() for simplier and less error prone code. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 33 ++--- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/block

[PATCH v9 07/12] parallels: Move check of cluster outside image to a separate function

2023-01-31 Thread Alexander Ivanov
We will add more and more checks so we need a better code structure in parallels_co_check. Let each check performs in a separate loop in a separate helper. Signed-off-by: Alexander Ivanov --- block/parallels.c | 81 ++- 1 file changed, 52 insertions

[PATCH v9 01/12] parallels: Out of image offset in BAT leads to image inflation

2023-01-31 Thread Alexander Ivanov
parallels_open() if data_end points outside the image and it is not a check (let the check to repaire the image). Set data_end to the end of the cluster with the last correct offset. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 17 + 1 file changed

[PATCH v9 05/12] parallels: Use generic infrastructure for BAT writing in parallels_co_check()

2023-01-31 Thread Alexander Ivanov
manually write BAT and track its modification. This makes code more generic and allows to split parallels_set_bat_entry() for independent pieces. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 23 ++- 1 file changed, 10 insertions(+), 13

[PATCH v9 06/12] parallels: Move check of unclean image to a separate function

2023-01-31 Thread Alexander Ivanov
We will add more and more checks so we need a better code structure in parallels_co_check. Let each check performs in a separate loop in a separate helper. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/parallels.c | 31

[PATCH v9 09/12] parallels: Move check of leaks to a separate function

2023-01-31 Thread Alexander Ivanov
We will add more and more checks so we need a better code structure in parallels_co_check. Let each check performs in a separate loop in a separate helper. Signed-off-by: Alexander Ivanov --- block/parallels.c | 85 --- 1 file changed, 50 insertions

  1   2   3   4   5   6   >