qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 2/6] block: add .bdrv_co_write_zeroes() interface
Date: Thu, 22 Dec 2011 07:54:43 +0000	[thread overview]
Message-ID: <20111222075443.GB8758@stefanha-thinkpad.localdomain> (raw)
In-Reply-To: <20111221165032.GA27022@lst.de>

On Wed, Dec 21, 2011 at 05:50:32PM +0100, Christoph Hellwig wrote:
> On Wed, Dec 21, 2011 at 04:00:36PM +0000, Stefan Hajnoczi wrote:
> > The ability to zero regions of an image file is a useful primitive for
> > higher-level features such as image streaming or zero write detection.
> > 
> > Image formats may support an optimized metadata representation instead
> > of writing zeroes into the image file.  This allows zero writes to be
> > potentially faster than regular write operations and also preserve
> > sparseness of the image file.
> > 
> > The .bdrv_co_write_zeroes() interface should be implemented by block
> > drivers that wish to provide efficient zeroing.
> > 
> > Note that this operation is different from the discard operation, which
> > may leave the contents of the region indeterminate.  That means
> > discarded blocks are not guaranteed to contain zeroes and may contain
> > junk data instead.
> 
> Most real life discard operations zero the data, and both the ATA and SCSI
> spec allow the device to set a bit which gurantees this behaviour.  I think
> we also should make these one interface, and if the caller needs it to
> actually zero out the discarded blocks it should check if the discard
> implementation guarantees that.

Okay, I see how that could work but still need to look into the details
of how to combine the two and check the zero/indeterminate bit coming
from ATA/SCSI.

Stefan

  reply	other threads:[~2011-12-22  9:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=20111222075443.GB8758@stefanha-thinkpad.localdomain \
    --to=stefanha@linux.vnet.ibm.com \
    --cc=hch@lst.de \
    --cc=kwolf@redhat.com \
    --cc=mtosatti@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).