From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] docs/qcow2: Correct refcount_block_entries
Date: Tue, 02 Sep 2014 13:33:47 -0600 [thread overview]
Message-ID: <54061B9B.6020608@redhat.com> (raw)
In-Reply-To: <540613AB.1080305@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 992 bytes --]
On 09/02/2014 12:59 PM, Max Reitz wrote:
>> Consider refcount_order == 0 (that is, no shared blocks, ALL blocks have
>> at most refcount 1). Then, refcount_bits is (1 << 0) == 1. But 1/8 in
>> integer math truncates to 0 (oops, division by zero is undefined); when
>> in reality, the expression you want here is (cluster_size * 8 /
>> refcount_bits).
>
> If it is integer division, that is. ;-)
>
> I'm counting on you accepting "cluster_size * 8 / refcount_bits" and not
> rejecting it because of a possible integer overflow. *g*
We already document that qemu's maximum cluster size is 2M; and 2M*8 is
less than 32 bits :)
Maybe the qcow2 spec allows the theoretical file with a cluster size of
512M, where overflow then matters. But you are correct that I won't
reject your patch, given that qemu doesn't parse all possible
theoretical qcow2 files :)
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]
next prev parent reply other threads:[~2014-09-02 19:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-29 21:45 [Qemu-devel] [PATCH 0/2] qcow2: Drop REFCOUNT_SHIFT Max Reitz
2014-08-29 21:45 ` [Qemu-devel] [PATCH 1/2] " Max Reitz
2014-08-29 23:06 ` Eric Blake
2014-09-01 11:17 ` Benoît Canet
2014-08-29 21:45 ` [Qemu-devel] [PATCH 2/2] docs/qcow2: Correct refcount_block_entries Max Reitz
2014-08-29 22:37 ` Eric Blake
2014-09-02 18:59 ` Max Reitz
2014-09-02 19:33 ` Eric Blake [this message]
2014-09-01 10:55 ` Benoît Canet
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=54061B9B.6020608@redhat.com \
--to=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@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).