diff options
author | Laurent Vivier <lvivier@redhat.com> | 2016-05-31 18:35:52 +0200 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2016-06-07 18:19:24 +0300 |
commit | d737b78cc13d2ab94ffa4478da59931165cb1f4e (patch) | |
tree | 62020c57b1ee6778cbdf9f2b4e7e343e49578c1b /block/qcow.c | |
parent | 969401fe769264239c0f3e928283433b58910a19 (diff) |
qcow/qcow2: Use DIV_ROUND_UP
Replace (((n) + (d) - 1) /(d)) by DIV_ROUND_UP(n,d).
This patch is the result of coccinelle script
scripts/coccinelle/round.cocci
CC: qemu-block@nongnu.org
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'block/qcow.c')
-rw-r--r-- | block/qcow.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/block/qcow.c b/block/qcow.c index cb4bf0299f..c5cf813469 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -868,8 +868,8 @@ static int qcow_create(const char *filename, QemuOpts *opts, Error **errp) } tmp = g_malloc0(BDRV_SECTOR_SIZE); - for (i = 0; i < ((sizeof(uint64_t)*l1_size + BDRV_SECTOR_SIZE - 1)/ - BDRV_SECTOR_SIZE); i++) { + for (i = 0; i < DIV_ROUND_UP(sizeof(uint64_t) * l1_size, BDRV_SECTOR_SIZE); + i++) { ret = blk_pwrite(qcow_blk, header_size + BDRV_SECTOR_SIZE * i, tmp, BDRV_SECTOR_SIZE, 0); if (ret != BDRV_SECTOR_SIZE) { |