qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: alexander . ivanov
Subject: [PATCH 2/3] parallels: Let duplicates repairing pass without unwanted messages
Date: Thu, 4 Aug 2022 16:51:59 +0200

From: Alexander Ivanov <alexander.ivanov@virtuozzo.com>

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 <alexander.ivanov@virtuozzo.com>
---
 block/parallels.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/block/parallels.c b/block/parallels.c
index 6a82942f38..1f56ce26e4 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -429,7 +429,7 @@ static int coroutine_fn parallels_co_check(BlockDriverState 
*bs,
     int ret, n;
     uint32_t i, idx_host, *reversed_bat;
     int64_t *cluster_buf;
-    bool flush_bat = false;
+    bool flush_bat = false, truncate_silently = false;
 
     size = bdrv_getlength(bs->file->bs);
     if (size < 0) {
@@ -547,6 +547,7 @@ static int coroutine_fn parallels_co_check(BlockDriverState 
*bs,
 
                 res->corruptions_fixed++;
                 flush_bat = true;
+                truncate_silently = true;
             }
         }
         reversed_bat[idx_host] = i;
@@ -576,10 +577,13 @@ static int coroutine_fn 
parallels_co_check(BlockDriverState *bs,
     if (size > res->image_end_offset) {
         int64_t count;
         count = DIV_ROUND_UP(size - res->image_end_offset, s->cluster_size);
-        fprintf(stderr, "%s space leaked at the end of the image %" PRId64 
"\n",
-                fix & BDRV_FIX_LEAKS ? "Repairing" : "ERROR",
-                size - res->image_end_offset);
-        res->leaks += count;
+        if (!truncate_silently) {
+            fprintf(stderr,
+                    "%s space leaked at the end of the image %" PRId64 "\n",
+                    fix & BDRV_FIX_LEAKS ? "Repairing" : "ERROR",
+                    size - res->image_end_offset);
+            res->leaks += count;
+        }
         if (fix & BDRV_FIX_LEAKS) {
             Error *local_err = NULL;
 
@@ -594,7 +598,10 @@ static int coroutine_fn 
parallels_co_check(BlockDriverState *bs,
                 res->check_errors++;
                 goto out;
             }
-            res->leaks_fixed += count;
+
+            if (!truncate_silently) {
+                res->leaks_fixed += count;
+            }
         }
     }
 
-- 
2.34.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]