[Qemu-devel] [PATCH 06/29] migration/block: use QEMU_IS_ALIGNED macro

Philippe Mathieu-Daudé posted 29 patches 8 years, 6 months ago
Only 28 patches received!
[Qemu-devel] [PATCH 06/29] migration/block: use QEMU_IS_ALIGNED macro
Posted by Philippe Mathieu-Daudé 8 years, 6 months ago
Applied using the Coccinelle semantic patch scripts/coccinelle/use_osdep.cocci

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 migration/block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/migration/block.c b/migration/block.c
index 9171f60028..498c72ad59 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -933,7 +933,7 @@ static int block_load(QEMUFile *f, void *opaque, int version_id)
                 ret = bdrv_get_info(blk_bs(blk), &bdi);
                 if (ret == 0 && bdi.cluster_size > 0 &&
                     bdi.cluster_size <= BLOCK_SIZE &&
-                    BLOCK_SIZE % bdi.cluster_size == 0) {
+                    QEMU_IS_ALIGNED(BLOCK_SIZE, bdi.cluster_size)) {
                     cluster_size = bdi.cluster_size;
                 } else {
                     cluster_size = BLOCK_SIZE;
-- 
2.13.2


Re: [Qemu-devel] [PATCH 06/29] migration/block: use QEMU_IS_ALIGNED macro
Posted by Juan Quintela 8 years, 6 months ago
Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> Applied using the Coccinelle semantic patch scripts/coccinelle/use_osdep.cocci
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  migration/block.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/migration/block.c b/migration/block.c
> index 9171f60028..498c72ad59 100644
> --- a/migration/block.c
> +++ b/migration/block.c
> @@ -933,7 +933,7 @@ static int block_load(QEMUFile *f, void *opaque, int version_id)
>                  ret = bdrv_get_info(blk_bs(blk), &bdi);
>                  if (ret == 0 && bdi.cluster_size > 0 &&
>                      bdi.cluster_size <= BLOCK_SIZE &&
> -                    BLOCK_SIZE % bdi.cluster_size == 0) {
> +                    QEMU_IS_ALIGNED(BLOCK_SIZE, bdi.cluster_size)) {
>                      cluster_size = bdi.cluster_size;
>                  } else {
>                      cluster_size = BLOCK_SIZE;

Reviewed-by: Juan Quintela <quintela@redhat.com>

Should I take this patch, or does it go through the block layer?  Your
call.

Later, Juan.

Re: [Qemu-devel] [PATCH 06/29] migration/block: use QEMU_IS_ALIGNED macro
Posted by Alex Bennée 8 years, 6 months ago
Juan Quintela <quintela@redhat.com> writes:

> Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>> Applied using the Coccinelle semantic patch scripts/coccinelle/use_osdep.cocci
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>  migration/block.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/migration/block.c b/migration/block.c
>> index 9171f60028..498c72ad59 100644
>> --- a/migration/block.c
>> +++ b/migration/block.c
>> @@ -933,7 +933,7 @@ static int block_load(QEMUFile *f, void *opaque, int version_id)
>>                  ret = bdrv_get_info(blk_bs(blk), &bdi);
>>                  if (ret == 0 && bdi.cluster_size > 0 &&
>>                      bdi.cluster_size <= BLOCK_SIZE &&
>> -                    BLOCK_SIZE % bdi.cluster_size == 0) {
>> +                    QEMU_IS_ALIGNED(BLOCK_SIZE, bdi.cluster_size)) {
>>                      cluster_size = bdi.cluster_size;
>>                  } else {
>>                      cluster_size = BLOCK_SIZE;
>
> Reviewed-by: Juan Quintela <quintela@redhat.com>
>
> Should I take this patch, or does it go through the block layer?  Your
> call.

Given it is part of a set would it not make more sense going through
-trivial with the rest of them?

--
Alex Bennée