[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCHv3] block-migration: efficiently encode zero bloc
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCHv3] block-migration: efficiently encode zero blocks |
Date: |
Thu, 18 Jul 2013 13:03:30 +0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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.
Stefan