From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OA5S2-0000Gd-7G for qemu-devel@nongnu.org; Thu, 06 May 2010 14:05:34 -0400 Received: from [140.186.70.92] (port=38070 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OA5S0-0000FM-78 for qemu-devel@nongnu.org; Thu, 06 May 2010 14:05:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OA5Rr-00034A-2l for qemu-devel@nongnu.org; Thu, 06 May 2010 14:05:29 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:49571) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OA5Rq-00033e-L7 for qemu-devel@nongnu.org; Thu, 06 May 2010 14:05:23 -0400 Message-ID: <4BE304DE.3060200@mail.berlios.de> Date: Thu, 06 May 2010 20:05:18 +0200 From: Stefan Weil MIME-Version: 1.0 References: <1273150559-1587-1-git-send-email-kwolf@redhat.com> In-Reply-To: <1273150559-1587-1-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] vdi: Fix image creation List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org Am 06.05.2010 14:55, schrieb Kevin Wolf: > The number of blocks needs to be rounded up to cover all of the > virtual hard > disk. Without this fix, we can't even open our own images if their > size is not > a multiple of the block size. > > Signed-off-by: Kevin Wolf > --- > block/vdi.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/block/vdi.c b/block/vdi.c > index 2b4d2c2..b990bbc 100644 > --- a/block/vdi.c > +++ b/block/vdi.c > @@ -827,7 +827,7 @@ static int vdi_create(const char *filename, > QEMUOptionParameter *options) > return -errno; > } > > - blocks = bytes / block_size; > + blocks = (bytes + block_size - 1) / block_size; > bmap_size = blocks * sizeof(uint32_t); > bmap_size = ((bmap_size + SECTOR_SIZE - 1) & ~(SECTOR_SIZE -1)); > 'bytes' (for header.disk_size) must be fixed, too, and so does vdi_open. I'll send a patch which hopefully addresses all these points. Thanks + kind regards, Stefan