From: Eric Blake <eblake@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Maor Lipchuk <mlipchuk@redhat.com>,
Max Reitz <mreitz@redhat.com>, Alberto Garcia <berto@igalia.com>,
John Snow <jsnow@redhat.com>, Nir Soffer <nsoffer@redhat.com>,
"Daniel P. Berrange" <berrange@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v9 6/9] qcow2: add bdrv_measure() support
Date: Tue, 11 Jul 2017 14:04:14 -0500 [thread overview]
Message-ID: <4adda7cf-6f55-c96f-2448-e662f1e7ea72@redhat.com> (raw)
In-Reply-To: <20170705125738.8777-7-stefanha@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1004 bytes --]
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 <stefanha@redhat.com>
> Reviewed-by: Alberto Garcia <berto@igalia.com>
> ---
> + 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);
Shouldn't that be MIN(), not MAX(), in the computation of nb_sectors?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2017-07-11 19:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-05 12:57 [Qemu-devel] [PATCH v9 0/9] qemu-img: add measure sub-command Stefan Hajnoczi
2017-07-05 12:57 ` [Qemu-devel] [PATCH v9 1/9] block: add bdrv_measure() API Stefan Hajnoczi
2017-07-05 12:57 ` [Qemu-devel] [PATCH v9 2/9] raw-format: add bdrv_measure() support Stefan Hajnoczi
2017-07-05 12:57 ` [Qemu-devel] [PATCH v9 3/9] qcow2: extract preallocation calculation function Stefan Hajnoczi
2017-07-05 12:57 ` [Qemu-devel] [PATCH v9 4/9] qcow2: make refcount size calculation conservative Stefan Hajnoczi
2017-07-05 12:57 ` [Qemu-devel] [PATCH v9 5/9] qcow2: extract image creation option parsing Stefan Hajnoczi
2017-07-05 12:57 ` [Qemu-devel] [PATCH v9 6/9] qcow2: add bdrv_measure() support Stefan Hajnoczi
2017-07-11 18:59 ` Eric Blake
2017-07-11 19:04 ` Eric Blake [this message]
2017-07-05 12:57 ` [Qemu-devel] [PATCH v9 7/9] qemu-img: add measure subcommand Stefan Hajnoczi
2017-07-05 12:57 ` [Qemu-devel] [PATCH v9 8/9] qemu-iotests: support per-format golden output files Stefan Hajnoczi
2017-07-05 12:57 ` [Qemu-devel] [PATCH v9 9/9] iotests: add test 178 for qemu-img measure Stefan Hajnoczi
2017-07-09 19:36 ` [Qemu-devel] [PATCH v9 0/9] qemu-img: add measure sub-command Max Reitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4adda7cf-6f55-c96f-2448-e662f1e7ea72@redhat.com \
--to=eblake@redhat.com \
--cc=berrange@redhat.com \
--cc=berto@igalia.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mlipchuk@redhat.com \
--cc=mreitz@redhat.com \
--cc=nsoffer@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).