From: Stefan Hajnoczi <stefanha@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qemu-io: Fix 'map' output
Date: Thu, 16 May 2013 11:14:21 +0200 [thread overview]
Message-ID: <20130516091421.GJ1597@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1368618432-4431-1-git-send-email-kwolf@redhat.com>
On Wed, May 15, 2013 at 01:47:12PM +0200, Kevin Wolf wrote:
> +static int map_is_allocated(int64_t sector_num, int64_t nb_sectors, int64_t *pnum)
> +{
> + int num, num_checked;
> + int ret, firstret;
> +
> + num_checked = MIN(nb_sectors, INT_MAX);
> + ret = bdrv_is_allocated(bs, sector_num, num_checked, &num);
> + if (ret < 0) {
> + return ret;
> + }
> +
> + firstret = ret;
> + *pnum = num;
> +
> + while (nb_sectors > 0 && ret == firstret) {
> + sector_num += num;
> + nb_sectors -= num;
> +
> + num_checked = MIN(nb_sectors, INT_MAX);
> + ret = bdrv_is_allocated(bs, sector_num, num_checked, &num);
> + if (ret == firstret) {
> + *pnum += num;
> + } else {
> + break;
> + }
The break makes && ret == firstret redundant above. I suggest just
while (nb_sectors > 0) { ... } which is easier to read.
Also, if you respin the patch please tweak the commit message.
"Coalesce 'map' output" is more specific than "Fix 'map' output" -
unless this really fixes a bug which you didn't mention in the commit
description.
next prev parent reply other threads:[~2013-05-16 9:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-15 11:47 [Qemu-devel] [PATCH] qemu-io: Fix 'map' output Kevin Wolf
2013-05-16 9:14 ` Stefan Hajnoczi [this message]
2013-05-16 9:24 ` Kevin Wolf
2013-05-16 12:15 ` Stefan Hajnoczi
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=20130516091421.GJ1597@stefanha-thinkpad.redhat.com \
--to=stefanha@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).