From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHX0K-0004P2-B0 for qemu-devel@nongnu.org; Mon, 18 Mar 2013 06:09:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UHX0E-0005pB-45 for qemu-devel@nongnu.org; Mon, 18 Mar 2013 06:09:20 -0400 Received: from mail-wi0-x22c.google.com ([2a00:1450:400c:c05::22c]:60344) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHX0D-0005p2-U1 for qemu-devel@nongnu.org; Mon, 18 Mar 2013 06:09:14 -0400 Received: by mail-wi0-f172.google.com with SMTP id ez12so2404264wid.11 for ; Mon, 18 Mar 2013 03:09:13 -0700 (PDT) Date: Mon, 18 Mar 2013 11:09:10 +0100 From: Stefan Hajnoczi Message-ID: <20130318100910.GB11058@stefanha-thinkpad.redhat.com> References: <5142CCB6.7000004@linux.vnet.ibm.com> <20130315145100.GA17187@stefanha-thinkpad.redhat.com> <5146B6F2.3030004@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5146B6F2.3030004@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [RFC] qmp interface for save vmstate to image List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: Kevin Wolf , Juan Quintela , qemu-devel , Paolo Bonzini , Dietmar Maurer 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