All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] block: Change bdrv_commit to handle multiple sectors at once
Date: Mon, 19 Jul 2010 11:37:52 +0200	[thread overview]
Message-ID: <4C441CF0.3010909@redhat.com> (raw)
In-Reply-To: <20100716181633.GA29674@lst.de>

Am 16.07.2010 20:16, schrieb Christoph Hellwig:
> On Fri, Jul 16, 2010 at 06:17:36PM +0200, Kevin Wolf wrote:
>> +    buf = qemu_malloc(2048 * BDRV_SECTOR_SIZE);
> 
> Please add a COMMIT_BUF_SIZE #define instead of the hardcoded 2048 in
> various places.
> 
>>      for (i = 0; i < total_sectors;) {
>> +        if (drv->bdrv_is_allocated(bs, i, 2048, &n)) {
>>  
>> +            if (bdrv_read(bs, i, buf, n) != 0) {
>> +                ret = -EIO;
>> +                goto ro_cleanup;
>> +            }
>> +
>> +            if (bdrv_write(bs->backing_hd, i, buf, n) != 0) {
>> +                ret = -EIO;
>> +                goto ro_cleanup;
>> +            }
>>          }
>> +        i += n;
> 
> Maybe it's just me, but I'd prefer n getting a more descriptive name
> (e.g. sector) and moving the increment of it into the for loop, e.g.
> 
> 	for (sector = 0; sector < total_sectors; sector += n) {
> 		if (!drv->bdrv_is_allocated(bs, i, 2048, &n))
> 			continue;
> 		...
> 	}

So you mean i should be renamed, not n, right? I'll change these points
in v2.

Kevin

  reply	other threads:[~2010-07-19  9:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-16 16:17 [Qemu-devel] [PATCH] block: Change bdrv_commit to handle multiple sectors at once Kevin Wolf
2010-07-16 18:16 ` Christoph Hellwig
2010-07-19  9:37   ` Kevin Wolf [this message]
2010-07-17  7:26 ` 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=4C441CF0.3010909@redhat.com \
    --to=kwolf@redhat.com \
    --cc=hch@lst.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.