On Mon, Mar 18, 2013 at 02:40:50PM +0800, Wenchao Xia wrote:
> 于 2013-3-15 22:51, Stefan Hajnoczi 写道:
> > On Fri, Mar 15, 2013 at 03:24:38PM +0800, Wenchao Xia wrote:
> >>    I'd like to add a new way to save vmstate, which will based on the
> >> migration thread, but will write contents to block images, instead
> >> of fd as stream. Following is the method to add API:
> > 
> > Hi Wenchao,
> > What use cases are there besides saving vmstate to a raw image?
> > 
> > I'm curious if you're proposing this since there is no "file:" URI or
> > because you really want to do things like saving vmstate into a qcow2
> > file or over NBD.
> > 
> > Stefan
> > 
> Hi, Stefan
>   Most used cases would be "raw" and "qcow2", which is flex and can be
> chosen by user. In this way, existing block layer feature in qemu can
> be used, such as tagging zeros. I haven't check the buffer/cache status
> in qemu block layer, but if there is, it can also benefit.

Okay, thanks for explaining.

You can use caching with the BDRV_O_CACHE_WB option.  Then you need to
call bdrv_co_flush() to ensure data reaches the disk.  The advantage of
caching is that I/O patterns with many small unaligned writes may be
much faster when going through the host's page cache - and reads can
also be faster.

You can bypass the host page cache with BDRV_O_CACHE_WB | BDRV_NO_CACHE.
Here bdrv_co_flush() calls are still necessary to ensure data reaches
the disk.

Stefan

Reply via email to