From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtwEt-0006h5-B1 for qemu-devel@nongnu.org; Tue, 02 Jul 2013 04:47:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtwEq-0006Em-R4 for qemu-devel@nongnu.org; Tue, 02 Jul 2013 04:47:07 -0400 Received: from mail-wg0-x236.google.com ([2a00:1450:400c:c00::236]:37632) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtwEq-0006EX-LA for qemu-devel@nongnu.org; Tue, 02 Jul 2013 04:47:04 -0400 Received: by mail-wg0-f54.google.com with SMTP id n11so4644556wgh.9 for ; Tue, 02 Jul 2013 01:47:03 -0700 (PDT) Date: Tue, 2 Jul 2013 10:47:00 +0200 From: Stefan Hajnoczi Message-ID: <20130702084700.GA8393@stefanha-thinkpad.redhat.com> References: <51C2C465.1090701@linux.vnet.ibm.com> <20130625091300.GA26177@stefanha-thinkpad.redhat.com> <51C97B8B.2010304@linux.vnet.ibm.com> <20130627090139.GC14351@stefanha-thinkpad.redhat.com> <51CC304C.80706@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: <51CC304C.80706@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [RFC] qemu-img: add option -d in convert List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: Kevin Wolf , Anthony Liguori , qemu-devel , Paolo Bonzini , Dietmar Maurer On Thu, Jun 27, 2013 at 08:30:04PM +0800, Wenchao Xia wrote: > 于 2013-6-27 17:01, Stefan Hajnoczi 写道: > >On Tue, Jun 25, 2013 at 07:14:19PM +0800, Wenchao Xia wrote: > >>于 2013-6-25 17:13, Stefan Hajnoczi 写道: > >>>On Thu, Jun 20, 2013 at 04:59:17PM +0800, Wenchao Xia wrote: > >BTW we already have qemu-io -c map which prints out allocation > >information for an image file. If that command is extended to support > >-s then you can get your info easily. > Do you mean use it like: > 1 call qemu-io file -c map -s sn0 > 2 call qemu-io file -c map -s sn1 > 3 for (offset = 0; offset < len; offset +=512) { > if (allocated on sn0) { > call qemu-io file read -s sn0, into buf0 > } > if (allocated on sn1) { > call qemu-io file read -s sn1, into buf1 > } > if strcmp(buf0, buf1) { > write down the delta > } > } > ? > I think it is workable and flex, the bottle neck is the string > parsing of qemu-io. For delta data info retrieving purpose, qemu-img > approach would faster. It's also possible to put Step 3 into qemu-img so that this feature is fast and easy to use with a single command. Stefan