From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39046) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2nLA-0007wn-9W for qemu-devel@nongnu.org; Thu, 03 Jul 2014 16:10:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2nL5-0008EJ-87 for qemu-devel@nongnu.org; Thu, 03 Jul 2014 16:10:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2nL5-0008E3-08 for qemu-devel@nongnu.org; Thu, 03 Jul 2014 16:10:39 -0400 Message-ID: <53B5B8B6.9060400@redhat.com> Date: Thu, 03 Jul 2014 22:10:30 +0200 From: Max Reitz MIME-Version: 1.0 References: <8dacb5b0b38ccb69f64ee08d3a4ba6998b65889d.1404287261.git.hutao@cn.fujitsu.com> In-Reply-To: <8dacb5b0b38ccb69f64ee08d3a4ba6998b65889d.1404287261.git.hutao@cn.fujitsu.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH RFC v11 5/6] raw-posix: Add falloc and full preallocation option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao , Kevin Wolf Cc: Yasunori Goto , qemu-devel@nongnu.org, Stefan Hajnoczi On 02.07.2014 10:17, Hu Tao wrote: > This patch adds a new option preallocation for raw format, and implements > falloc and full preallocation. > > Signed-off-by: Hu Tao > --- > block/raw-posix.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++------- > 1 file changed, 55 insertions(+), 7 deletions(-) > > diff --git a/block/raw-posix.c b/block/raw-posix.c > index 58c51d8..5dcd465 100644 > --- a/block/raw-posix.c > +++ b/block/raw-posix.c > @@ -30,6 +30,7 @@ > #include "block/thread-pool.h" > #include "qemu/iov.h" > #include "raw-aio.h" > +#include "qapi/util.h" > > #if defined(__APPLE__) && (__MACH__) > #include > @@ -1278,28 +1279,70 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp) > int fd; > int result = 0; > int64_t total_size = 0; > + PreallocMode prealloc = PREALLOC_MODE_OFF; > + char *buf = NULL; It's not really necessary to initialize these two here, but it won't hurt either, of course (same thing later with num, which could have even been declared inside of the while loop). Reviewed-by: Max Reitz