Message ID | 3cb91de6ba7069c8a118d59cf8a2c9cdd48085cd.1465112552.git.mjt@msgid.tls.msk.ru (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/block/parallels.c b/block/parallels.c index 99fc0f7..b9b5c6d 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;