From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCq4Z-0005m1-SG for qemu-devel@nongnu.org; Sun, 09 Oct 2011 05:53:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RCq4Y-0005Qk-8L for qemu-devel@nongnu.org; Sun, 09 Oct 2011 05:53:31 -0400 Received: from e28smtp07.in.ibm.com ([122.248.162.7]:50432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCq4X-0005K9-Bq for qemu-devel@nongnu.org; Sun, 09 Oct 2011 05:53:30 -0400 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by e28smtp07.in.ibm.com (8.14.4/8.13.1) with ESMTP id p999rKnP002561 for ; Sun, 9 Oct 2011 15:23:20 +0530 Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p999rJke4157546 for ; Sun, 9 Oct 2011 15:23:20 +0530 Received: from d28av05.in.ibm.com (loopback [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p999rJMu026432 for ; Sun, 9 Oct 2011 20:53:19 +1100 Message-ID: <4E916EDE.1010601@linux.vnet.ibm.com> Date: Sun, 09 Oct 2011 17:52:30 +0800 From: "Mars.cao" MIME-Version: 1.0 References: <1318002589-11315-1-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1318002589-11315-1-git-send-email-stefanha@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 0/3] block: zero write detection List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Marcelo Tosatti , qemu-devel@nongnu.org On 10/07/2011 11:49 PM, Stefan Hajnoczi wrote: > Image streaming copies data from the backing file into the image file. It is > important to represent zero regions from the backing file efficiently during > streaming, otherwise the image file grows to the full virtual disk size and > loses sparseness. > > There are two ways to implement zero write detection, they are subtly different: > > 1. Allow image formats to provide efficient representations for zero regions. > QED does this with "zero clusters" and it has been discussed for qcow2v3. > > 2. During streaming, check for zeroes and skip writing to the image file when > zeroes are detected. > > However, there are some disadvantages to #2 because it leaves unallocated holes > in the image file. If image streaming is aborted before it completes then it > will be necessary to reread all unallocated clusters from the backing file upon > resuming image streaming. Potentionally worse is that a backing file over a > slow remote connection will have the zero regions fetched again and again if > the guest accesses them. #1 avoids these problems because the image file > contains information on which regions are zeroes and do not need to be > refetched. > > This patch series implements #1 with the existing QED zero cluster feature. In > the future we can add qcow2v3 zero clusters too. We can also implement #2 > directly in the image streaming code as a fallback when the BlockDriver does > not support zero detection #1 itself. That way we get the best possible zero > write detection, depending on the image format. > > Here is a qemu-iotest to verify that zero write detection is working: > http://repo.or.cz/w/qemu-iotests/stefanha.git/commitdiff/226949695eef51bdcdea3e6ce3d7e5a863427f37 > > Stefan Hajnoczi (3): > block: add zero write detection interface > qed: add zero write detection support > qemu-io: add zero write detection option > > block.c | 16 +++++++++++ > block.h | 2 + > block/qed.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++------ > block_int.h | 13 +++++++++ > qemu-io.c | 35 ++++++++++++++++++++----- > 5 files changed, 132 insertions(+), 15 deletions(-) > I tested the patch by qemu-iotest 029 test case and also by manually, it worked as expected. Tested-by: Cao,Bing Bu