On 25/11/2015 08:39, Fam Zheng wrote: > */ > - if (next && > - (next->flags & (BDRV_BLOCK_DATA|BDRV_BLOCK_ZERO)) != > BDRV_BLOCK_DATA) { > - next->flags &= ~BDRV_BLOCK_DATA; > - next->flags |= BDRV_BLOCK_ZERO; > + if (next && !next->data) { > + next->zero = true;
before after 0 ZERO ZERO DATA DATA DATA DATA|ZERO ZERO DATA|ZERO ZERO ZERO ZERO This would not coalesce 0 with DATA|ZERO. I think you need to do exactly as in the older code: test (!next->data || next->zero), and clear next->data. Paolo