From 180e95265e87edcb457a9f92f844e4b08bcc60a0 Mon Sep 17 00:00:00 2001 From: Hu Tao Date: Wed, 10 Sep 2014 17:05:46 +0800 Subject: block: don't convert file size to sector size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and avoid converting it back later. Signed-off-by: Hu Tao Reviewed-by: Max Reitz Reviewed-by: BenoƮt Canet Signed-off-by: Kevin Wolf --- block/gluster.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'block/gluster.c') diff --git a/block/gluster.c b/block/gluster.c index 65c7a58062..1eb3a8c398 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -494,8 +494,8 @@ static int qemu_gluster_create(const char *filename, goto out; } - 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); tmp = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC); if (!tmp || !strcmp(tmp, "off")) { @@ -516,9 +516,8 @@ static int qemu_gluster_create(const char *filename, if (!fd) { ret = -errno; } else { - if (!glfs_ftruncate(fd, total_size * BDRV_SECTOR_SIZE)) { - if (prealloc && qemu_gluster_zerofill(fd, 0, - total_size * BDRV_SECTOR_SIZE)) { + if (!glfs_ftruncate(fd, total_size)) { + if (prealloc && qemu_gluster_zerofill(fd, 0, total_size)) { ret = -errno; } } else { -- cgit v1.2.1