On 17.08.19 19:53, Nir Soffer wrote:
> Replace instances of:
> 
>     (n & (BDRV_SECTOR_SIZE - 1)) == 0)
> 
> With:
> 
>     QEMU_IS_ALIGNED(n, BDRV_SECTOR_SIZE)
> 
> Which reveals the intent of the code better, and makes it easier to
> locate the code checking alignment.
> 
> QEMU_IS_ALIGNED is implemented using %, which may be less efficient but
> it is used only in assert() except one instance, so it should not
> matter.
> 
> Signed-off-by: Nir Soffer <nsof...@redhat.com>
> ---
>  block/bochs.c | 4 ++--
>  block/cloop.c | 4 ++--
>  block/dmg.c   | 4 ++--
>  block/io.c    | 8 ++++----
>  block/qcow2.c | 4 ++--
>  block/vvfat.c | 8 ++++----
>  qemu-img.c    | 2 +-
>  7 files changed, 17 insertions(+), 17 deletions(-)

Because John was speaking about a magical incantation, I found
BDRV_SECTOR_MASK.  There are two places in block/qcow2-cluster.c that
use that to check alignment, I think those should be amended as well.

Max

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to