From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ITfwW-0008Aj-PE for qemu-devel@nongnu.org; Fri, 07 Sep 2007 11:40:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ITfwT-000869-Hk for qemu-devel@nongnu.org; Fri, 07 Sep 2007 11:40:24 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ITfwT-00085z-EJ for qemu-devel@nongnu.org; Fri, 07 Sep 2007 11:40:21 -0400 Received: from wsip-68-15-230-7.om.om.cox.net ([68.15.230.7] helo=hachi.dashjr.org) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1ITfwT-0002PN-67 for qemu-devel@nongnu.org; Fri, 07 Sep 2007 11:40:21 -0400 Received: from [2002:48ce:72ec:0:20d:60ff:fe77:7d85] (yokochan.lan [IPv6:2002:48ce:72ec:0:20d:60ff:fe77:7d85]) (Authenticated sender: luke-jr) by hachi.dashjr.org (Postfix) with ESMTP id 9FA8D960D36 for ; Fri, 7 Sep 2007 15:40:16 +0000 (UTC) From: Luke -Jr Subject: Re: [Qemu-devel] copy on write-but-no-change Date: Fri, 7 Sep 2007 10:40:15 -0500 References: <46E0854D.8000301@lapo.it> In-Reply-To: <46E0854D.8000301@lapo.it> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200709071040.15626.luke@dashjr.org> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Thursday 06 September 2007, Lapo Luchini wrote: > I noticed that cow adds space also if the written data is the same as > the one it was there already. > Is there a reason why checking it would be bad/difficult/slow/other? > Simply no one had the will to code the check? Simply that your operation is not very common, and checking every time would put read overhead on top of write overhead. If you want to check, feel free to check prior to issuing the write. ;) > I ask because for shrinking drives I usually create big zero-filled > files... and this grows the qcow2 image like mad, and only a compressed > convert can properly shrink it back. OK, it is not to be done very very > often, but not copying those writes that don't actually change the data > seems like a good idea... don't know about the speed hit, though. I think it's logical to require an explicit conversion when you want to shrink. > Another idea would be to detect "only zero" write blocks and simply > interpret them as "put a hole in the sparse file" instead of actually > writing data to disk. I don't believe it's possible to make holes in sparse files explicitly. The libc/OS only support it transparently when you jump to the end of a file and begin writing there.