All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 0/6] block: zero writes
@ 2011-12-21 16:00 Stefan Hajnoczi
  2011-12-21 16:00 ` [Qemu-devel] [PATCH v3 1/6] cutils: extract buffer_is_zero() from qemu-img.c Stefan Hajnoczi
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2011-12-21 16:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Marcelo Tosatti, Stefan Hajnoczi

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:
 * Introduce .bdrv_co_write_zeroes() [Kevin]
 * Perform zero detection only on copy-on-read requests [Kevin]

Stefan Hajnoczi (6):
  cutils: extract buffer_is_zero() from qemu-img.c
  block: add .bdrv_co_write_zeroes() interface
  block: perform zero-detection during copy-on-read
  qed: replace is_write with flags field
  qed: add .bdrv_co_write_zeroes() support
  qemu-io: add write -z option for bdrv_co_write_zeroes

 block.c       |   64 +++++++++++++++++++++++++----
 block.h       |    7 +++
 block/qed.c   |  125 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
 block/qed.h   |    7 +++-
 block_int.h   |    8 ++++
 cutils.c      |   34 +++++++++++++++
 qemu-common.h |    2 +
 qemu-img.c    |   46 +++------------------
 qemu-io.c     |   77 +++++++++++++++++++++++++++++++----
 trace-events  |    3 +-
 10 files changed, 300 insertions(+), 73 deletions(-)

-- 
1.7.7.3

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-12-22  9:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-21 16:00 [Qemu-devel] [PATCH v3 0/6] block: zero writes Stefan Hajnoczi
2011-12-21 16:00 ` [Qemu-devel] [PATCH v3 1/6] cutils: extract buffer_is_zero() from qemu-img.c Stefan Hajnoczi
2011-12-21 16:43   ` Eric Blake
2011-12-22  7:47     ` Stefan Hajnoczi
2011-12-21 16:00 ` [Qemu-devel] [PATCH v3 2/6] block: add .bdrv_co_write_zeroes() interface Stefan Hajnoczi
2011-12-21 16:50   ` Christoph Hellwig
2011-12-22  7:54     ` Stefan Hajnoczi
2011-12-21 16:00 ` [Qemu-devel] [PATCH v3 3/6] block: perform zero-detection during copy-on-read Stefan Hajnoczi
2011-12-21 16:00 ` [Qemu-devel] [PATCH v3 4/6] qed: replace is_write with flags field Stefan Hajnoczi
2011-12-21 16:00 ` [Qemu-devel] [PATCH v3 5/6] qed: add .bdrv_co_write_zeroes() support Stefan Hajnoczi
2011-12-21 16:00 ` [Qemu-devel] [PATCH v3 6/6] qemu-io: add write -z option for bdrv_co_write_zeroes Stefan Hajnoczi
2011-12-21 16:03 ` [Qemu-devel] [PATCH v3 0/6] block: zero writes Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.