aboutsummaryrefslogtreecommitdiff
path: root/block/parallels.c
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2016-05-31 18:35:51 +0200
committerMichael Tokarev <mjt@tls.msk.ru>2016-06-07 18:19:24 +0300
commit969401fe769264239c0f3e928283433b58910a19 (patch)
tree1db12c4697256a1c3c49c0d5fadb0984cfd959a7 /block/parallels.c
parentdb718b4b150dd8a732e2b26368eba510b6887f01 (diff)
parallels: 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/parallels.c')
-rw-r--r--block/parallels.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/parallels.c b/block/parallels.c
index 99fc0f77ef..b9b5c6dc3d 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -204,7 +204,7 @@ static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num,
return -EINVAL;
}
- to_allocate = (sector_num + *pnum + s->tracks - 1) / s->tracks - idx;
+ to_allocate = DIV_ROUND_UP(sector_num + *pnum, s->tracks) - idx;
space = to_allocate * s->tracks;
if (s->data_end + space > bdrv_getlength(bs->file->bs) >> BDRV_SECTOR_BITS) {
int ret;