Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Llzu9-0004SE-0F for qemu-devel@nongnu.org; Tue, 24 Mar 2009 02:14:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Llzu4-0004S0-Cs for qemu-devel@nongnu.org; Tue, 24 Mar 2009 02:14:28 -0400 Received: from [199.232.76.173] (port=52973 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Llzu4-0004Rx-8G for qemu-devel@nongnu.org; Tue, 24 Mar 2009 02:14:24 -0400 Received: from rv-out-0708.google.com ([209.85.198.243]:6773) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Llzu3-0001sh-V0 for qemu-devel@nongnu.org; Tue, 24 Mar 2009 02:14:24 -0400 Received: by rv-out-0708.google.com with SMTP id l33so1925964rvb.22 for ; Mon, 23 Mar 2009 23:14:21 -0700 (PDT) MIME-Version: 1.0 Date: Mon, 23 Mar 2009 23:14:20 -0700 Message-ID: From: Marc Bevand Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Using the ATA "trim" command to discard sectors in disk images 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 The ATA command "trim", recently standardized by the T13 committee, has been designed to allow SSDs to do better wear-leveling. But there is an obvious fit for it in virtualizers such as Qemu: guests issuing trim commands would allow the host to deallocate block sectors in disk images. In fact the trim command is already used by very recent Linux kernels: it is exported to the kernel via the block layer blkdev_issue_discard() call, and to userspace via the BLKDISCARD ioctl: http://lwn.net/Articles/293658/ Swap allocation just started making use of it 2.6.29: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7992fde72ce06c73280a1939b7a1e903bc95ef85 I just wanted to raise awareness of that command. I hope sometime in the future we will see qcow files able to decrease in size when files are deleted in guests :-) -marc