summaryrefslogtreecommitdiff
path: root/block/gluster.c
diff options
context:
space:
mode:
authorHu Tao <hutao@cn.fujitsu.com>2014-09-10 17:05:46 +0800
committerKevin Wolf <kwolf@redhat.com>2014-09-12 15:43:06 +0200
commit180e95265e87edcb457a9f92f844e4b08bcc60a0 (patch)
tree00b1a59d793d8fa425bcb09dccec2ffcaaba8b9a /block/gluster.c
parentc2eb918e3299f930fd0d0ae48d002cf2599de250 (diff)
downloadqemu-180e95265e87edcb457a9f92f844e4b08bcc60a0.tar.gz
block: don't convert file size to sector size
and avoid converting it back later. Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: BenoƮt Canet <benoit.canet@nodalink.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/gluster.c')
-rw-r--r--block/gluster.c9
1 files changed, 4 insertions, 5 deletions
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 {