Received: from eggs.gnu.org ([2001:4830:134:3::10]:49582) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBOuH-0007bS-No for qemu-devel@nongnu.org; Wed, 14 Jan 2015 09:26:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YBOuE-0004qL-Fe for qemu-devel@nongnu.org; Wed, 14 Jan 2015 09:26:49 -0500 Received: from mx2.parallels.com ([199.115.105.18]:39904) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBOuE-0004qE-Ak for qemu-devel@nongnu.org; Wed, 14 Jan 2015 09:26:46 -0500 Date: Wed, 14 Jan 2015 17:26:19 +0300 From: Roman Kagan Message-ID: <20150114142619.GD27418@rkaganb.sw.ru> References: <1419931701-19362-1-git-send-email-den@openvz.org> <1419934032-24216-1-git-send-email-den@openvz.org> <1419934032-24216-9-git-send-email-den@openvz.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1419934032-24216-9-git-send-email-den@openvz.org> Subject: Re: [Qemu-devel] [PATCH 18/19] block/parallels: add prealloc-mode and prealloc-size open paramemets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi On Tue, Dec 30, 2014 at 01:07:11PM +0300, Denis V. Lunev wrote: > This is preparational commit for tweaks in Parallels image expansion. > The idea is that enlarge via truncate by one data block is slow. It > would be much better to use fallocate via bdrv_write_zeroes and > expand by some significant amount at once. > > This patch just adds proper parameters into BDRVParallelsState and > performs options parsing in parallels_open. > > Signed-off-by: Denis V. Lunev > CC: Kevin Wolf > CC: Stefan Hajnoczi > --- > block/parallels.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 72 insertions(+) > > diff --git a/block/parallels.c b/block/parallels.c > index 18b9267..12a9cea 100644 > --- a/block/parallels.c > +++ b/block/parallels.c > @@ -30,6 +30,7 @@ > #include "qemu-common.h" > #include "block/block_int.h" > #include "qemu/module.h" > +#include "qapi/util.h" > > /**************************************************************/ > > @@ -54,6 +55,20 @@ typedef struct ParallelsHeader { > char padding[12]; > } QEMU_PACKED ParallelsHeader; > > + > +typedef enum ParallelsPreallocMode { > + PRL_PREALLOC_MODE_FALLOCATE = 0, > + PRL_PREALLOC_MODE_TRUNCATE = 1, > + PRL_PREALLOC_MODE_MAX = 2, > +} ParallelsPreallocMode; > + > +static const char *prealloc_mode_lookup[] = { > + "falloc", > + "truncate", > + NULL, There is already generic "preallocaton" option, BLOCK_OPT_PREALLOC, which is handled by qcow2 and raw-posix. It means slightly different thing: the *whole* image is preallocated using the method specified. I think it would make sense to consolidate that option with this new batched allocation in the generic block code. I guess qcow2 and raw-posix would benefit from it, too. At any rate I think it's a matter for a separate patchset. Roman.