qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Detect zero writes (for discussion only, not to be applied)
@ 2012-07-26 15:59 Richard W.M. Jones
  2012-07-26 15:59 ` [Qemu-devel] [PATCH] block: Add -drive detect_zero=on|off option to detect all zero writes Richard W.M. Jones
  2012-07-27 13:55 ` [Qemu-devel] [PATCH] Detect zero writes (for discussion only, not to be applied) Anthony Liguori
  0 siblings, 2 replies; 12+ messages in thread
From: Richard W.M. Jones @ 2012-07-26 15:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf

[Applies against qemu 1.1.0, not HEAD, because qemu from git seems to
be broken at the moment.  But the patch is easy to rebase.]

This patch adds a -drive detect_zero=on|off flag (defaults to "off").

Setting this on causes the write path to detect all zero byte writes
and, for block device drivers which support this, turn the request
into the more space-efficient bdrv_co_do_write_zeroes call.

The use case is for virt-sparsify.  We want to create an intermediate
qcow2 overlay file which we know will mostly contain zeroes, and we
want qcow2 to handle this without creating a huge empty file.  In my
testing, the size of the intermediate file is reduced considerably
(down to about 1/4 of the original size), making sparsification of
large mostly-empty guests possible for the first time.

The implementation is very simple-minded.  It tests if the entire
request is all zero bytes or not.  A better implementation would
almost certainly be even more space-efficient, but at the cost of
splitting some write requests (if that's a problem).

Testing: I booted and tested an F16 guest with this patch and the
setting "on", without problems.  I also modified libguestfs to add
this flag, then ran the whole libguestfs test suite with no reported
problems.

Rich.

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

end of thread, other threads:[~2012-07-30 15:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-26 15:59 [Qemu-devel] [PATCH] Detect zero writes (for discussion only, not to be applied) Richard W.M. Jones
2012-07-26 15:59 ` [Qemu-devel] [PATCH] block: Add -drive detect_zero=on|off option to detect all zero writes Richard W.M. Jones
2012-07-27 13:58   ` Anthony Liguori
2012-07-27 19:01     ` Paolo Bonzini
2012-07-30 13:51       ` Richard W.M. Jones
2012-07-30 13:57         ` Paolo Bonzini
2012-07-30 14:03           ` Eric Blake
2012-07-30 14:09             ` Paolo Bonzini
2012-07-30 14:38               ` Kevin Wolf
2012-07-30 15:52                 ` Richard W.M. Jones
2012-07-27 13:55 ` [Qemu-devel] [PATCH] Detect zero writes (for discussion only, not to be applied) Anthony Liguori
2012-07-27 15:14   ` Richard W.M. Jones

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).