On Wed, Dec 21, 2011 at 4:00 PM, Stefan Hajnoczi <stefa...@linux.vnet.ibm.com> wrote: > This series adds an interface for efficient writes when data contains all > zeros. It also takes advantage of this new interface by extending the > copy-on-read feature to perform zero-detection. > > The details of efficient zero representations depend on the image format. > This > series includes a patch for the QED image format to write special "zero > clusters" that keep the image file compact. In the future qcow2v3 could also > support an efficient zero representation. > > The new BlockDriver interface is called .bdrv_co_write_zeroes() and is > optional. If the interface is not implemented by a BlockDriver then a regular > .bdrv_co_writev() operation will be performed. The public interface is called > bdrv_co_write_zeroes() and can be tested via the new qemu-io write -z option. > > Copy-on-read is extended to detect zeroes and invoke the > .bdrv_co_write_zeroes() interface when possible. As a result we avoid > bloating > the image file if the backing file contains zeroes. > > My motivation for this feature is efficient image streaming. The destination > file must stay compact even when copying zeroes from the source file. > > We now only do zero detection for copy-on-read requests, whereas previous > revisions of this patch series scanned all write requests for zeroes. The old > behavior wasted CPU cycles in most cases but we could add a feature to > explicitly scan guest writes for zeroes in the future, if desired. > > v2:
Typo: s/v2/v3/ Stefan