From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53244) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoW2R-0002bH-SM for qemu-devel@nongnu.org; Wed, 12 Nov 2014 06:24:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XoW2K-0005Na-Q9 for qemu-devel@nongnu.org; Wed, 12 Nov 2014 06:24:39 -0500 Received: from relay.parallels.com ([195.214.232.42]:45626) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoW2K-0005GI-JM for qemu-devel@nongnu.org; Wed, 12 Nov 2014 06:24:32 -0500 Message-ID: <54634337.9030707@parallels.com> Date: Wed, 12 Nov 2014 14:23:35 +0300 From: Vladimir Sementsov-Ogievskiy MIME-Version: 1.0 References: 1414639364-4499-8-git-send-email-famz@redhat.com Content-Type: multipart/alternative; boundary="------------050602050604020305030807" Subject: Re: [Qemu-devel] [PATCH v6 07/10] qmp: Add support of "dirty-bitmap" sync mode for drive-backup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: famz@redhat.com Cc: Kevin Wolf , Benoit Canet , John Snow , Markus Armbruster , qemu-devel@nongnu.org, Max Reitz , Stefan Hajnoczi , Jd , Paolo Bonzini , Luiz Capitulino --------------050602050604020305030807 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit > @@ -317,7 +321,21 @@ static void coroutine_fn backup_run(void *opaque) > if (alloced == 0) { > continue; > } > + } else if (job->sync_mode == MIRROR_SYNC_MODE_DIRTY_BITMAP) { > + int i, dirty = 0; > + for (i = 0; i < BACKUP_SECTORS_PER_CLUSTER; > + i += job->sync_bitmap_gran) { > + if (bdrv_get_dirty(bs, job->sync_bitmap, > + start * BACKUP_SECTORS_PER_CLUSTER + i)) { > + dirty = 1; > + break; > + } > + } > + if (!dirty) { > + continue; > + } > } > + With such solution we don't use the power of HBitmap, which provides "hbitmap_iter_skip_words", with O(log(n)) complexity. Here we look through the whole bitmap (O(n)), instead of jumping to the next dirty bit. -- С уважением, Владимир --------------050602050604020305030807 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: 8bit
@@ -317,7 +321,21 @@ static void coroutine_fn backup_run(void *opaque)
                 if (alloced == 0) {
                     continue;
                 }
+            } else if (job->sync_mode == MIRROR_SYNC_MODE_DIRTY_BITMAP) {
+                int i, dirty = 0;
+                for (i = 0; i < BACKUP_SECTORS_PER_CLUSTER;
+                     i += job->sync_bitmap_gran) {
+                    if (bdrv_get_dirty(bs, job->sync_bitmap,
+                            start * BACKUP_SECTORS_PER_CLUSTER + i)) {
+                        dirty = 1;
+                        break;
+                    }
+                }
+                if (!dirty) {
+                    continue;
+                }
             }
+
With such solution we don't use the power of HBitmap, which provides "hbitmap_iter_skip_words", with O(log(n)) complexity. Here we look through the whole bitmap (O(n)), instead of jumping to the next dirty bit.
-- 
С уважением,
Владимир
--------------050602050604020305030807--