qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 2/3] parallels: Let duplicates repairing pass without unwante


From: Denis V. Lunev
Subject: Re: [PATCH 2/3] parallels: Let duplicates repairing pass without unwanted messages
Date: Thu, 4 Aug 2022 17:22:01 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

On 04.08.2022 16:51, alexander.ivanov@virtuozzo.com wrote:
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;
+            }
          }
      }
This looks a little bit cumbersome. Yes, we need to make a check that we do not have leaked at the end space, but it would be beneficial to make this check before we
have written to the image, in the other case we will lose that information.



reply via email to

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