Blob Blame History Raw
From 10ca280bce2cbc5b6e4300c2a64bc86be4757f5a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 30 Jul 2021 10:47:29 +0100
Subject: [PATCH] copy: Fix progress bar

In multi-thread mode we were using the wrong size (the destination,
not the source) to calculate the percent copied.  When copying from a
small disk to a large disk, even though we only copy the length of the
small disk, the percentage would stay at 0%.

Fixes virt-v2v -o null (which uses a max-sized nbdkit null instance as
the destination).

(cherry picked from commit 76bf210cea8a2bc6d9d463c1589b81dcaa049923)
---
 copy/multi-thread-copying.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/copy/multi-thread-copying.c b/copy/multi-thread-copying.c
index c649d2b..4603d8f 100644
--- a/copy/multi-thread-copying.c
+++ b/copy/multi-thread-copying.c
@@ -70,7 +70,7 @@ get_next_offset (uint64_t *offset, uint64_t *count)
      * are called from threads and not necessarily in monotonic order
      * so the progress bar would move erratically.
      */
-    progress_bar (*offset, dst->size);
+    progress_bar (*offset, src->size);
   }
   pthread_mutex_unlock (&lock);
   return r;
-- 
2.31.1