From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH v4 0/6] block: zero writes
Date: Wed, 18 Jan 2012 14:59:46 +0000 [thread overview]
Message-ID: <1326898793-20331-1-git-send-email-stefanha@linux.vnet.ibm.com> (raw)
Note: This series has been rebased onto the image streaming series which is
likely to get merged first. There are no significant changes to this series
since v2.
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.
v3:
* Rebased on image streaming series
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 | 67 ++++++++++++++++++++++++++----
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, 303 insertions(+), 73 deletions(-)
--
1.7.8.3
next reply other threads:[~2012-01-18 15:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-18 14:59 Stefan Hajnoczi [this message]
2012-01-18 14:59 ` [Qemu-devel] [PATCH v4 1/6] cutils: extract buffer_is_zero() from qemu-img.c Stefan Hajnoczi
2012-01-24 15:03 ` Kevin Wolf
2012-02-06 15:37 ` Stefan Hajnoczi
2012-01-18 14:59 ` [Qemu-devel] [PATCH v4 2/6] block: add .bdrv_co_write_zeroes() interface Stefan Hajnoczi
2012-01-24 15:16 ` Kevin Wolf
2012-02-06 15:50 ` Stefan Hajnoczi
2012-02-06 16:00 ` Kevin Wolf
2012-02-06 16:16 ` Stefan Hajnoczi
2012-01-18 14:59 ` [Qemu-devel] [PATCH v4 3/6] block: perform zero-detection during copy-on-read Stefan Hajnoczi
2012-01-18 14:59 ` [Qemu-devel] [PATCH v4 4/6] qed: replace is_write with flags field Stefan Hajnoczi
2012-01-18 14:59 ` [Qemu-devel] [PATCH v4 5/6] qed: add .bdrv_co_write_zeroes() support Stefan Hajnoczi
2012-01-18 14:59 ` [Qemu-devel] [PATCH v4 6/6] qemu-io: add write -z option for bdrv_co_write_zeroes Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1326898793-20331-1-git-send-email-stefanha@linux.vnet.ibm.com \
--to=stefanha@linux.vnet.ibm.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).