diff options
Diffstat (limited to 'block/raw-posix.c')
-rw-r--r-- | block/raw-posix.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/block/raw-posix.c b/block/raw-posix.c index d737f3a0c5..9c22e3f45d 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 = - qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0) / BDRV_SECTOR_SIZE; + total_size = DIV_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, @@ -1966,8 +1966,8 @@ static int hdev_create(const char *filename, QemuOpts *opts, (void)has_prefix; /* Read out options */ - total_size = - qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0) / BDRV_SECTOR_SIZE; + total_size = DIV_ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0), + BDRV_SECTOR_SIZE); fd = qemu_open(filename, O_WRONLY | O_BINARY); if (fd < 0) { |