From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37673) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPm5g-0004Sr-8V for qemu-devel@nongnu.org; Wed, 20 Jul 2016 03:38:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPm5e-0000RP-6w for qemu-devel@nongnu.org; Wed, 20 Jul 2016 03:38:47 -0400 Date: Wed, 20 Jul 2016 15:38:36 +0800 From: Fam Zheng Message-ID: <20160720073836.GF10539@ad.usersys.redhat.com> References: <1468901281-22858-1-git-send-email-eblake@redhat.com> <1468901281-22858-14-git-send-email-eblake@redhat.com> <20160719062131.GG18103@ad.usersys.redhat.com> <578E4708.5080308@redhat.com> <20160720033402.GA7641@ad.usersys.redhat.com> <578EF446.70202@redhat.com> <20160720043709.GA10539@ad.usersys.redhat.com> <913397c9-6edc-2561-3d2e-e32032f9db22@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <913397c9-6edc-2561-3d2e-e32032f9db22@redhat.com> Subject: Re: [Qemu-devel] [PATCH v5 13/14] nbd: Implement NBD_CMD_WRITE_ZEROES on server List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Eric Blake , Kevin Wolf , "nbd-general@lists.sourceforge.net" , qemu-block@nongnu.org, qemu-devel@nongnu.org, Max Reitz On Wed, 07/20 09:09, Paolo Bonzini wrote: > > > On 20/07/2016 06:37, Fam Zheng wrote: > > Yes, you are right about this, I was confused because "qemu-img map" does not > > report this allocation state after zero write. (No idea why SEEK_DATA doesn't > > hit the fallocate'ed area.) > > Apparently it's because it's zeroed. > > $ fallocate -z -o 10485760 -l 10485760 test > $ fallocate -p -o 49152000 -l 10485760 test > $ fallocate -o 49152000 -l 10485760 test > $ fallocate -p -o 65536000 -l 10485760 test > > Now we have: > > - a zero area at 10240K..20480K > > - an hole+allocated area at 48000K..59240K > > - a hole at 64000K..74240K > > $ qemu-img map test > Offset Length Mapped to File > 0 0xa00000 0 test << ends at 10240K > 0x1400000 0x1ae0000 0x1400000 test << ends at 48000K > 0x38e0000 0x5a0000 0x38e0000 test << ends at 64000K > 0x4880000 0x1b80000 0x4880000 test Hah? I'm apparently missing something. I can't see these entries: > fam@ad:/var/tmp$ cat /tmp/sh > touch test > fallocate -z -o 10485760 -l 10485760 test > fallocate -p -o 49152000 -l 10485760 test > fallocate -o 49152000 -l 10485760 test > fallocate -p -o 65536000 -l 10485760 test > qemu-img map test > fam@ad:/var/tmp$ sh /tmp/sh > Offset Length Mapped to File (I'm using Fedora 24 but I've also tried RHEL 7.) Fam > > So "qemu-img map" hides both zeroed and hole areas. With the JSON format > we get more information: > > $ qemu-img map --output=json test > [{ "start": 0, "length": 10485760, "depth": 0, "zero": false, "data": true, "offset": 0}, > { "start": 10485760, "length": 10485760, "depth": 0, "zero": true, "data": false, "offset": 10485760}, > { "start": 20971520, "length": 28180480, "depth": 0, "zero": false, "data": true, "offset": 20971520}, > { "start": 49152000, "length": 10485760, "depth": 0, "zero": true, "data": false, "offset": 49152000}, > { "start": 59637760, "length": 5898240, "depth": 0, "zero": false, "data": true, "offset": 59637760}, > { "start": 65536000, "length": 10485760, "depth": 0, "zero": true, "data": false, "offset": 65536000}, > { "start": 76021760, "length": 28835840, "depth": 0, "zero": false, "data": true, "offset": 76021760}] > > Both zeroed and holes are reported as "zero": true, "data": false. This > limitation stems from the fact that we cannot use FIEMAP. > > Paolo