From: John Snow <jsnow@redhat.com>
To: Nir Soffer <nirsof@gmail.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Fam Zheng <fam@euphon.net>,
qemu-block@nongnu.org, Juan Quintela <quintela@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Max Reitz <mreitz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v2 2/2] block: Remove unused masks
Date: Wed, 28 Aug 2019 15:12:46 -0400 [thread overview]
Message-ID: <b3437d45-f212-6b77-66d5-183f2dab53f0@redhat.com> (raw)
In-Reply-To: <20190827185913.27427-3-nsoffer@redhat.com>
On 8/27/19 2:59 PM, Nir Soffer wrote:
> Replace confusing usage:
>
> ~BDRV_SECTOR_MASK
>
> With more clear:
>
> (BDRV_SECTOR_SIZE - 1)
>
> Remove BDRV_SECTOR_MASK and the unused BDRV_BLOCK_OFFSET_MASK which was
> it's last user.
>
Kind of lateral in my opinion, but if there was only ONE user across TWO
definitions, then for sure it can go, especially because using the
ALIGNED macros is indeed nicer and should be encouraged.
Reviewed-by: John Snow <jsnow@redhat.com>
> Signed-off-by: Nir Soffer <nsoffer@redhat.com>
> ---
> include/block/block.h | 2 --
> migration/block.c | 2 +-
> 2 files changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/include/block/block.h b/include/block/block.h
> index 124ad40809..37c9de7446 100644
> --- a/include/block/block.h
> +++ b/include/block/block.h
> @@ -143,7 +143,6 @@ typedef struct HDGeometry {
>
> #define BDRV_SECTOR_BITS 9
> #define BDRV_SECTOR_SIZE (1ULL << BDRV_SECTOR_BITS)
> -#define BDRV_SECTOR_MASK ~(BDRV_SECTOR_SIZE - 1)
>
> #define BDRV_REQUEST_MAX_SECTORS MIN(SIZE_MAX >> BDRV_SECTOR_BITS, \
> INT_MAX >> BDRV_SECTOR_BITS)
> @@ -195,7 +194,6 @@ typedef struct HDGeometry {
> #define BDRV_BLOCK_ALLOCATED 0x10
> #define BDRV_BLOCK_EOF 0x20
> #define BDRV_BLOCK_RECURSE 0x40
> -#define BDRV_BLOCK_OFFSET_MASK BDRV_SECTOR_MASK
>
> typedef QSIMPLEQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry) BlockReopenQueue;
>
> diff --git a/migration/block.c b/migration/block.c
> index aa747b55fa..92c36b68ec 100644
> --- a/migration/block.c
> +++ b/migration/block.c
> @@ -906,7 +906,7 @@ static int block_load(QEMUFile *f, void *opaque, int version_id)
> do {
> addr = qemu_get_be64(f);
>
> - flags = addr & ~BDRV_SECTOR_MASK;
> + flags = addr & (BDRV_SECTOR_SIZE - 1);
> addr >>= BDRV_SECTOR_BITS;
>
> if (flags & BLK_MIG_FLAG_DEVICE_BLOCK) {
>
next prev parent reply other threads:[~2019-08-28 20:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-27 18:59 [Qemu-devel] [PATCH v2 0/2] Alignment checks cleanup Nir Soffer
2019-08-27 18:59 ` [Qemu-devel] [PATCH v2 1/2] block: Use QEMU_IS_ALIGNED Nir Soffer
2019-08-27 18:59 ` [Qemu-devel] [PATCH v2 2/2] block: Remove unused masks Nir Soffer
2019-08-28 10:44 ` Juan Quintela
2019-08-28 19:12 ` John Snow [this message]
2019-08-28 19:15 ` [Qemu-devel] [Qemu-block] [PATCH v2 0/2] Alignment checks cleanup John Snow
2019-08-30 20:25 ` Nir Soffer
2019-09-05 8:45 ` Nir Soffer
2019-09-10 10:42 ` [Qemu-devel] " Max Reitz
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=b3437d45-f212-6b77-66d5-183f2dab53f0@redhat.com \
--to=jsnow@redhat.com \
--cc=dgilbert@redhat.com \
--cc=fam@euphon.net \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=nirsof@gmail.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--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).