From: Paolo Bonzini <pbonzini@redhat.com>
To: Gonglei <arei.gonglei@huawei.com>, Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3] virtio-blk: trivial code optimization
Date: Tue, 10 Nov 2015 10:51:54 +0100 [thread overview]
Message-ID: <5641BE3A.4020504@redhat.com> (raw)
In-Reply-To: <56419027.8090509@huawei.com>
On 10/11/2015 07:35, Gonglei wrote:
>> > nb_sectors - int
>> > max_xfer_len - int
>> > req->qiov.size - size_t
>> > BDRV_SECTOR_SIZE - unsigned long long
>> >
>> > Therefore this expression is an int > unsigned long long comparison.
>> >
> Sorry, I'm confused.
> max_xfer_len is int,
> "req->qiov.size / BDRV_SECTOR_SIZE" is unsigned long long,
> so, "max_xfer_len - req->qiov.size / BDRV_SECTOR_SIZE" will be int,
No, the result will be unsigned long long, and the comparison is wrong
if max_xfer_len < req->qiov.size / BDRV_SECTOR_SIZE.
Paolo
> and nb_sectors is int too, so this comparison is right. Am I wrong?
>
next prev parent reply other threads:[~2015-11-10 9:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-09 9:03 [Qemu-devel] [PATCH v3] virtio-blk: trivial code optimization arei.gonglei
2015-11-09 13:28 ` Paolo Bonzini
2015-11-09 13:57 ` Stefan Hajnoczi
2015-11-10 6:35 ` Gonglei
2015-11-10 9:51 ` Paolo Bonzini [this message]
2015-11-10 9:56 ` Stefan Hajnoczi
2015-11-11 1:53 ` Gonglei
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=5641BE3A.4020504@redhat.com \
--to=pbonzini@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=qemu-block@nongnu.org \
--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).