qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCHv3] block-migration: efficiently encode zero bloc


From: Peter Lieven
Subject: Re: [Qemu-devel] [PATCHv3] block-migration: efficiently encode zero blocks
Date: Thu, 18 Jul 2013 08:02:58 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7

On 18.07.2013 07:03, Stefan Hajnoczi wrote:
On Mon, Jul 15, 2013 at 12:55:05PM +0200, Peter Lieven wrote:
@@ -114,16 +115,29 @@ static void blk_mig_unlock(void)
  static void blk_send(QEMUFile *f, BlkMigBlock * blk)
  {
      int len;
+    uint64_t flags = BLK_MIG_FLAG_DEVICE_BLOCK;
+
+    if (migrate_zero_blocks() && buffer_is_zero(blk->buf, BLOCK_SIZE)) {
[...]
+bool migrate_zero_blocks(void)
+{
+    MigrationState *s;
+
+    s = migrate_get_current();
+
+    return s->enabled_capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS];
+}
blk_send() is called without locks held.  It would be safer and cleaner
to stash bool migrate_zero_blocks in BlkMigBlock in init_blk_migration()
instead of accessing migrate_get_current() without locks held.

This eliminates the assumption that accessing migrate_get_current() is
safe without locks.

Besides this locking issue I'm happy with the code.
Thank you,

I will sent a v4 shortly. I have to rebase it anyway.

Peter




reply via email to

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