From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LKzx2-0003b8-Kl for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:49:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LKzx0-0003ah-SQ for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:49:51 -0500 Received: from [199.232.76.173] (port=52202 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LKzx0-0003ac-OU for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:49:50 -0500 Received: from mx2.redhat.com ([66.187.237.31]:47996) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LKzx0-0007Fa-8H for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:49:50 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n08InncU009377 for ; Thu, 8 Jan 2009 13:49:49 -0500 Message-ID: <49664ACA.9050807@redhat.com> Date: Thu, 08 Jan 2009 20:49:46 +0200 From: Uri Lublin MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH 0/3] info blockstats (block-qcow2): show highest allocated offset (bytes) 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 Cc: Uri Lublin From: Uri Lublin This patchset let the user know the highest allocated byte of qcow2 images. Actually it's the first unallocated byte after the highest byte written, cluster-size aligned. The highest allocated byte gives a maximal limit (easy to calculate) to the number of bytes allocated for that image, and may hint how many more allocations can be done before we reach end-of-file (end of host block device). Although there may be many free blocks below that number (allocated and freed) the file system can not deallocate those blocks, and they have to be reused by qemu. Also note that due to fragmentation those free blocks may not be used on next allocations. It can be useful for truncation of backing file images (ftruncate). Also it may be useful for defragmentation later (although we'll need the number of free blocks as well). The first patch calculates the highest byte for qcow2 images (block-qcow2.c) The second patch exposed it through a BlockDeviceInfo The third patch term_prints it upon info blockstats (for qcow2 images)