On 07/05/2017 07:57 AM, Stefan Hajnoczi wrote: > Use qcow2_calc_prealloc_size() to get the required file size. > > Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com> > Reviewed-by: Alberto Garcia <be...@igalia.com> > ---
> > +static BlockMeasureInfo *qcow2_measure(QemuOpts *opts, BlockDriverState > *in_bs, > + } else { > + int cluster_sectors = cluster_size / BDRV_SECTOR_SIZE; > + int64_t sector_num; > + int pnum = 0; > + > + for (sector_num = 0; > + sector_num < ssize / BDRV_SECTOR_SIZE; > + sector_num += pnum) { > + int nb_sectors = MAX(ssize / BDRV_SECTOR_SIZE - sector_num, > + INT_MAX); > + BlockDriverState *file; > + int64_t ret; > + > + ret = bdrv_get_block_status_above(in_bs, NULL, > + sector_num, nb_sectors, > + &pnum, &file); Oh what fun. More sector-based iteration that I get to convert to byte-based on another respin of my work ;) -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature