qemu-block
[Top][All Lists]
Advanced

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

[Qemu-block] bitmaps branch conflict resolution


From: John Snow
Subject: [Qemu-block] bitmaps branch conflict resolution
Date: Fri, 16 Aug 2019 18:07:00 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

Hi Max, I took your patch and adjusted it slightly: I don't like
"skip_bytes" anymore because it's clear now that we don't only read that
value when we're skipping bytes, so now it's just status_bytes.

Since this is based on your fixup, would you like to offer an
Ack/S-o-b/R-B/whichever here?

--js

diff --git a/block/backup.c b/block/backup.c
index ee4d5598986..9e1382ec5c6 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -266,7 +266,7 @@ static int coroutine_fn backup_do_cow(BackupBlockJob
*job,
     int ret = 0;
     int64_t start, end; /* bytes */
     void *bounce_buffer = NULL;
-    int64_t skip_bytes;
+    int64_t status_bytes;

     qemu_co_rwlock_rdlock(&job->flush_rwlock);

@@ -287,21 +287,23 @@ static int coroutine_fn
backup_do_cow(BackupBlockJob *job,
             continue; /* already copied */
         }

-        if (job->initializing_bitmap) {
-            ret = backup_bitmap_reset_unallocated(job, start, &skip_bytes);
-            if (ret == 0) {
-                trace_backup_do_cow_skip_range(job, start, skip_bytes);
-                start += skip_bytes;
-                continue;
-            }
-        }
-
         dirty_end = bdrv_dirty_bitmap_next_zero(job->copy_bitmap, start,
                                                 (end - start));
         if (dirty_end < 0) {
             dirty_end = end;
         }

+        if (job->initializing_bitmap) {
+            ret = backup_bitmap_reset_unallocated(job, start,
&status_bytes);
+            if (ret == 0) {
+                trace_backup_do_cow_skip_range(job, start, status_bytes);
+                start += status_bytes;
+                continue;
+            }
+            /* Clamp to known allocated region */
+            dirty_end = MIN(dirty_end, start + status_bytes);
+        }
+
         trace_backup_do_cow_process(job, start);

         if (job->use_copy_range) {



reply via email to

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