[Qemu-devel] [PATCH 03/29] qemu-img: use QEMU_IS_ALIGNED macro

Philippe Mathieu-Daudé posted 29 patches 8 years, 6 months ago
Only 28 patches received!
[Qemu-devel] [PATCH 03/29] qemu-img: 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>
---
 qemu-img.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qemu-img.c b/qemu-img.c
index 182e697f81..6f5f956302 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -3804,7 +3804,7 @@ static void bench_cb(void *opaque, int ret)
         b->in_flight--;
 
         /* Time for flush? Drain queue if requested, then flush */
-        if (b->flush_interval && remaining % b->flush_interval == 0) {
+        if (b->flush_interval && QEMU_IS_ALIGNED(remaining, b->flush_interval)) {
             if (!b->in_flight || !b->drain_on_flush) {
                 BlockCompletionFunc *cb;
 
-- 
2.13.2


Re: [Qemu-devel] [PATCH 03/29] qemu-img: use QEMU_IS_ALIGNED macro
Posted by Eric Blake 8 years, 6 months ago
On 07/18/2017 01:09 AM, Philippe Mathieu-Daudé wrote:
> Applied using the Coccinelle semantic patch scripts/coccinelle/use_osdep.cocci
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  qemu-img.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/qemu-img.c b/qemu-img.c
> index 182e697f81..6f5f956302 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -3804,7 +3804,7 @@ static void bench_cb(void *opaque, int ret)
>          b->in_flight--;
>  
>          /* Time for flush? Drain queue if requested, then flush */
> -        if (b->flush_interval && remaining % b->flush_interval == 0) {
> +        if (b->flush_interval && QEMU_IS_ALIGNED(remaining, b->flush_interval)) {
>              if (!b->in_flight || !b->drain_on_flush) {
>                  BlockCompletionFunc *cb;
>  
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org