All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, kwolf@redhat.com, jsnow@redhat.com,
	qemu-block@nongnu.org, el13635@mail.ntua.gr,
	Max Reitz <mreitz@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 14/15] block: Align block status requests
Date: Wed, 5 Jul 2017 20:12:04 +0800	[thread overview]
Message-ID: <20170705121204.GG29382@lemon.lan> (raw)
In-Reply-To: <9d6ff1e7-4d8a-a329-3c2a-0305f1bc706d@redhat.com>

On Wed, 07/05 07:01, Eric Blake wrote:
> On 07/04/2017 04:44 AM, Fam Zheng wrote:
> > On Mon, 07/03 17:14, Eric Blake wrote:
> >> Any device that has request_alignment greater than 512 should be
> >> unable to report status at a finer granularity; it may also be
> >> simpler for such devices to be guaranteed that the block layer
> >> has rounded things out to the granularity boundary (the way the
> >> block layer already rounds all other I/O out).  Besides, getting
> >> the code correct for super-sector alignment also benefits us
> >> for the fact that our public interface now has byte granularity,
> >> even though none of our drivers have byte-level callbacks.
> >>
> >> Add an assertion in blkdebug that proves that the block layer
> >> never requests status of unaligned sections, similar to what it
> >> does on other requests (while still keeping the generic helper
> >> in place for when future patches add a throttle driver).  Note
> >> note that iotest 177 already covers this (it would fail if you
> > 
> > Drop one "note"?
> 
> Indeed. There are studies on how people read that show that redundant
> words that cross a line boundaries are the most easy to mentally overlook.
> 
> 
> >> +    /* Round out to request_alignment boundaries */
> >> +    align = MAX(bs->bl.request_alignment, BDRV_SECTOR_SIZE);
> >> +    aligned_offset = QEMU_ALIGN_DOWN(offset, align);
> >> +    aligned_bytes = ROUND_UP(offset + bytes, align) - aligned_offset;
> >> +
> >> +    {
> > 
> > Not sure why using a {} block here?
> > 
> >> +        int count; /* sectors */
> 
> Because it makes it easier (less indentation churn) to delete the code
> when series 4 later deletes the .bdrv_co_get_block_status sector-based
> callback in favor of the newer .bdrv_co_block_status byte-based (patch
> 16/15 which start series 4 turns it into an if statement, then a later
> patch deletes the entire conditional); it is also justifiable because it
> creates a tighter scope for 'int count' which is needed only on the
> boundary of sector-based operations when the rest of the function is
> byte-based (rather than declaring the helper variable up front).  I'll
> have to call it out more specifically in the commit message as intentional.

Thanks for explaining, with the syntax error fixed in the commit message:

Reviewed-by: Fam Zheng <famz@redhat.com>

  reply	other threads:[~2017-07-05 12:12 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-03 22:14 [Qemu-devel] [PATCH v2 00/15] make bdrv_get_block_status byte-based Eric Blake
2017-07-03 22:14 ` [Qemu-devel] [PATCH v2 01/15] block: add default implementations for bdrv_co_get_block_status() Eric Blake
2017-07-04  7:33   ` Fam Zheng
2017-07-05 22:00   ` Eric Blake
2017-07-03 22:14 ` [Qemu-devel] [PATCH v2 02/15] block: Allow NULL file for bdrv_get_block_status() Eric Blake
2017-07-04  7:33   ` Fam Zheng
2017-07-03 22:14 ` [Qemu-devel] [PATCH v2 03/15] block: Add flag to avoid wasted work in bdrv_is_allocated() Eric Blake
2017-07-04  7:06   ` Fam Zheng
2017-07-05 11:56     ` Eric Blake
2017-07-05 12:07       ` Fam Zheng
2017-07-05 14:01         ` Eric Blake
2017-07-05 14:21           ` Fam Zheng
2017-07-06  2:35   ` Eric Blake
2017-07-03 22:14 ` [Qemu-devel] [PATCH v2 04/15] block: Make bdrv_round_to_clusters() signature more useful Eric Blake
2017-07-04  7:34   ` Fam Zheng
2017-07-03 22:14 ` [Qemu-devel] [PATCH v2 05/15] qcow2: Switch is_zero_sectors() to byte-based Eric Blake
2017-07-04  7:34   ` Fam Zheng
2017-07-03 22:14 ` [Qemu-devel] [PATCH v2 06/15] block: Switch bdrv_make_zero() " Eric Blake
2017-07-04  7:35   ` Fam Zheng
2017-07-03 22:14 ` [Qemu-devel] [PATCH v2 07/15] qemu-img: Switch get_block_status() " Eric Blake
2017-07-04  7:40   ` Fam Zheng
2017-07-03 22:14 ` [Qemu-devel] [PATCH v2 08/15] block: Convert bdrv_get_block_status() to bytes Eric Blake
2017-07-04  8:40   ` Fam Zheng
2017-07-03 22:14 ` [Qemu-devel] [PATCH v2 09/15] block: Switch bdrv_co_get_block_status() to byte-based Eric Blake
2017-07-04  8:59   ` Fam Zheng
2017-07-03 22:14 ` [Qemu-devel] [PATCH v2 10/15] block: Switch BdrvCoGetBlockStatusData " Eric Blake
2017-07-04  9:00   ` Fam Zheng
2017-07-03 22:14 ` [Qemu-devel] [PATCH v2 11/15] block: Switch bdrv_common_block_status_above() " Eric Blake
2017-07-04  9:02   ` Fam Zheng
2017-07-03 22:14 ` [Qemu-devel] [PATCH v2 12/15] block: Switch bdrv_co_get_block_status_above() " Eric Blake
2017-07-04  9:28   ` Fam Zheng
2017-07-03 22:14 ` [Qemu-devel] [PATCH v2 13/15] block: Convert bdrv_get_block_status_above() to bytes Eric Blake
2017-07-04  9:32   ` Fam Zheng
2017-07-03 22:14 ` [Qemu-devel] [PATCH v2 14/15] block: Align block status requests Eric Blake
2017-07-04  9:44   ` Fam Zheng
2017-07-05 12:01     ` Eric Blake
2017-07-05 12:12       ` Fam Zheng [this message]
2017-07-03 22:14 ` [Qemu-devel] [PATCH v2 15/15] qemu-io: Relax 'alloc' now that block-status doesn't assert Eric Blake
2017-07-04  9:50   ` Fam Zheng
2017-07-03 22:20 ` [Qemu-devel] [RFC PATCH v2 16/15] block: Add .bdrv_co_block_status() callback Eric Blake
2017-07-04 11:30   ` Fam Zheng

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=20170705121204.GG29382@lemon.lan \
    --to=famz@redhat.com \
    --cc=eblake@redhat.com \
    --cc=el13635@mail.ntua.gr \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.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 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.