Received: from eggs.gnu.org ([2001:4830:134:3::10]:54602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPTnv-0005ui-4X for qemu-devel@nongnu.org; Thu, 04 Sep 2014 05:58:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPTnq-00059h-IB for qemu-devel@nongnu.org; Thu, 04 Sep 2014 05:58:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21800) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPTnq-00059c-9C for qemu-devel@nongnu.org; Thu, 04 Sep 2014 05:58:06 -0400 Date: Thu, 4 Sep 2014 11:57:58 +0200 From: Kevin Wolf Message-ID: <20140904095758.GE3897@noname.str.redhat.com> References: <8ede940b52752c303f16f95b772b6e7ea888060e.1409299732.git.hutao@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8ede940b52752c303f16f95b772b6e7ea888060e.1409299732.git.hutao@cn.fujitsu.com> Subject: Re: [Qemu-devel] [PATCH v13 2/6] block: don't convert file size to sector size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao Cc: Fam Zheng , "Richard W.M. Jones" , qemu-devel@nongnu.org, Max Reitz , Stefan Hajnoczi , Yasunori Goto Am 29.08.2014 um 10:33 hat Hu Tao geschrieben: > and avoid converting it back later. > > Signed-off-by: Hu Tao > diff --git a/block/raw-posix.c b/block/raw-posix.c > index 9c22e3f..abe0759 100644 > --- a/block/raw-posix.c > +++ b/block/raw-posix.c > @@ -1369,8 +1369,8 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp) > strstart(filename, "file:", &filename); > > /* Read out options */ > - total_size = DIV_ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0), > - BDRV_SECTOR_SIZE); > + total_size = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0), > + BDRV_SECTOR_SIZE); > nocow = qemu_opt_get_bool(opts, BLOCK_OPT_NOCOW, false); > > fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, > @@ -1394,7 +1394,7 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp) > #endif > } > > - if (ftruncate(fd, total_size * BDRV_SECTOR_SIZE) != 0) { > + if (ftruncate(fd, total_size) != 0) { > result = -errno; > error_setg_errno(errp, -result, "Could not resize file"); > } You forgot changing hdev_create() in raw-posix. Doesn't make the patch less correct, but you may want to add it for v14. Kevin