Re: [Qemu-devel] [PATCH] mirror: Use DIV_ROUND_UP

2014-04-28 Thread Kevin Wolf
Am 28.04.2014 um 04:59 hat Fam Zheng geschrieben:
 Although bdrv_getlength() was just called above this, and checked for
 error, it is better to just use the value we already get, and use
 DIV_ROUND_UP.
 
 Signed-off-by: Fam Zheng f...@redhat.com

The subject line is kind of hiding the real intention of the patch,
which appears to be getting rid of a bdrv_getlength() call without error
checks.

Anyway, the patch itself looks fine, applied to the block branch.

Kevin



[Qemu-devel] [PATCH] mirror: Use DIV_ROUND_UP

2014-04-27 Thread Fam Zheng
Although bdrv_getlength() was just called above this, and checked for
error, it is better to just use the value we already get, and use
DIV_ROUND_UP.

Signed-off-by: Fam Zheng f...@redhat.com
---
 block/mirror.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/mirror.c b/block/mirror.c
index 2618c37..c56cf00 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -329,7 +329,7 @@ static void coroutine_fn mirror_run(void *opaque)
 return;
 }
 
-length = (bdrv_getlength(bs) + s-granularity - 1) / s-granularity;
+length = DIV_ROUND_UP(s-common.len, s-granularity);
 s-in_flight_bitmap = bitmap_new(length);
 
 /* If we have no backing file yet in the destination, we cannot let
-- 
1.9.2